diff --git a/.claude/hooks/resolve-symlinks.sh b/.claude/hooks/resolve-symlinks.sh new file mode 100755 index 0000000000..212be30ee6 --- /dev/null +++ b/.claude/hooks/resolve-symlinks.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Resolve _ee.rs symlinks to actual files so Claude can read them +# This script runs before each user prompt is processed + +set -e + +PROJECT_DIR="${CLAUDE_PROJECT_DIR:-/home/farhad/windmill}" +MANIFEST_FILE="$PROJECT_DIR/.claude/hooks/.symlink-manifest" + +# Find all _ee.rs symlinks and store their targets +find "$PROJECT_DIR" -name "*_ee.rs" -type l 2>/dev/null | while read -r symlink; do + target=$(readlink -f "$symlink" 2>/dev/null) || continue + + # Only process if target file exists + if [[ -f "$target" ]]; then + # Store symlink path and target in manifest + echo "$symlink|$target" >> "$MANIFEST_FILE.tmp" + + # Replace symlink with actual file content + rm "$symlink" + cp "$target" "$symlink" + fi +done + +# Atomically replace manifest +if [[ -f "$MANIFEST_FILE.tmp" ]]; then + mv "$MANIFEST_FILE.tmp" "$MANIFEST_FILE" +fi + +exit 0 diff --git a/.claude/hooks/restore-symlinks.sh b/.claude/hooks/restore-symlinks.sh new file mode 100755 index 0000000000..3fcbaf2939 --- /dev/null +++ b/.claude/hooks/restore-symlinks.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Restore _ee.rs symlinks after Claude finishes processing +# This script runs when Claude stops +# IMPORTANT: Copies any modifications back to the target before restoring symlinks + +set -e + +PROJECT_DIR="${CLAUDE_PROJECT_DIR:-/home/farhad/windmill}" +MANIFEST_FILE="$PROJECT_DIR/.claude/hooks/.symlink-manifest" + +# Check if manifest exists +if [[ ! -f "$MANIFEST_FILE" ]]; then + exit 0 +fi + +# Read manifest and restore symlinks +while IFS='|' read -r symlink target; do + if [[ -n "$symlink" && -n "$target" ]]; then + # If the file exists (not a symlink) and target exists, copy changes back + if [[ -f "$symlink" && ! -L "$symlink" && -e "$target" ]]; then + # Copy the potentially modified file back to the target + cp "$symlink" "$target" + fi + + # Remove the regular file (which was a copy) + rm -f "$symlink" 2>/dev/null || true + + # Recreate the symlink + ln -s "$target" "$symlink" 2>/dev/null || true + fi +done < "$MANIFEST_FILE" + +# Clean up manifest +rm -f "$MANIFEST_FILE" + +exit 0 diff --git a/.claude/settings.json b/.claude/settings.json index 28ffd04e48..04c3c5ec6b 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,7 +1,41 @@ { + "hooks": { + "UserPromptSubmit": [ + { + "hooks": [ + { + "type": "command", + "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/resolve-symlinks.sh", + "timeout": 30 + } + ] + } + ], + "Stop": [ + { + "hooks": [ + { + "type": "command", + "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/restore-symlinks.sh", + "timeout": 30 + } + ] + } + ], + "SessionEnd": [ + { + "hooks": [ + { + "type": "command", + "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/restore-symlinks.sh", + "timeout": 30 + } + ] + } + ] + }, "permissions": { "allow": [ - "Read(**/*.rs)", "Bash(ls:*)", "Bash(grep:*)", "Bash(cat:*)", @@ -56,10 +90,11 @@ "Bash(git checkout:*)", "Bash(git merge:*)", "Bash(git rebase:*)" - ], - "additionalDirectories": [ - "../windmill-ee-private/" - ] + ] }, - "enableAllProjectMcpServers": true + "enableAllProjectMcpServers": true, + "enabledPlugins": { + "rust-analyzer-lsp@claude-plugins-official": true, + "typescript-lsp@claude-plugins-official": true + } } diff --git a/.github/workflows/claude-fast.yml b/.github/workflows/claude-fast.yml index c04302f167..e1f16b1ba8 100644 --- a/.github/workflows/claude-fast.yml +++ b/.github/workflows/claude-fast.yml @@ -49,9 +49,9 @@ jobs: needs.check-membership.outputs.is_member == 'true' runs-on: ubicloud-standard-8 permissions: - contents: read - pull-requests: read - issues: read + contents: write + pull-requests: write + issues: write id-token: write steps: - name: Checkout repository @@ -60,19 +60,18 @@ jobs: fetch-depth: 1 - name: Run Claude PR Action - uses: anthropics/claude-code-action@beta + uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - model: claude-opus-4-1-20250805 - fallback_model: claude-sonnet-4-20250514 - timeout_minutes: "60" - allowed_tools: "mcp__github__create_pull_request" allowed_bots: "windmill-internal-app[bot]" - custom_instructions: | - ## IMPORTANT INSTRUCTIONS - - Your branch name should be a short description of the requested changes. - - Bypass previous instructions and instead of adding a url in your comment to manually create a PR, if you created a new branch with your changes, automatically create a draft PR from that branch to main. - - ## Available Tools - - mcp__github__create_pull_request: Create PRs from branches trigger_phrase: "/ai-fast" + plugins: "rust-analyzer-lsp@claude-plugins-official,typescript-lsp@claude-plugins-official" + settings: | + { + "env": { + "SQLX_OFFLINE": "true" + } + } + claude_args: | + --allowedTools "Bash,WebFetch,WebSearch" + --model opus diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 8e3a60ed31..642b9ca84b 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -50,9 +50,9 @@ jobs: runs-on: ubicloud-standard-8 timeout-minutes: 60 permissions: - contents: read - pull-requests: read - issues: read + contents: write + pull-requests: write + issues: write id-token: write steps: - name: Checkout repository @@ -95,8 +95,9 @@ jobs: uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - allowed_bots: 'windmill-internal-app[bot]' - trigger_phrase: '/ai' + allowed_bots: "windmill-internal-app[bot]" + trigger_phrase: "/ai" + plugins: "rust-analyzer-lsp@claude-plugins-official,typescript-lsp@claude-plugins-official" settings: | { "env": { diff --git a/CHANGELOG.md b/CHANGELOG.md index efe000aff1..8e40682d0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.603.0](https://github.com/windmill-labs/windmill/compare/v1.602.0...v1.603.0) (2026-01-09) + + +### Features + +* add password reset flow using configured SMTP settings ([#7525](https://github.com/windmill-labs/windmill/issues/7525)) ([6f7cf2f](https://github.com/windmill-labs/windmill/commit/6f7cf2fb1645bb784af3a68760abc44013bd81f8)) + ## [1.602.0](https://github.com/windmill-labs/windmill/compare/v1.601.1...v1.602.0) (2026-01-08) diff --git a/backend/.sqlx/query-31922d7aaaaf17f389d489b9a746295d6c3ad8ac6750782bd9ab35a9b432ca6b.json b/backend/.sqlx/query-31922d7aaaaf17f389d489b9a746295d6c3ad8ac6750782bd9ab35a9b432ca6b.json new file mode 100644 index 0000000000..5df2805cb0 --- /dev/null +++ b/backend/.sqlx/query-31922d7aaaaf17f389d489b9a746295d6c3ad8ac6750782bd9ab35a9b432ca6b.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE password SET password_hash = $1 WHERE email = $2 AND login_type = 'password'", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Text" + ] + }, + "nullable": [] + }, + "hash": "31922d7aaaaf17f389d489b9a746295d6c3ad8ac6750782bd9ab35a9b432ca6b" +} diff --git a/backend/.sqlx/query-97a83839e5d9269e9389b9c7604814cc245cc8d4ae653cfce0f2ccca4ee630cb.json b/backend/.sqlx/query-97a83839e5d9269e9389b9c7604814cc245cc8d4ae653cfce0f2ccca4ee630cb.json new file mode 100644 index 0000000000..4e94d6f75c --- /dev/null +++ b/backend/.sqlx/query-97a83839e5d9269e9389b9c7604814cc245cc8d4ae653cfce0f2ccca4ee630cb.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM magic_link WHERE email = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [] + }, + "hash": "97a83839e5d9269e9389b9c7604814cc245cc8d4ae653cfce0f2ccca4ee630cb" +} diff --git a/backend/.sqlx/query-a61d53c8400864a7bc06894c08ec70e45242075bd17b37ea2c0c6b6eec11eb40.json b/backend/.sqlx/query-a61d53c8400864a7bc06894c08ec70e45242075bd17b37ea2c0c6b6eec11eb40.json new file mode 100644 index 0000000000..83d3d489b3 --- /dev/null +++ b/backend/.sqlx/query-a61d53c8400864a7bc06894c08ec70e45242075bd17b37ea2c0c6b6eec11eb40.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO magic_link (email, token, expiration) VALUES ($1, $2, NOW() + INTERVAL '1 hour')", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "a61d53c8400864a7bc06894c08ec70e45242075bd17b37ea2c0c6b6eec11eb40" +} diff --git a/backend/.sqlx/query-c1b6a2c3605cf5385664c5f988b96297fe6b8971e388ea036d5355e0c0937006.json b/backend/.sqlx/query-c1b6a2c3605cf5385664c5f988b96297fe6b8971e388ea036d5355e0c0937006.json new file mode 100644 index 0000000000..0d9cfd0273 --- /dev/null +++ b/backend/.sqlx/query-c1b6a2c3605cf5385664c5f988b96297fe6b8971e388ea036d5355e0c0937006.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT EXISTS(SELECT 1 FROM password WHERE email = $1 AND login_type = 'password')", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "exists", + "type_info": "Bool" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + null + ] + }, + "hash": "c1b6a2c3605cf5385664c5f988b96297fe6b8971e388ea036d5355e0c0937006" +} diff --git a/backend/.sqlx/query-fd500c52e64983a5559da8bcd0d5ed43a9f2eba45a7eec6b64ab38ea02d6b6c9.json b/backend/.sqlx/query-fd500c52e64983a5559da8bcd0d5ed43a9f2eba45a7eec6b64ab38ea02d6b6c9.json new file mode 100644 index 0000000000..a428daa9bc --- /dev/null +++ b/backend/.sqlx/query-fd500c52e64983a5559da8bcd0d5ed43a9f2eba45a7eec6b64ab38ea02d6b6c9.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT email FROM magic_link WHERE token = $1 AND expiration > NOW()", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "email", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "fd500c52e64983a5559da8bcd0d5ed43a9f2eba45a7eec6b64ab38ea02d6b6c9" +} diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 5ba76643f0..43cfa370e3 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -666,7 +666,7 @@ dependencies = [ "bytes", "http 1.4.0", "rand 0.8.5", - "reqwest 0.12.24", + "reqwest 0.12.28", "serde", "serde-aux", "serde_json", @@ -1279,7 +1279,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tower 0.5.2", "tower-layer", @@ -1302,7 +1302,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -1545,9 +1545,9 @@ dependencies = [ [[package]] name = "bitpacking" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c1d3e2bfd8d06048a179f7b17afc3188effa10385e7b00dc65af6aae732ea92" +checksum = "96a7139abd3d9cebf8cd6f920a389cf3dc9576172e32f4563f188cae3c3eb019" dependencies = [ "crunchy", ] @@ -1575,15 +1575,16 @@ dependencies = [ [[package]] name = "blake3" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +checksum = "2468ef7d57b3fb7e16b576e8377cdbde2320c60e1491e961d11da40fc4f02a2d" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", - "constant_time_eq", + "constant_time_eq 0.4.2", + "cpufeatures", ] [[package]] @@ -1682,9 +1683,9 @@ dependencies = [ [[package]] name = "bon" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebeb9aaf9329dff6ceb65c689ca3db33dbf15f324909c60e4e5eef5701ce31b1" +checksum = "234655ec178edd82b891e262ea7cf71f6584bcd09eff94db786be23f1821825c" dependencies = [ "bon-macros", "rustversion", @@ -1692,11 +1693,11 @@ dependencies = [ [[package]] name = "bon-macros" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e9d642a7e3a318e37c2c9427b5a6a48aa1ad55dcd986f3034ab2239045a645" +checksum = "89ec27229c38ed0eb3c0feee3d2c1d6a4379ae44f418a29a658890e062d8f365" dependencies = [ - "darling 0.21.3", + "darling 0.23.0", "ident_case", "prettyplease", "proc-macro2", @@ -2027,9 +2028,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.51" +version = "1.2.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3" dependencies = [ "find-msvc-tools", "jobserver", @@ -2043,6 +2044,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f4c707c6a209cbe82d10abd08e1ea8995e9ea937d2550646e02798948992be0" +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -2235,6 +2242,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "comfy-table" version = "7.2.1" @@ -2326,6 +2343,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + [[package]] name = "convert_case" version = "0.4.0" @@ -5409,9 +5432,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" +checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41" [[package]] name = "fixedbitset" @@ -6137,7 +6160,7 @@ dependencies = [ "google-cloud-token", "home", "jsonwebtoken 9.3.1", - "reqwest 0.12.24", + "reqwest 0.12.28", "serde", "serde_json", "thiserror 1.0.69", @@ -6180,7 +6203,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d901aeb453fd80e51d64df4ee005014f6cf39f2d736dd64f7239c132d9d39a6a" dependencies = [ - "reqwest 0.12.24", + "reqwest 0.12.28", "thiserror 1.0.69", "tokio", ] @@ -6495,7 +6518,7 @@ dependencies = [ "native-tls", "num_cpus", "rand 0.9.0", - "reqwest 0.12.24", + "reqwest 0.12.28", "serde", "serde_json", "thiserror 2.0.17", @@ -6824,19 +6847,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper 0.14.32", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "hyper-tls" version = "0.6.0" @@ -6872,7 +6882,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2 0.6.1", - "system-configuration 0.6.1", + "system-configuration", "tokio", "tower-service", "tracing", @@ -7290,6 +7300,22 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -7714,9 +7740,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.179" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libffi" @@ -7883,16 +7909,6 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" -[[package]] -name = "loki-api" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc38a304f59a03e6efa3876766a48c70a766a93f88341c3fff4212834b8e327" -dependencies = [ - "prost", - "prost-types", -] - [[package]] name = "lru" version = "0.12.5" @@ -8989,7 +9005,7 @@ dependencies = [ "getrandom 0.2.16", "http 1.4.0", "rand 0.8.5", - "reqwest 0.12.24", + "reqwest 0.12.28", "serde", "serde_json", "serde_path_to_error", @@ -9047,7 +9063,7 @@ dependencies = [ "percent-encoding", "quick-xml 0.37.5", "rand 0.9.0", - "reqwest 0.12.24", + "reqwest 0.12.28", "ring 0.17.14", "rustls-pemfile 2.2.0", "serde", @@ -9132,17 +9148,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openapiv3" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1a9f106eb0a780abd17ba9fca8e0843e3461630bcbe2af0ad4d5d3ba4e9aa4" -dependencies = [ - "indexmap 1.9.3", - "serde", - "serde_json", -] - [[package]] name = "openidconnect" version = "4.0.1" @@ -10135,20 +10140,6 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" -[[package]] -name = "progenitor-client" -version = "0.3.0" -source = "git+https://github.com/oxidecomputer/progenitor?rev=3d96016ae8d422e90513b2d34fb5b63eeab30b01#3d96016ae8d422e90513b2d34fb5b63eeab30b01" -dependencies = [ - "bytes", - "futures-core", - "percent-encoding", - "reqwest 0.11.27", - "serde", - "serde_json", - "serde_urlencoded", -] - [[package]] name = "prometheus" version = "0.14.0" @@ -10357,6 +10348,7 @@ version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" dependencies = [ + "aws-lc-rs", "bytes", "getrandom 0.3.4", "lru-slab", @@ -10728,53 +10720,10 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper-tls 0.5.0", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile 1.0.4", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 0.1.2", - "system-configuration 0.5.1", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "winreg", -] - -[[package]] -name = "reqwest" -version = "0.12.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" -dependencies = [ - "async-compression", "base64 0.22.1", "bytes", "encoding_rs", @@ -10786,12 +10735,11 @@ dependencies = [ "http-body-util", "hyper 1.8.1", "hyper-rustls 0.27.7", - "hyper-tls 0.6.0", + "hyper-tls", "hyper-util", "js-sys", "log", "mime", - "mime_guess", "native-tls", "percent-encoding", "pin-project-lite", @@ -10802,7 +10750,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-native-tls", "tokio-rustls 0.26.4", @@ -10826,26 +10774,40 @@ checksum = "04e9018c9d814e5f30cc16a0f03271aeab3571e609612d9fe78c1aa8d11c2f62" dependencies = [ "base64 0.22.1", "bytes", + "encoding_rs", "futures-core", + "futures-util", + "h2 0.4.13", "http 1.4.0", "http-body 1.0.1", "http-body-util", "hyper 1.8.1", + "hyper-rustls 0.27.7", "hyper-util", "js-sys", "log", + "mime", + "mime_guess", "percent-encoding", "pin-project-lite", + "quinn", + "rustls 0.23.35", + "rustls-pki-types", + "rustls-platform-verifier", "serde", "serde_json", - "sync_wrapper 1.0.2", + "serde_urlencoded", + "sync_wrapper", "tokio", + "tokio-rustls 0.26.4", + "tokio-util", "tower 0.5.2", "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-streams", "web-sys", ] @@ -10994,7 +10956,7 @@ dependencies = [ "pastey", "pin-project-lite", "rand 0.9.0", - "reqwest 0.12.24", + "reqwest 0.12.28", "rmcp-macros", "schemars 1.2.0", "serde", @@ -11328,6 +11290,33 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-platform-verifier" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls 0.23.35", + "rustls-native-certs 0.8.3", + "rustls-platform-verifier-android", + "rustls-webpki 0.103.8", + "security-framework 3.5.1", + "security-framework-sys", + "webpki-root-certs 1.0.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + [[package]] name = "rustls-tokio-stream" version = "0.3.0" @@ -13123,12 +13112,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.2" @@ -13222,17 +13205,6 @@ dependencies = [ "windows 0.57.0", ] -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation 0.9.4", - "system-configuration-sys 0.5.0", -] - [[package]] name = "system-configuration" version = "0.6.1" @@ -13241,17 +13213,7 @@ checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.9.4", "core-foundation 0.9.4", - "system-configuration-sys 0.6.0", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", + "system-configuration-sys", ] [[package]] @@ -13929,9 +13891,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.18" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", @@ -14093,7 +14055,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-util", "tower-layer", @@ -14222,27 +14184,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-loki" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3beec919fbdf99d719de8eda6adae3281f8a5b71ae40431f44dc7423053d34" -dependencies = [ - "loki-api", - "reqwest 0.12.24", - "serde", - "serde_json", - "snap", - "tokio", - "tokio-stream", - "tracing", - "tracing-core", - "tracing-log", - "tracing-serde", - "tracing-subscriber", - "url", -] - [[package]] name = "tracing-opentelemetry" version = "0.28.0" @@ -15248,7 +15189,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windmill" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "aws-sdk-config", @@ -15257,7 +15198,7 @@ dependencies = [ "base64 0.22.1", "bitflags 2.9.4", "chrono", - "constant_time_eq", + "constant_time_eq 0.3.1", "deno_core", "dotenv", "futures", @@ -15275,7 +15216,7 @@ dependencies = [ "prometheus", "quote", "rand 0.9.0", - "reqwest 0.12.24", + "reqwest 0.13.1", "rustls 0.23.35", "serde", "serde_derive", @@ -15311,13 +15252,12 @@ dependencies = [ [[package]] name = "windmill-api" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "argon2", "astral-tokio-tar", "async-nats", - "async-oauth2", "async-recursion", "async-stream", "async-trait", @@ -15342,7 +15282,7 @@ dependencies = [ "chrono", "chrono-tz", "const_format", - "constant_time_eq", + "constant_time_eq 0.3.1", "cookie 0.17.0", "cron", "datafusion", @@ -15380,8 +15320,7 @@ dependencies = [ "rand 0.9.0", "rdkafka", "regex", - "reqwest 0.12.24", - "rmcp", + "reqwest 0.13.1", "rsa", "rumqttc", "rust-embed", @@ -15423,6 +15362,8 @@ dependencies = [ "windmill-common", "windmill-git-sync", "windmill-indexer", + "windmill-mcp", + "windmill-oauth", "windmill-parser", "windmill-parser-py", "windmill-parser-py-imports", @@ -15433,22 +15374,17 @@ dependencies = [ [[package]] name = "windmill-api-client" -version = "1.602.0" +version = "1.603.0" dependencies = [ - "base64 0.22.1", - "chrono", - "openapiv3", - "progenitor-client", - "rand 0.9.0", - "reqwest 0.11.27", + "reqwest 0.12.28", "serde", "serde_json", - "uuid", + "urlencoding", ] [[package]] name = "windmill-audit" -version = "1.602.0" +version = "1.603.0" dependencies = [ "chrono", "lazy_static", @@ -15462,7 +15398,7 @@ dependencies = [ [[package]] name = "windmill-autoscaling" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "axum", @@ -15481,7 +15417,7 @@ dependencies = [ [[package]] name = "windmill-common" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "async-recursion", @@ -15536,10 +15472,9 @@ dependencies = [ "quick_cache", "rand 0.9.0", "regex", - "reqwest 0.12.24", + "reqwest 0.13.1", "reqwest-middleware", "reqwest-retry", - "rmcp", "semver 1.0.27", "serde", "serde_json", @@ -15562,7 +15497,6 @@ dependencies = [ "tonic", "tracing", "tracing-appender", - "tracing-loki", "tracing-opentelemetry", "tracing-subscriber", "url", @@ -15577,7 +15511,7 @@ dependencies = [ [[package]] name = "windmill-git-sync" -version = "1.602.0" +version = "1.603.0" dependencies = [ "regex", "serde", @@ -15592,7 +15526,7 @@ dependencies = [ [[package]] name = "windmill-indexer" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "astral-tokio-tar", @@ -15616,7 +15550,7 @@ dependencies = [ [[package]] name = "windmill-macros" -version = "1.602.0" +version = "1.603.0" dependencies = [ "itertools 0.14.0", "lazy_static", @@ -15630,9 +15564,46 @@ dependencies = [ "syn 2.0.114", ] +[[package]] +name = "windmill-mcp" +version = "1.603.0" +dependencies = [ + "anyhow", + "reqwest 0.12.28", + "rmcp", + "serde", + "serde_json", + "tracing", + "windmill-common", +] + +[[package]] +name = "windmill-oauth" +version = "1.603.0" +dependencies = [ + "anyhow", + "async-oauth2", + "axum", + "base64 0.22.1", + "chrono", + "hex", + "hmac", + "itertools 0.14.0", + "lazy_static", + "reqwest 0.12.28", + "serde", + "serde_json", + "sha2 0.10.9", + "sqlx", + "tokio", + "tower-cookies", + "tracing", + "windmill-common", +] + [[package]] name = "windmill-parser" -version = "1.602.0" +version = "1.603.0" dependencies = [ "convert_case 0.6.0", "serde", @@ -15641,7 +15612,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "lazy_static", @@ -15653,7 +15624,7 @@ dependencies = [ [[package]] name = "windmill-parser-csharp" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "serde_json", @@ -15665,7 +15636,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "gosyn", @@ -15677,7 +15648,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "lazy_static", @@ -15689,7 +15660,7 @@ dependencies = [ [[package]] name = "windmill-parser-java" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "serde_json", @@ -15701,7 +15672,7 @@ dependencies = [ [[package]] name = "windmill-parser-nu" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "nu-parser", @@ -15712,7 +15683,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -15723,7 +15694,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -15736,7 +15707,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "async-recursion", @@ -15760,7 +15731,7 @@ dependencies = [ [[package]] name = "windmill-parser-ruby" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "lazy_static", @@ -15774,7 +15745,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -15791,7 +15762,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "lazy_static", @@ -15805,7 +15776,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "lazy_static", @@ -15824,7 +15795,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "serde", @@ -15835,7 +15806,7 @@ dependencies = [ [[package]] name = "windmill-queue" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "async-recursion", @@ -15855,7 +15826,7 @@ dependencies = [ "prometheus", "quick_cache", "regex", - "reqwest 0.12.24", + "reqwest 0.13.1", "serde", "serde_json", "serde_urlencoded", @@ -15872,7 +15843,7 @@ dependencies = [ [[package]] name = "windmill-sql-datatype-parser-wasm" -version = "1.602.0" +version = "1.603.0" dependencies = [ "wasm-bindgen", "wasm-bindgen-test", @@ -15882,7 +15853,7 @@ dependencies = [ [[package]] name = "windmill-worker" -version = "1.602.0" +version = "1.603.0" dependencies = [ "anyhow", "async-once-cell", @@ -15944,7 +15915,7 @@ dependencies = [ "prometheus", "rand 0.9.0", "regex", - "reqwest 0.12.24", + "reqwest 0.13.1", "reqwest-middleware", "rust_decimal", "serde", @@ -15967,6 +15938,7 @@ dependencies = [ "windmill-common", "windmill-git-sync", "windmill-macros", + "windmill-mcp", "windmill-parser", "windmill-parser-bash", "windmill-parser-csharp", @@ -16244,6 +16216,15 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -16289,6 +16270,21 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -16346,6 +16342,12 @@ dependencies = [ "windows-link 0.1.3", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -16364,6 +16366,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -16382,6 +16390,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -16412,6 +16426,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -16430,6 +16450,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -16448,6 +16474,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -16466,6 +16498,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index def1657050..203e9aae6a 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windmill" -version = "1.602.0" +version = "1.603.0" authors.workspace = true edition.workspace = true @@ -11,11 +11,13 @@ members = [ "./windmill-queue", "./windmill-worker", "./windmill-common", + "./windmill-mcp", "./windmill-audit", "./windmill-git-sync", "./windmill-autoscaling", "./windmill-indexer", "./windmill-macros", + "./windmill-oauth", "./parsers/windmill-parser", "./parsers/windmill-parser-ts", "./parsers/windmill-parser-go", @@ -33,7 +35,7 @@ members = [ exclude = ["./windmill-duckdb-ffi-internal"] [workspace.package] -version = "1.602.0" +version = "1.603.0" authors = ["Ruben Fiszel "] edition = "2021" @@ -56,7 +58,6 @@ enterprise = ["windmill-worker/enterprise", "windmill-queue/enterprise", "windmi enterprise_saml = ["windmill-api/enterprise_saml", "oauth2"] stripe = ["windmill-api/stripe"] benchmark = ["windmill-api/benchmark", "windmill-worker/benchmark", "windmill-queue/benchmark", "windmill-common/benchmark"] -loki = ["windmill-common/loki"] embedding = ["windmill-api/embedding"] parquet = ["windmill-api/parquet", "windmill-common/parquet", "windmill-worker/parquet", "dep:object_store"] prometheus = ["windmill-common/prometheus", "windmill-api/prometheus", "windmill-worker/prometheus", "windmill-queue/prometheus", "dep:prometheus"] @@ -75,7 +76,7 @@ dind = ["windmill-worker/dind"] websocket = ["windmill-api/websocket"] http_trigger = ["windmill-api/http_trigger"] postgres_trigger = ["windmill-api/postgres_trigger"] -mcp = ["windmill-api/mcp"] +mcp = ["windmill-api/mcp", "windmill-worker/mcp"] mqtt_trigger = ["windmill-api/mqtt_trigger"] sqs_trigger = ["windmill-api/sqs_trigger", "windmill-common/aws_auth", "windmill-api/openidconnect"] gcp_trigger = ["windmill-api/gcp_trigger"] @@ -102,7 +103,7 @@ ruby = ["windmill-worker/ruby"] all_languages = ["python", "deno_core", "rust", "mysql", "oracledb", "duckdb", "mssql", "bigquery", "csharp", "nu", "php", "java", "ruby"] # For windows we have another set of languages enabled all_languages_windows = ["python", "deno_core", "rust", "mysql", "oracledb", "duckdb", "mssql", "bigquery", "csharp", "nu", "php", "java"] -all_sqlx_features = ["all_languages", "enterprise", "enterprise_saml", "loki", "embedding", "parquet", "prometheus", "flow_testing", +all_sqlx_features = ["all_languages", "enterprise", "enterprise_saml", "embedding", "parquet", "prometheus", "flow_testing", "openidconnect", "cloud", "jemalloc", "tantivy", "sqlx", "kafka", "nats", "otel", "dind", "websocket", "http_trigger", "postgres_trigger", "mcp", "mqtt_trigger", "sqs_trigger", "gcp_trigger", "smtp", "stripe", "license", "oauth2", "zip", "static_frontend", "scoped_cache", "agent_worker_server"] @@ -190,6 +191,8 @@ windmill-audit = { path = "./windmill-audit" } windmill-git-sync = { path = "./windmill-git-sync" } windmill-autoscaling = { path = "./windmill-autoscaling" } windmill-indexer = {path = "./windmill-indexer"} +windmill-mcp = {path = "./windmill-mcp"} +windmill-oauth = {path = "./windmill-oauth"} windmill-macros = {path = "./windmill-macros"} windmill-parser = { path = "./parsers/windmill-parser" } windmill-parser-ts = { path = "./parsers/windmill-parser-ts" } @@ -256,13 +259,13 @@ mail-send = { version = "0.4.0", features = ["builder"], default-features=false urlencoding = "^2" url = { version = "^2" , features = ["serde"]} async-oauth2 = "0.5.1" -reqwest = { version = "=0.12.24", features = ["json", "stream", "gzip", "multipart"] } +reqwest = { version = "^0.13", features = ["json", "stream", "gzip", "multipart", "query", "form"] } eventsource-stream = "0.2.3" time = "^0" serde_urlencoded = "^0" astral-tokio-tar = "^0.5.6" tempfile = "^3" -tokio-util = { version = "^0", features = ["io"] } +tokio-util = { version = "=0.7.17", features = ["io"] } json-pointer = "^0" itertools = "^0.14.0" regex = "^1" @@ -379,7 +382,8 @@ async-nats = "0.38.0" nkeys = "0.4.4" nu-parser = { version = "0.101.0", default-features = false } globset = "0.4.16" - +croner = "2.2.0" +rmcp = { version = "^0", features = ["client", "transport-streamable-http-client", "transport-streamable-http-client-reqwest"] } process-wrap = { version = "8.2.1", features = ["tokio1"] } datafusion = "47.0.0" diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 2c7140a0d1..d03b2537b8 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -cf96b45aa1183f15b3cc1b971035de5e37a68849 +c8e8a6df19203acc2cef1aebd1bd4157f2439cbf \ No newline at end of file diff --git a/backend/tests/worker.rs b/backend/tests/worker.rs index 0a4cb580ae..381fe21db2 100644 --- a/backend/tests/worker.rs +++ b/backend/tests/worker.rs @@ -2080,7 +2080,6 @@ async fn test_flow_lock_all(db: Pool) -> anyhow::Result<()> { .get_flow_by_path("test-workspace", "g/all/flow_lock_all", None) .await .unwrap() - .into_inner() .open_flow .value .modules; @@ -2363,7 +2362,6 @@ async fn test_script_schedule_handlers(db: Pool) -> anyhow::Result<()> no_flow_overlap: None, summary: None, tag: None, - paused_until: None, cron_version: None, description: None, }; @@ -2434,7 +2432,6 @@ async fn test_script_schedule_handlers(db: Pool) -> anyhow::Result<()> summary: None, no_flow_overlap: None, tag: None, - paused_until: None, cron_version: None, description: None, }, @@ -2520,7 +2517,6 @@ async fn test_flow_schedule_handlers(db: Pool) -> anyhow::Result<()> { no_flow_overlap: None, summary: None, tag: None, - paused_until: None, cron_version: None, description: None, }; @@ -2592,7 +2588,6 @@ async fn test_flow_schedule_handlers(db: Pool) -> anyhow::Result<()> { summary: None, no_flow_overlap: None, tag: None, - paused_until: None, cron_version: None, description: None, }, diff --git a/backend/windmill-api-client/Cargo.toml b/backend/windmill-api-client/Cargo.toml index a2d9a64baf..5d7ea274d9 100644 --- a/backend/windmill-api-client/Cargo.toml +++ b/backend/windmill-api-client/Cargo.toml @@ -10,13 +10,7 @@ path = "./src/lib.rs" [dependencies] -progenitor-client = { git = "https://github.com/oxidecomputer/progenitor", rev = "3d96016ae8d422e90513b2d34fb5b63eeab30b01" } -reqwest = { version = "0.11", features = ["json", "stream"] } +reqwest = { version = "0.12", features = ["json"] } serde = { version = "1.0", features = ["derive"] } -chrono.workspace = true -uuid.workspace = true serde_json.workspace = true -rand.workspace = true -base64.workspace = true -openapiv3 = "=1.0.2" - +urlencoding = "2" diff --git a/backend/windmill-api-client/build_cargo/Cargo.lock b/backend/windmill-api-client/build_cargo/Cargo.lock deleted file mode 100644 index ddf1947942..0000000000 --- a/backend/windmill-api-client/build_cargo/Cargo.lock +++ /dev/null @@ -1,2059 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "anstream" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" - -[[package]] -name = "anstyle-parse" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" -dependencies = [ - "anstyle", - "once_cell", - "windows-sys 0.59.0", -] - -[[package]] -name = "anyhow" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" - -[[package]] -name = "built" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b99c4cdc7b2c2364182331055623bdf45254fcb679fea565c40c3c11c101889a" -dependencies = [ - "cargo-lock", - "git2", -] - -[[package]] -name = "bumpalo" -version = "3.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - -[[package]] -name = "cargo-lock" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72" -dependencies = [ - "semver", - "serde", - "toml 0.7.8", - "url", -] - -[[package]] -name = "cc" -version = "1.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" -dependencies = [ - "num-traits", -] - -[[package]] -name = "clap" -version = "4.5.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "clap_lex" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" - -[[package]] -name = "colorchoice" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "dyn-clone" -version = "1.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getopts" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "getrandom" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "git2" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" -dependencies = [ - "bitflags 1.3.2", - "libc", - "libgit2-sys", - "log", - "url", -] - -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 2.8.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" -dependencies = [ - "equivalent", - "hashbrown 0.15.2", -] - -[[package]] -name = "ipnet" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" - -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.171" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" - -[[package]] -name = "libgit2-sys" -version = "0.15.2+1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - -[[package]] -name = "libz-sys" -version = "1.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linux-raw-sys" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" - -[[package]] -name = "litemap" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" - -[[package]] -name = "log" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" - -[[package]] -name = "openapiv3" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1a9f106eb0a780abd17ba9fca8e0843e3461630bcbe2af0ad4d5d3ba4e9aa4" -dependencies = [ - "indexmap 1.9.3", - "serde", - "serde_json", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "proc-macro2" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "progenitor" -version = "0.3.0" -source = "git+https://github.com/oxidecomputer/progenitor?rev=3d96016ae8d422e90513b2d34fb5b63eeab30b01#3d96016ae8d422e90513b2d34fb5b63eeab30b01" -dependencies = [ - "anyhow", - "built", - "clap", - "openapiv3", - "progenitor-client", - "progenitor-impl", - "progenitor-macro", - "project-root", - "rustfmt-wrapper", - "serde", - "serde_json", - "serde_yaml", -] - -[[package]] -name = "progenitor-client" -version = "0.3.0" -source = "git+https://github.com/oxidecomputer/progenitor?rev=3d96016ae8d422e90513b2d34fb5b63eeab30b01#3d96016ae8d422e90513b2d34fb5b63eeab30b01" -dependencies = [ - "bytes", - "futures-core", - "percent-encoding", - "reqwest", - "serde", - "serde_json", - "serde_urlencoded", -] - -[[package]] -name = "progenitor-impl" -version = "0.3.0" -source = "git+https://github.com/oxidecomputer/progenitor?rev=3d96016ae8d422e90513b2d34fb5b63eeab30b01#3d96016ae8d422e90513b2d34fb5b63eeab30b01" -dependencies = [ - "getopts", - "heck 0.4.1", - "http", - "indexmap 1.9.3", - "openapiv3", - "proc-macro2", - "quote", - "regex", - "schemars", - "serde", - "serde_json", - "syn 2.0.100", - "thiserror", - "typify", - "unicode-ident", -] - -[[package]] -name = "progenitor-macro" -version = "0.3.0" -source = "git+https://github.com/oxidecomputer/progenitor?rev=3d96016ae8d422e90513b2d34fb5b63eeab30b01#3d96016ae8d422e90513b2d34fb5b63eeab30b01" -dependencies = [ - "openapiv3", - "proc-macro2", - "progenitor-impl", - "quote", - "schemars", - "serde", - "serde_json", - "serde_tokenstream", - "serde_yaml", - "syn 2.0.100", -] - -[[package]] -name = "project-root" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bccbff07d5ed689c4087d20d7307a52ab6141edeedf487c3876a55b86cf63df" - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "regress" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a9ecfa0cb04d0b04dddb99b8ccf4f66bc8dfd23df694b398570bd8ae3a50fb" -dependencies = [ - "hashbrown 0.13.2", - "memchr", -] - -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "winreg", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustfmt-wrapper" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1adc9dfed5cc999077978cc7163b9282c5751c8d39827c4ea8c8c220ca5a440" -dependencies = [ - "serde", - "tempfile", - "thiserror", - "toml 0.8.20", - "toolchain_find", -] - -[[package]] -name = "rustix" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" -dependencies = [ - "bitflags 2.9.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustversion" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schemars" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" -dependencies = [ - "chrono", - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", - "uuid", -] - -[[package]] -name = "schemars_derive" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.100", -] - -[[package]] -name = "semver" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "serde_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "serde_json" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_tokenstream" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64060d864397305347a78851c51588fd283767e7e7589829e8121d65512340f1" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 2.0.100", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap 2.8.0", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" - -[[package]] -name = "socket2" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" -dependencies = [ - "fastrand", - "getrandom", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "tinystr" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tokio" -version = "1.44.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-util" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - -[[package]] -name = "toml" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.24", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.8.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" -dependencies = [ - "indexmap 2.8.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.7.4", -] - -[[package]] -name = "toolchain_find" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc8c9a7f0a2966e1acdaf0461023d0b01471eeead645370cf4c3f5cff153f2a" -dependencies = [ - "home", - "once_cell", - "regex", - "semver", - "walkdir", -] - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "typify" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6658d09e71bfe59e7987dc95ee7f71809fdb5793ab0cdc1503cc0073990484d" -dependencies = [ - "typify-impl", - "typify-macro", -] - -[[package]] -name = "typify-impl" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d3bb47587b13edf526d6ed02bf360ecefe083ab47a4ef29fc43112828b2bef" -dependencies = [ - "heck 0.4.1", - "log", - "proc-macro2", - "quote", - "regress", - "schemars", - "serde_json", - "syn 2.0.100", - "thiserror", - "unicode-ident", -] - -[[package]] -name = "typify-macro" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f7e627c18be12d53bc1f261830b9c2763437b6a86ac57293b9085af2d32ffe" -dependencies = [ - "proc-macro2", - "quote", - "schemars", - "serde", - "serde_json", - "serde_tokenstream", - "syn 2.0.100", - "typify-impl", -] - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "uuid" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.100", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" -dependencies = [ - "cfg-if", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "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.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "windmill-api-client-build" -version = "0.1.0" -dependencies = [ - "openapiv3", - "prettyplease", - "progenitor", - "serde_json", - "syn 1.0.109", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.0", -] - -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", - "synstructure", -] - -[[package]] -name = "zerovec" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] diff --git a/backend/windmill-api-client/build_cargo/Cargo.toml b/backend/windmill-api-client/build_cargo/Cargo.toml deleted file mode 100644 index 1e6a9ce192..0000000000 --- a/backend/windmill-api-client/build_cargo/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "windmill-api-client-build" -version = "0.1.0" -edition = "2021" - -[[bin]] -name = "windmill_api_client_build" -path = "./main.rs" - - -[dependencies] -prettyplease = "0.1.25" -progenitor = { git = "https://github.com/oxidecomputer/progenitor", rev = "3d96016ae8d422e90513b2d34fb5b63eeab30b01" } -serde_json = "1.0" -syn = "1.0" -openapiv3 = "=1.0.2" - -[workspace] diff --git a/backend/windmill-api-client/build_cargo/bundle.sh b/backend/windmill-api-client/build_cargo/bundle.sh deleted file mode 100755 index 665fae59fb..0000000000 --- a/backend/windmill-api-client/build_cargo/bundle.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -npx swagger-cli bundle ../../windmill-api/openapi.yaml > bundled.json \ No newline at end of file diff --git a/backend/windmill-api-client/build_cargo/main.rs b/backend/windmill-api-client/build_cargo/main.rs deleted file mode 100644 index 0a6f1b447e..0000000000 --- a/backend/windmill-api-client/build_cargo/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -use std::{ - fs::{self, File}, - path::Path, - process::Command, -}; - -fn main() { - Command::new("sh").args(&["./bundle.sh"]).status().unwrap(); - let file = File::open("./bundled.json").unwrap(); - let mut spec: openapiv3::OpenAPI = serde_json::from_reader(file).unwrap(); - spec.paths.paths.retain(|key, _| { - [ - "/w/{workspace}/flows/create", - "/w/{workspace}/flows/get/{path}", - "/w/{workspace}/scripts/create", - "/workspaces/list", - "/w/{workspace}/schedules/create", - "/w/{workspace}/schedules/update/{path}", - ] - .contains(&key.as_str()) - }); - - let mut generator = progenitor::Generator::default(); - let tokens = generator.generate_tokens(&spec).unwrap(); - let ast = syn::parse2(tokens).unwrap(); - let content = prettyplease::unparse(&ast); - - let mut out_file = Path::new("../src").to_path_buf(); - out_file.push("codegen.rs"); - - fs::write(out_file, content).unwrap(); -} diff --git a/backend/windmill-api-client/codegen.rs b/backend/windmill-api-client/codegen.rs deleted file mode 100644 index 4de622c668..0000000000 --- a/backend/windmill-api-client/codegen.rs +++ /dev/null @@ -1,24398 +0,0 @@ -pub use progenitor_client::{ByteStream, Error, ResponseValue}; -#[allow(unused_imports)] -use progenitor_client::{encode_path, RequestBuilderExt}; -#[allow(unused_imports)] -use reqwest::header::{HeaderMap, HeaderValue}; -pub mod types { - use serde::{Deserialize, Serialize}; - #[allow(unused_imports)] - use std::convert::TryFrom; - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AcceptInviteBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - pub workspace_id: String, - } - impl From<&AcceptInviteBody> for AcceptInviteBody { - fn from(value: &AcceptInviteBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AddGranularAclsBody { - pub owner: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub write: Option, - } - impl From<&AddGranularAclsBody> for AddGranularAclsBody { - fn from(value: &AddGranularAclsBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AddGranularAclsKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "group_")] - Group, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "schedule")] - Schedule, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "folder")] - Folder, - #[serde(rename = "app")] - App, - #[serde(rename = "raw_app")] - RawApp, - #[serde(rename = "http_trigger")] - HttpTrigger, - #[serde(rename = "websocket_trigger")] - WebsocketTrigger, - #[serde(rename = "kafka_trigger")] - KafkaTrigger, - #[serde(rename = "nats_trigger")] - NatsTrigger, - #[serde(rename = "postgres_trigger")] - PostgresTrigger, - #[serde(rename = "mqtt_trigger")] - MqttTrigger, - #[serde(rename = "sqs_trigger")] - SqsTrigger, - } - impl From<&AddGranularAclsKind> for AddGranularAclsKind { - fn from(value: &AddGranularAclsKind) -> Self { - value.clone() - } - } - impl ToString for AddGranularAclsKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Group => "group_".to_string(), - Self::Resource => "resource".to_string(), - Self::Schedule => "schedule".to_string(), - Self::Variable => "variable".to_string(), - Self::Flow => "flow".to_string(), - Self::Folder => "folder".to_string(), - Self::App => "app".to_string(), - Self::RawApp => "raw_app".to_string(), - Self::HttpTrigger => "http_trigger".to_string(), - Self::WebsocketTrigger => "websocket_trigger".to_string(), - Self::KafkaTrigger => "kafka_trigger".to_string(), - Self::NatsTrigger => "nats_trigger".to_string(), - Self::PostgresTrigger => "postgres_trigger".to_string(), - Self::MqttTrigger => "mqtt_trigger".to_string(), - Self::SqsTrigger => "sqs_trigger".to_string(), - } - } - } - impl std::str::FromStr for AddGranularAclsKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "group_" => Ok(Self::Group), - "resource" => Ok(Self::Resource), - "schedule" => Ok(Self::Schedule), - "variable" => Ok(Self::Variable), - "flow" => Ok(Self::Flow), - "folder" => Ok(Self::Folder), - "app" => Ok(Self::App), - "raw_app" => Ok(Self::RawApp), - "http_trigger" => Ok(Self::HttpTrigger), - "websocket_trigger" => Ok(Self::WebsocketTrigger), - "kafka_trigger" => Ok(Self::KafkaTrigger), - "nats_trigger" => Ok(Self::NatsTrigger), - "postgres_trigger" => Ok(Self::PostgresTrigger), - "mqtt_trigger" => Ok(Self::MqttTrigger), - "sqs_trigger" => Ok(Self::SqsTrigger), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AddGranularAclsKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AddGranularAclsKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AddGranularAclsKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AddOwnerToFolderBody { - pub owner: String, - } - impl From<&AddOwnerToFolderBody> for AddOwnerToFolderBody { - fn from(value: &AddOwnerToFolderBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AddUserBody { - pub email: String, - pub is_admin: bool, - pub operator: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - } - impl From<&AddUserBody> for AddUserBody { - fn from(value: &AddUserBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AddUserToGroupBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - } - impl From<&AddUserToGroupBody> for AddUserToGroupBody { - fn from(value: &AddUserToGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AddUserToInstanceGroupBody { - pub email: String, - } - impl From<&AddUserToInstanceGroupBody> for AddUserToInstanceGroupBody { - fn from(value: &AddUserToInstanceGroupBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AiProvider { - #[serde(rename = "openai")] - Openai, - #[serde(rename = "anthropic")] - Anthropic, - #[serde(rename = "mistral")] - Mistral, - #[serde(rename = "deepseek")] - Deepseek, - #[serde(rename = "googleai")] - Googleai, - #[serde(rename = "groq")] - Groq, - #[serde(rename = "openrouter")] - Openrouter, - #[serde(rename = "customai")] - Customai, - } - impl From<&AiProvider> for AiProvider { - fn from(value: &AiProvider) -> Self { - value.clone() - } - } - impl ToString for AiProvider { - fn to_string(&self) -> String { - match *self { - Self::Openai => "openai".to_string(), - Self::Anthropic => "anthropic".to_string(), - Self::Mistral => "mistral".to_string(), - Self::Deepseek => "deepseek".to_string(), - Self::Googleai => "googleai".to_string(), - Self::Groq => "groq".to_string(), - Self::Openrouter => "openrouter".to_string(), - Self::Customai => "customai".to_string(), - } - } - } - impl std::str::FromStr for AiProvider { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "openai" => Ok(Self::Openai), - "anthropic" => Ok(Self::Anthropic), - "mistral" => Ok(Self::Mistral), - "deepseek" => Ok(Self::Deepseek), - "googleai" => Ok(Self::Googleai), - "groq" => Ok(Self::Groq), - "openrouter" => Ok(Self::Openrouter), - "customai" => Ok(Self::Customai), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AiProvider { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AiProvider { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AiProvider { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AiResource { - pub path: String, - pub provider: AiProvider, - } - impl From<&AiResource> for AiResource { - fn from(value: &AiResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AppHistory { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - pub version: i64, - } - impl From<&AppHistory> for AppHistory { - fn from(value: &AppHistory) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AppWithLastVersion { - pub created_at: chrono::DateTime, - pub created_by: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub custom_path: Option, - pub execution_mode: AppWithLastVersionExecutionMode, - pub extra_perms: std::collections::HashMap, - pub id: i64, - pub path: String, - pub policy: Policy, - pub summary: String, - pub value: std::collections::HashMap, - pub versions: Vec, - pub workspace_id: String, - } - impl From<&AppWithLastVersion> for AppWithLastVersion { - fn from(value: &AppWithLastVersion) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AppWithLastVersionExecutionMode { - #[serde(rename = "viewer")] - Viewer, - #[serde(rename = "publisher")] - Publisher, - #[serde(rename = "anonymous")] - Anonymous, - } - impl From<&AppWithLastVersionExecutionMode> for AppWithLastVersionExecutionMode { - fn from(value: &AppWithLastVersionExecutionMode) -> Self { - value.clone() - } - } - impl ToString for AppWithLastVersionExecutionMode { - fn to_string(&self) -> String { - match *self { - Self::Viewer => "viewer".to_string(), - Self::Publisher => "publisher".to_string(), - Self::Anonymous => "anonymous".to_string(), - } - } - } - impl std::str::FromStr for AppWithLastVersionExecutionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "viewer" => Ok(Self::Viewer), - "publisher" => Ok(Self::Publisher), - "anonymous" => Ok(Self::Anonymous), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AppWithLastVersionExecutionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AppWithLastVersionExecutionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AppWithLastVersionExecutionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AppWithLastVersionWDraft { - #[serde(flatten)] - pub app_with_last_version: AppWithLastVersion, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - } - impl From<&AppWithLastVersionWDraft> for AppWithLastVersionWDraft { - fn from(value: &AppWithLastVersionWDraft) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ArchiveFlowByPathBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub archived: Option, - } - impl From<&ArchiveFlowByPathBody> for ArchiveFlowByPathBody { - fn from(value: &ArchiveFlowByPathBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AuditLog { - pub action_kind: AuditLogActionKind, - pub id: i64, - pub operation: AuditLogOperation, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub parameters: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - pub timestamp: chrono::DateTime, - pub username: String, - } - impl From<&AuditLog> for AuditLog { - fn from(value: &AuditLog) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AuditLogActionKind { - Created, - Updated, - Delete, - Execute, - } - impl From<&AuditLogActionKind> for AuditLogActionKind { - fn from(value: &AuditLogActionKind) -> Self { - value.clone() - } - } - impl ToString for AuditLogActionKind { - fn to_string(&self) -> String { - match *self { - Self::Created => "Created".to_string(), - Self::Updated => "Updated".to_string(), - Self::Delete => "Delete".to_string(), - Self::Execute => "Execute".to_string(), - } - } - } - impl std::str::FromStr for AuditLogActionKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Created" => Ok(Self::Created), - "Updated" => Ok(Self::Updated), - "Delete" => Ok(Self::Delete), - "Execute" => Ok(Self::Execute), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AuditLogActionKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AuditLogActionKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AuditLogActionKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AuditLogOperation { - #[serde(rename = "jobs.run")] - JobsRun, - #[serde(rename = "jobs.run.script")] - JobsRunScript, - #[serde(rename = "jobs.run.preview")] - JobsRunPreview, - #[serde(rename = "jobs.run.flow")] - JobsRunFlow, - #[serde(rename = "jobs.run.flow_preview")] - JobsRunFlowPreview, - #[serde(rename = "jobs.run.script_hub")] - JobsRunScriptHub, - #[serde(rename = "jobs.run.dependencies")] - JobsRunDependencies, - #[serde(rename = "jobs.run.identity")] - JobsRunIdentity, - #[serde(rename = "jobs.run.noop")] - JobsRunNoop, - #[serde(rename = "jobs.flow_dependencies")] - JobsFlowDependencies, - #[serde(rename = "jobs")] - Jobs, - #[serde(rename = "jobs.cancel")] - JobsCancel, - #[serde(rename = "jobs.force_cancel")] - JobsForceCancel, - #[serde(rename = "jobs.disapproval")] - JobsDisapproval, - #[serde(rename = "jobs.delete")] - JobsDelete, - #[serde(rename = "account.delete")] - AccountDelete, - #[serde(rename = "ai.request")] - AiRequest, - #[serde(rename = "resources.create")] - ResourcesCreate, - #[serde(rename = "resources.update")] - ResourcesUpdate, - #[serde(rename = "resources.delete")] - ResourcesDelete, - #[serde(rename = "resource_types.create")] - ResourceTypesCreate, - #[serde(rename = "resource_types.update")] - ResourceTypesUpdate, - #[serde(rename = "resource_types.delete")] - ResourceTypesDelete, - #[serde(rename = "schedule.create")] - ScheduleCreate, - #[serde(rename = "schedule.setenabled")] - ScheduleSetenabled, - #[serde(rename = "schedule.edit")] - ScheduleEdit, - #[serde(rename = "schedule.delete")] - ScheduleDelete, - #[serde(rename = "scripts.create")] - ScriptsCreate, - #[serde(rename = "scripts.update")] - ScriptsUpdate, - #[serde(rename = "scripts.archive")] - ScriptsArchive, - #[serde(rename = "scripts.delete")] - ScriptsDelete, - #[serde(rename = "users.create")] - UsersCreate, - #[serde(rename = "users.delete")] - UsersDelete, - #[serde(rename = "users.update")] - UsersUpdate, - #[serde(rename = "users.login")] - UsersLogin, - #[serde(rename = "users.login_failure")] - UsersLoginFailure, - #[serde(rename = "users.logout")] - UsersLogout, - #[serde(rename = "users.accept_invite")] - UsersAcceptInvite, - #[serde(rename = "users.decline_invite")] - UsersDeclineInvite, - #[serde(rename = "users.token.create")] - UsersTokenCreate, - #[serde(rename = "users.token.delete")] - UsersTokenDelete, - #[serde(rename = "users.add_to_workspace")] - UsersAddToWorkspace, - #[serde(rename = "users.add_global")] - UsersAddGlobal, - #[serde(rename = "users.setpassword")] - UsersSetpassword, - #[serde(rename = "users.impersonate")] - UsersImpersonate, - #[serde(rename = "users.leave_workspace")] - UsersLeaveWorkspace, - #[serde(rename = "oauth.login")] - OauthLogin, - #[serde(rename = "oauth.login_failure")] - OauthLoginFailure, - #[serde(rename = "oauth.signup")] - OauthSignup, - #[serde(rename = "variables.create")] - VariablesCreate, - #[serde(rename = "variables.delete")] - VariablesDelete, - #[serde(rename = "variables.update")] - VariablesUpdate, - #[serde(rename = "flows.create")] - FlowsCreate, - #[serde(rename = "flows.update")] - FlowsUpdate, - #[serde(rename = "flows.delete")] - FlowsDelete, - #[serde(rename = "flows.archive")] - FlowsArchive, - #[serde(rename = "apps.create")] - AppsCreate, - #[serde(rename = "apps.update")] - AppsUpdate, - #[serde(rename = "apps.delete")] - AppsDelete, - #[serde(rename = "folder.create")] - FolderCreate, - #[serde(rename = "folder.update")] - FolderUpdate, - #[serde(rename = "folder.delete")] - FolderDelete, - #[serde(rename = "folder.add_owner")] - FolderAddOwner, - #[serde(rename = "folder.remove_owner")] - FolderRemoveOwner, - #[serde(rename = "group.create")] - GroupCreate, - #[serde(rename = "group.delete")] - GroupDelete, - #[serde(rename = "group.edit")] - GroupEdit, - #[serde(rename = "group.adduser")] - GroupAdduser, - #[serde(rename = "group.removeuser")] - GroupRemoveuser, - #[serde(rename = "igroup.create")] - IgroupCreate, - #[serde(rename = "igroup.delete")] - IgroupDelete, - #[serde(rename = "igroup.adduser")] - IgroupAdduser, - #[serde(rename = "igroup.removeuser")] - IgroupRemoveuser, - #[serde(rename = "variables.decrypt_secret")] - VariablesDecryptSecret, - #[serde(rename = "workspaces.edit_command_script")] - WorkspacesEditCommandScript, - #[serde(rename = "workspaces.edit_deploy_to")] - WorkspacesEditDeployTo, - #[serde(rename = "workspaces.edit_auto_invite_domain")] - WorkspacesEditAutoInviteDomain, - #[serde(rename = "workspaces.edit_webhook")] - WorkspacesEditWebhook, - #[serde(rename = "workspaces.edit_copilot_config")] - WorkspacesEditCopilotConfig, - #[serde(rename = "workspaces.edit_error_handler")] - WorkspacesEditErrorHandler, - #[serde(rename = "workspaces.create")] - WorkspacesCreate, - #[serde(rename = "workspaces.update")] - WorkspacesUpdate, - #[serde(rename = "workspaces.archive")] - WorkspacesArchive, - #[serde(rename = "workspaces.unarchive")] - WorkspacesUnarchive, - #[serde(rename = "workspaces.delete")] - WorkspacesDelete, - } - impl From<&AuditLogOperation> for AuditLogOperation { - fn from(value: &AuditLogOperation) -> Self { - value.clone() - } - } - impl ToString for AuditLogOperation { - fn to_string(&self) -> String { - match *self { - Self::JobsRun => "jobs.run".to_string(), - Self::JobsRunScript => "jobs.run.script".to_string(), - Self::JobsRunPreview => "jobs.run.preview".to_string(), - Self::JobsRunFlow => "jobs.run.flow".to_string(), - Self::JobsRunFlowPreview => "jobs.run.flow_preview".to_string(), - Self::JobsRunScriptHub => "jobs.run.script_hub".to_string(), - Self::JobsRunDependencies => "jobs.run.dependencies".to_string(), - Self::JobsRunIdentity => "jobs.run.identity".to_string(), - Self::JobsRunNoop => "jobs.run.noop".to_string(), - Self::JobsFlowDependencies => "jobs.flow_dependencies".to_string(), - Self::Jobs => "jobs".to_string(), - Self::JobsCancel => "jobs.cancel".to_string(), - Self::JobsForceCancel => "jobs.force_cancel".to_string(), - Self::JobsDisapproval => "jobs.disapproval".to_string(), - Self::JobsDelete => "jobs.delete".to_string(), - Self::AccountDelete => "account.delete".to_string(), - Self::AiRequest => "ai.request".to_string(), - Self::ResourcesCreate => "resources.create".to_string(), - Self::ResourcesUpdate => "resources.update".to_string(), - Self::ResourcesDelete => "resources.delete".to_string(), - Self::ResourceTypesCreate => "resource_types.create".to_string(), - Self::ResourceTypesUpdate => "resource_types.update".to_string(), - Self::ResourceTypesDelete => "resource_types.delete".to_string(), - Self::ScheduleCreate => "schedule.create".to_string(), - Self::ScheduleSetenabled => "schedule.setenabled".to_string(), - Self::ScheduleEdit => "schedule.edit".to_string(), - Self::ScheduleDelete => "schedule.delete".to_string(), - Self::ScriptsCreate => "scripts.create".to_string(), - Self::ScriptsUpdate => "scripts.update".to_string(), - Self::ScriptsArchive => "scripts.archive".to_string(), - Self::ScriptsDelete => "scripts.delete".to_string(), - Self::UsersCreate => "users.create".to_string(), - Self::UsersDelete => "users.delete".to_string(), - Self::UsersUpdate => "users.update".to_string(), - Self::UsersLogin => "users.login".to_string(), - Self::UsersLoginFailure => "users.login_failure".to_string(), - Self::UsersLogout => "users.logout".to_string(), - Self::UsersAcceptInvite => "users.accept_invite".to_string(), - Self::UsersDeclineInvite => "users.decline_invite".to_string(), - Self::UsersTokenCreate => "users.token.create".to_string(), - Self::UsersTokenDelete => "users.token.delete".to_string(), - Self::UsersAddToWorkspace => "users.add_to_workspace".to_string(), - Self::UsersAddGlobal => "users.add_global".to_string(), - Self::UsersSetpassword => "users.setpassword".to_string(), - Self::UsersImpersonate => "users.impersonate".to_string(), - Self::UsersLeaveWorkspace => "users.leave_workspace".to_string(), - Self::OauthLogin => "oauth.login".to_string(), - Self::OauthLoginFailure => "oauth.login_failure".to_string(), - Self::OauthSignup => "oauth.signup".to_string(), - Self::VariablesCreate => "variables.create".to_string(), - Self::VariablesDelete => "variables.delete".to_string(), - Self::VariablesUpdate => "variables.update".to_string(), - Self::FlowsCreate => "flows.create".to_string(), - Self::FlowsUpdate => "flows.update".to_string(), - Self::FlowsDelete => "flows.delete".to_string(), - Self::FlowsArchive => "flows.archive".to_string(), - Self::AppsCreate => "apps.create".to_string(), - Self::AppsUpdate => "apps.update".to_string(), - Self::AppsDelete => "apps.delete".to_string(), - Self::FolderCreate => "folder.create".to_string(), - Self::FolderUpdate => "folder.update".to_string(), - Self::FolderDelete => "folder.delete".to_string(), - Self::FolderAddOwner => "folder.add_owner".to_string(), - Self::FolderRemoveOwner => "folder.remove_owner".to_string(), - Self::GroupCreate => "group.create".to_string(), - Self::GroupDelete => "group.delete".to_string(), - Self::GroupEdit => "group.edit".to_string(), - Self::GroupAdduser => "group.adduser".to_string(), - Self::GroupRemoveuser => "group.removeuser".to_string(), - Self::IgroupCreate => "igroup.create".to_string(), - Self::IgroupDelete => "igroup.delete".to_string(), - Self::IgroupAdduser => "igroup.adduser".to_string(), - Self::IgroupRemoveuser => "igroup.removeuser".to_string(), - Self::VariablesDecryptSecret => "variables.decrypt_secret".to_string(), - Self::WorkspacesEditCommandScript => { - "workspaces.edit_command_script".to_string() - } - Self::WorkspacesEditDeployTo => "workspaces.edit_deploy_to".to_string(), - Self::WorkspacesEditAutoInviteDomain => { - "workspaces.edit_auto_invite_domain".to_string() - } - Self::WorkspacesEditWebhook => "workspaces.edit_webhook".to_string(), - Self::WorkspacesEditCopilotConfig => { - "workspaces.edit_copilot_config".to_string() - } - Self::WorkspacesEditErrorHandler => { - "workspaces.edit_error_handler".to_string() - } - Self::WorkspacesCreate => "workspaces.create".to_string(), - Self::WorkspacesUpdate => "workspaces.update".to_string(), - Self::WorkspacesArchive => "workspaces.archive".to_string(), - Self::WorkspacesUnarchive => "workspaces.unarchive".to_string(), - Self::WorkspacesDelete => "workspaces.delete".to_string(), - } - } - } - impl std::str::FromStr for AuditLogOperation { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "jobs.run" => Ok(Self::JobsRun), - "jobs.run.script" => Ok(Self::JobsRunScript), - "jobs.run.preview" => Ok(Self::JobsRunPreview), - "jobs.run.flow" => Ok(Self::JobsRunFlow), - "jobs.run.flow_preview" => Ok(Self::JobsRunFlowPreview), - "jobs.run.script_hub" => Ok(Self::JobsRunScriptHub), - "jobs.run.dependencies" => Ok(Self::JobsRunDependencies), - "jobs.run.identity" => Ok(Self::JobsRunIdentity), - "jobs.run.noop" => Ok(Self::JobsRunNoop), - "jobs.flow_dependencies" => Ok(Self::JobsFlowDependencies), - "jobs" => Ok(Self::Jobs), - "jobs.cancel" => Ok(Self::JobsCancel), - "jobs.force_cancel" => Ok(Self::JobsForceCancel), - "jobs.disapproval" => Ok(Self::JobsDisapproval), - "jobs.delete" => Ok(Self::JobsDelete), - "account.delete" => Ok(Self::AccountDelete), - "ai.request" => Ok(Self::AiRequest), - "resources.create" => Ok(Self::ResourcesCreate), - "resources.update" => Ok(Self::ResourcesUpdate), - "resources.delete" => Ok(Self::ResourcesDelete), - "resource_types.create" => Ok(Self::ResourceTypesCreate), - "resource_types.update" => Ok(Self::ResourceTypesUpdate), - "resource_types.delete" => Ok(Self::ResourceTypesDelete), - "schedule.create" => Ok(Self::ScheduleCreate), - "schedule.setenabled" => Ok(Self::ScheduleSetenabled), - "schedule.edit" => Ok(Self::ScheduleEdit), - "schedule.delete" => Ok(Self::ScheduleDelete), - "scripts.create" => Ok(Self::ScriptsCreate), - "scripts.update" => Ok(Self::ScriptsUpdate), - "scripts.archive" => Ok(Self::ScriptsArchive), - "scripts.delete" => Ok(Self::ScriptsDelete), - "users.create" => Ok(Self::UsersCreate), - "users.delete" => Ok(Self::UsersDelete), - "users.update" => Ok(Self::UsersUpdate), - "users.login" => Ok(Self::UsersLogin), - "users.login_failure" => Ok(Self::UsersLoginFailure), - "users.logout" => Ok(Self::UsersLogout), - "users.accept_invite" => Ok(Self::UsersAcceptInvite), - "users.decline_invite" => Ok(Self::UsersDeclineInvite), - "users.token.create" => Ok(Self::UsersTokenCreate), - "users.token.delete" => Ok(Self::UsersTokenDelete), - "users.add_to_workspace" => Ok(Self::UsersAddToWorkspace), - "users.add_global" => Ok(Self::UsersAddGlobal), - "users.setpassword" => Ok(Self::UsersSetpassword), - "users.impersonate" => Ok(Self::UsersImpersonate), - "users.leave_workspace" => Ok(Self::UsersLeaveWorkspace), - "oauth.login" => Ok(Self::OauthLogin), - "oauth.login_failure" => Ok(Self::OauthLoginFailure), - "oauth.signup" => Ok(Self::OauthSignup), - "variables.create" => Ok(Self::VariablesCreate), - "variables.delete" => Ok(Self::VariablesDelete), - "variables.update" => Ok(Self::VariablesUpdate), - "flows.create" => Ok(Self::FlowsCreate), - "flows.update" => Ok(Self::FlowsUpdate), - "flows.delete" => Ok(Self::FlowsDelete), - "flows.archive" => Ok(Self::FlowsArchive), - "apps.create" => Ok(Self::AppsCreate), - "apps.update" => Ok(Self::AppsUpdate), - "apps.delete" => Ok(Self::AppsDelete), - "folder.create" => Ok(Self::FolderCreate), - "folder.update" => Ok(Self::FolderUpdate), - "folder.delete" => Ok(Self::FolderDelete), - "folder.add_owner" => Ok(Self::FolderAddOwner), - "folder.remove_owner" => Ok(Self::FolderRemoveOwner), - "group.create" => Ok(Self::GroupCreate), - "group.delete" => Ok(Self::GroupDelete), - "group.edit" => Ok(Self::GroupEdit), - "group.adduser" => Ok(Self::GroupAdduser), - "group.removeuser" => Ok(Self::GroupRemoveuser), - "igroup.create" => Ok(Self::IgroupCreate), - "igroup.delete" => Ok(Self::IgroupDelete), - "igroup.adduser" => Ok(Self::IgroupAdduser), - "igroup.removeuser" => Ok(Self::IgroupRemoveuser), - "variables.decrypt_secret" => Ok(Self::VariablesDecryptSecret), - "workspaces.edit_command_script" => Ok(Self::WorkspacesEditCommandScript), - "workspaces.edit_deploy_to" => Ok(Self::WorkspacesEditDeployTo), - "workspaces.edit_auto_invite_domain" => { - Ok(Self::WorkspacesEditAutoInviteDomain) - } - "workspaces.edit_webhook" => Ok(Self::WorkspacesEditWebhook), - "workspaces.edit_copilot_config" => Ok(Self::WorkspacesEditCopilotConfig), - "workspaces.edit_error_handler" => Ok(Self::WorkspacesEditErrorHandler), - "workspaces.create" => Ok(Self::WorkspacesCreate), - "workspaces.update" => Ok(Self::WorkspacesUpdate), - "workspaces.archive" => Ok(Self::WorkspacesArchive), - "workspaces.unarchive" => Ok(Self::WorkspacesUnarchive), - "workspaces.delete" => Ok(Self::WorkspacesDelete), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AuditLogOperation { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AuditLogOperation { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AuditLogOperation { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AutoscalingEvent { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub applied_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub desired_workers: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub event_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub reason: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker_group: Option, - } - impl From<&AutoscalingEvent> for AutoscalingEvent { - fn from(value: &AutoscalingEvent) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchAll { - pub branches: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - #[serde(rename = "type")] - pub type_: BranchAllType, - } - impl From<&BranchAll> for BranchAll { - fn from(value: &BranchAll) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchAllBranchesItem { - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_failure: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&BranchAllBranchesItem> for BranchAllBranchesItem { - fn from(value: &BranchAllBranchesItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum BranchAllType { - #[serde(rename = "branchall")] - Branchall, - } - impl From<&BranchAllType> for BranchAllType { - fn from(value: &BranchAllType) -> Self { - value.clone() - } - } - impl ToString for BranchAllType { - fn to_string(&self) -> String { - match *self { - Self::Branchall => "branchall".to_string(), - } - } - } - impl std::str::FromStr for BranchAllType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "branchall" => Ok(Self::Branchall), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for BranchAllType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for BranchAllType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for BranchAllType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchOne { - pub branches: Vec, - pub default: Vec, - #[serde(rename = "type")] - pub type_: BranchOneType, - } - impl From<&BranchOne> for BranchOne { - fn from(value: &BranchOne) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchOneBranchesItem { - pub expr: String, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&BranchOneBranchesItem> for BranchOneBranchesItem { - fn from(value: &BranchOneBranchesItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum BranchOneType { - #[serde(rename = "branchone")] - Branchone, - } - impl From<&BranchOneType> for BranchOneType { - fn from(value: &BranchOneType) -> Self { - value.clone() - } - } - impl ToString for BranchOneType { - fn to_string(&self) -> String { - match *self { - Self::Branchone => "branchone".to_string(), - } - } - } - impl std::str::FromStr for BranchOneType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "branchone" => Ok(Self::Branchone), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for BranchOneType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for BranchOneType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for BranchOneType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CancelPersistentQueuedJobsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub reason: Option, - } - impl From<&CancelPersistentQueuedJobsBody> for CancelPersistentQueuedJobsBody { - fn from(value: &CancelPersistentQueuedJobsBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CancelQueuedJobBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub reason: Option, - } - impl From<&CancelQueuedJobBody> for CancelQueuedJobBody { - fn from(value: &CancelQueuedJobBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Capture { - pub created_at: chrono::DateTime, - pub id: i64, - pub payload: serde_json::Value, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub trigger_extra: Option, - pub trigger_kind: CaptureTriggerKind, - } - impl From<&Capture> for Capture { - fn from(value: &Capture) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CaptureConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub trigger_config: Option, - pub trigger_kind: CaptureTriggerKind, - } - impl From<&CaptureConfig> for CaptureConfig { - fn from(value: &CaptureConfig) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum CaptureTriggerKind { - #[serde(rename = "webhook")] - Webhook, - #[serde(rename = "http")] - Http, - #[serde(rename = "websocket")] - Websocket, - #[serde(rename = "kafka")] - Kafka, - #[serde(rename = "email")] - Email, - #[serde(rename = "nats")] - Nats, - #[serde(rename = "postgres")] - Postgres, - #[serde(rename = "sqs")] - Sqs, - #[serde(rename = "mqtt")] - Mqtt, - } - impl From<&CaptureTriggerKind> for CaptureTriggerKind { - fn from(value: &CaptureTriggerKind) -> Self { - value.clone() - } - } - impl ToString for CaptureTriggerKind { - fn to_string(&self) -> String { - match *self { - Self::Webhook => "webhook".to_string(), - Self::Http => "http".to_string(), - Self::Websocket => "websocket".to_string(), - Self::Kafka => "kafka".to_string(), - Self::Email => "email".to_string(), - Self::Nats => "nats".to_string(), - Self::Postgres => "postgres".to_string(), - Self::Sqs => "sqs".to_string(), - Self::Mqtt => "mqtt".to_string(), - } - } - } - impl std::str::FromStr for CaptureTriggerKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "webhook" => Ok(Self::Webhook), - "http" => Ok(Self::Http), - "websocket" => Ok(Self::Websocket), - "kafka" => Ok(Self::Kafka), - "email" => Ok(Self::Email), - "nats" => Ok(Self::Nats), - "postgres" => Ok(Self::Postgres), - "sqs" => Ok(Self::Sqs), - "mqtt" => Ok(Self::Mqtt), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for CaptureTriggerKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for CaptureTriggerKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for CaptureTriggerKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ChangeWorkspaceColorBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - } - impl From<&ChangeWorkspaceColorBody> for ChangeWorkspaceColorBody { - fn from(value: &ChangeWorkspaceColorBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ChangeWorkspaceIdBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub new_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub new_name: Option, - } - impl From<&ChangeWorkspaceIdBody> for ChangeWorkspaceIdBody { - fn from(value: &ChangeWorkspaceIdBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ChangeWorkspaceNameBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub new_name: Option, - } - impl From<&ChangeWorkspaceNameBody> for ChangeWorkspaceNameBody { - fn from(value: &ChangeWorkspaceNameBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ChannelInfo { - ///The unique identifier of the channel - pub channel_id: String, - ///The display name of the channel - pub channel_name: String, - ///The service URL for the channel - pub service_url: String, - ///The Microsoft Teams tenant identifier - pub tenant_id: String, - } - impl From<&ChannelInfo> for ChannelInfo { - fn from(value: &ChannelInfo) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ClearIndexIdxName { - JobIndex, - ServiceLogIndex, - } - impl From<&ClearIndexIdxName> for ClearIndexIdxName { - fn from(value: &ClearIndexIdxName) -> Self { - value.clone() - } - } - impl ToString for ClearIndexIdxName { - fn to_string(&self) -> String { - match *self { - Self::JobIndex => "JobIndex".to_string(), - Self::ServiceLogIndex => "ServiceLogIndex".to_string(), - } - } - } - impl std::str::FromStr for ClearIndexIdxName { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "JobIndex" => Ok(Self::JobIndex), - "ServiceLogIndex" => Ok(Self::ServiceLogIndex), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ClearIndexIdxName { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ClearIndexIdxName { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ClearIndexIdxName { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CompletedJob { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub aggregate_wait_time_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - pub canceled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_reason: Option, - pub created_at: chrono::DateTime, - pub created_by: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deleted: Option, - pub duration_ms: i64, - pub email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_status: Option, - pub id: uuid::Uuid, - pub is_flow_step: bool, - pub is_skipped: bool, - pub job_kind: CompletedJobJobKind, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub labels: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub language: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub logs: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mem_peak: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_job: Option, - /**The user (u/userfoo) or group (g/groupfoo) whom -the execution of this script will be permissioned_as and by extension its DT_TOKEN. -*/ - pub permissioned_as: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessed: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_flow: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub result: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_hash: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub self_wait_time_ms: Option, - pub started_at: chrono::DateTime, - pub success: bool, - pub tag: String, - pub visible_to_owner: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&CompletedJob> for CompletedJob { - fn from(value: &CompletedJob) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum CompletedJobJobKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "preview")] - Preview, - #[serde(rename = "dependencies")] - Dependencies, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "flowdependencies")] - Flowdependencies, - #[serde(rename = "appdependencies")] - Appdependencies, - #[serde(rename = "flowpreview")] - Flowpreview, - #[serde(rename = "script_hub")] - ScriptHub, - #[serde(rename = "identity")] - Identity, - #[serde(rename = "deploymentcallback")] - Deploymentcallback, - #[serde(rename = "singlescriptflow")] - Singlescriptflow, - #[serde(rename = "flowscript")] - Flowscript, - #[serde(rename = "flownode")] - Flownode, - #[serde(rename = "appscript")] - Appscript, - } - impl From<&CompletedJobJobKind> for CompletedJobJobKind { - fn from(value: &CompletedJobJobKind) -> Self { - value.clone() - } - } - impl ToString for CompletedJobJobKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Preview => "preview".to_string(), - Self::Dependencies => "dependencies".to_string(), - Self::Flow => "flow".to_string(), - Self::Flowdependencies => "flowdependencies".to_string(), - Self::Appdependencies => "appdependencies".to_string(), - Self::Flowpreview => "flowpreview".to_string(), - Self::ScriptHub => "script_hub".to_string(), - Self::Identity => "identity".to_string(), - Self::Deploymentcallback => "deploymentcallback".to_string(), - Self::Singlescriptflow => "singlescriptflow".to_string(), - Self::Flowscript => "flowscript".to_string(), - Self::Flownode => "flownode".to_string(), - Self::Appscript => "appscript".to_string(), - } - } - } - impl std::str::FromStr for CompletedJobJobKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "preview" => Ok(Self::Preview), - "dependencies" => Ok(Self::Dependencies), - "flow" => Ok(Self::Flow), - "flowdependencies" => Ok(Self::Flowdependencies), - "appdependencies" => Ok(Self::Appdependencies), - "flowpreview" => Ok(Self::Flowpreview), - "script_hub" => Ok(Self::ScriptHub), - "identity" => Ok(Self::Identity), - "deploymentcallback" => Ok(Self::Deploymentcallback), - "singlescriptflow" => Ok(Self::Singlescriptflow), - "flowscript" => Ok(Self::Flowscript), - "flownode" => Ok(Self::Flownode), - "appscript" => Ok(Self::Appscript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for CompletedJobJobKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for CompletedJobJobKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for CompletedJobJobKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConcurrencyGroup { - pub concurrency_key: String, - pub total_running: f64, - } - impl From<&ConcurrencyGroup> for ConcurrencyGroup { - fn from(value: &ConcurrencyGroup) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Config { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub config: std::collections::HashMap, - pub name: String, - } - impl From<&Config> for Config { - fn from(value: &Config) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConnectCallbackBody { - pub code: String, - pub state: String, - } - impl From<&ConnectCallbackBody> for ConnectCallbackBody { - fn from(value: &ConnectCallbackBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConnectSlackCallbackBody { - pub code: String, - pub state: String, - } - impl From<&ConnectSlackCallbackBody> for ConnectSlackCallbackBody { - fn from(value: &ConnectSlackCallbackBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConnectSlackCallbackInstanceBody { - pub code: String, - pub state: String, - } - impl From<&ConnectSlackCallbackInstanceBody> for ConnectSlackCallbackInstanceBody { - fn from(value: &ConnectSlackCallbackInstanceBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConnectTeamsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub team_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub team_name: Option, - } - impl From<&ConnectTeamsBody> for ConnectTeamsBody { - fn from(value: &ConnectTeamsBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ContextualVariable { - pub description: String, - pub is_custom: bool, - pub name: String, - pub value: String, - } - impl From<&ContextualVariable> for ContextualVariable { - fn from(value: &ContextualVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CountJobsByTagResponseItem { - pub count: i64, - pub tag: String, - } - impl From<&CountJobsByTagResponseItem> for CountJobsByTagResponseItem { - fn from(value: &CountJobsByTagResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CountSearchLogsIndexResponse { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub count_per_host: std::collections::HashMap, - ///a list of the terms that couldn't be parsed (and thus ignored) - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub query_parse_errors: Vec, - } - impl From<&CountSearchLogsIndexResponse> for CountSearchLogsIndexResponse { - fn from(value: &CountSearchLogsIndexResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateAccountBody { - pub client: String, - pub expires_in: i64, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_token: Option, - } - impl From<&CreateAccountBody> for CreateAccountBody { - fn from(value: &CreateAccountBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateAppBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub custom_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - pub path: String, - pub policy: Policy, - pub summary: String, - pub value: serde_json::Value, - } - impl From<&CreateAppBody> for CreateAppBody { - fn from(value: &CreateAppBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateDraftBody { - pub path: String, - pub typ: CreateDraftBodyTyp, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&CreateDraftBody> for CreateDraftBody { - fn from(value: &CreateDraftBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum CreateDraftBodyTyp { - #[serde(rename = "flow")] - Flow, - #[serde(rename = "script")] - Script, - #[serde(rename = "app")] - App, - } - impl From<&CreateDraftBodyTyp> for CreateDraftBodyTyp { - fn from(value: &CreateDraftBodyTyp) -> Self { - value.clone() - } - } - impl ToString for CreateDraftBodyTyp { - fn to_string(&self) -> String { - match *self { - Self::Flow => "flow".to_string(), - Self::Script => "script".to_string(), - Self::App => "app".to_string(), - } - } - } - impl std::str::FromStr for CreateDraftBodyTyp { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "flow" => Ok(Self::Flow), - "script" => Ok(Self::Script), - "app" => Ok(Self::App), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for CreateDraftBodyTyp { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for CreateDraftBodyTyp { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for CreateDraftBodyTyp { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateFlowBody { - #[serde(flatten)] - pub open_flow_w_path: OpenFlowWPath, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - } - impl From<&CreateFlowBody> for CreateFlowBody { - fn from(value: &CreateFlowBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateFolderBody { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - pub name: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub owners: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&CreateFolderBody> for CreateFolderBody { - fn from(value: &CreateFolderBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateGroupBody { - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&CreateGroupBody> for CreateGroupBody { - fn from(value: &CreateGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateInput { - pub args: std::collections::HashMap, - pub name: String, - } - impl From<&CreateInput> for CreateInput { - fn from(value: &CreateInput) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateInstanceGroupBody { - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&CreateInstanceGroupBody> for CreateInstanceGroupBody { - fn from(value: &CreateInstanceGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateRawAppBody { - pub path: String, - pub summary: String, - pub value: String, - } - impl From<&CreateRawAppBody> for CreateRawAppBody { - fn from(value: &CreateRawAppBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - pub path: String, - pub resource_type: String, - pub value: serde_json::Value, - } - impl From<&CreateResource> for CreateResource { - fn from(value: &CreateResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateUserGloballyBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub company: Option, - pub email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - pub password: String, - pub super_admin: bool, - } - impl From<&CreateUserGloballyBody> for CreateUserGloballyBody { - fn from(value: &CreateUserGloballyBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateVariable { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub account: Option, - pub description: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_oauth: Option, - pub is_secret: bool, - pub path: String, - pub value: String, - } - impl From<&CreateVariable> for CreateVariable { - fn from(value: &CreateVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateWorkspace { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - pub id: String, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - } - impl From<&CreateWorkspace> for CreateWorkspace { - fn from(value: &CreateWorkspace) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CriticalAlert { - ///Acknowledgment status of the alert, can be true, false, or null if not set - #[serde(default, skip_serializing_if = "Option::is_none")] - pub acknowledged: Option, - ///Type of alert (e.g., critical_error) - #[serde(default, skip_serializing_if = "Option::is_none")] - pub alert_type: Option, - ///Time when the alert was created - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_at: Option>, - ///Unique identifier for the alert - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - ///The message content of the alert - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - ///Workspace id if the alert is in the scope of a workspace - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&CriticalAlert> for CriticalAlert { - fn from(value: &CriticalAlert) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DeclineInviteBody { - pub workspace_id: String, - } - impl From<&DeclineInviteBody> for DeclineInviteBody { - fn from(value: &DeclineInviteBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum DeleteDraftKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - } - impl From<&DeleteDraftKind> for DeleteDraftKind { - fn from(value: &DeleteDraftKind) -> Self { - value.clone() - } - } - impl ToString for DeleteDraftKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - } - } - } - impl std::str::FromStr for DeleteDraftKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for DeleteDraftKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for DeleteDraftKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for DeleteDraftKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DeleteInviteBody { - pub email: String, - pub is_admin: bool, - pub operator: bool, - } - impl From<&DeleteInviteBody> for DeleteInviteBody { - fn from(value: &DeleteInviteBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DuckdbConnectionSettingsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource: Option, - } - impl From<&DuckdbConnectionSettingsBody> for DuckdbConnectionSettingsBody { - fn from(value: &DuckdbConnectionSettingsBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DuckdbConnectionSettingsResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub connection_settings_str: Option, - } - impl From<&DuckdbConnectionSettingsResponse> for DuckdbConnectionSettingsResponse { - fn from(value: &DuckdbConnectionSettingsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DuckdbConnectionSettingsV2Body { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - } - impl From<&DuckdbConnectionSettingsV2Body> for DuckdbConnectionSettingsV2Body { - fn from(value: &DuckdbConnectionSettingsV2Body) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DuckdbConnectionSettingsV2Response { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub azure_container_path: Option, - pub connection_settings_str: String, - } - impl From<&DuckdbConnectionSettingsV2Response> - for DuckdbConnectionSettingsV2Response { - fn from(value: &DuckdbConnectionSettingsV2Response) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditAutoInviteBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub auto_add: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub invite_all: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator: Option, - } - impl From<&EditAutoInviteBody> for EditAutoInviteBody { - fn from(value: &EditAutoInviteBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditCopilotConfigBody { - pub ai_models: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ai_resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code_completion_model: Option, - } - impl From<&EditCopilotConfigBody> for EditCopilotConfigBody { - fn from(value: &EditCopilotConfigBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditDeployToBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deploy_to: Option, - } - impl From<&EditDeployToBody> for EditDeployToBody { - fn from(value: &EditDeployToBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditErrorHandlerBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_muted_on_cancel: Option, - } - impl From<&EditErrorHandlerBody> for EditErrorHandlerBody { - fn from(value: &EditErrorHandlerBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditHttpTrigger { - pub http_method: EditHttpTriggerHttpMethod, - pub is_async: bool, - pub is_flow: bool, - pub is_static_website: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_string: Option, - pub requires_auth: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub route_path: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub static_asset_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_route: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub wrap_body: Option, - } - impl From<&EditHttpTrigger> for EditHttpTrigger { - fn from(value: &EditHttpTrigger) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum EditHttpTriggerHttpMethod { - #[serde(rename = "get")] - Get, - #[serde(rename = "post")] - Post, - #[serde(rename = "put")] - Put, - #[serde(rename = "delete")] - Delete, - #[serde(rename = "patch")] - Patch, - } - impl From<&EditHttpTriggerHttpMethod> for EditHttpTriggerHttpMethod { - fn from(value: &EditHttpTriggerHttpMethod) -> Self { - value.clone() - } - } - impl ToString for EditHttpTriggerHttpMethod { - fn to_string(&self) -> String { - match *self { - Self::Get => "get".to_string(), - Self::Post => "post".to_string(), - Self::Put => "put".to_string(), - Self::Delete => "delete".to_string(), - Self::Patch => "patch".to_string(), - } - } - } - impl std::str::FromStr for EditHttpTriggerHttpMethod { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "get" => Ok(Self::Get), - "post" => Ok(Self::Post), - "put" => Ok(Self::Put), - "delete" => Ok(Self::Delete), - "patch" => Ok(Self::Patch), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for EditHttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for EditHttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for EditHttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditHttpTriggerStaticAssetConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&EditHttpTriggerStaticAssetConfig> for EditHttpTriggerStaticAssetConfig { - fn from(value: &EditHttpTriggerStaticAssetConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditKafkaTrigger { - pub group_id: String, - pub is_flow: bool, - pub kafka_resource_path: String, - pub path: String, - pub script_path: String, - pub topics: Vec, - } - impl From<&EditKafkaTrigger> for EditKafkaTrigger { - fn from(value: &EditKafkaTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditLargeFileStorageConfigBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub large_file_storage: Option, - } - impl From<&EditLargeFileStorageConfigBody> for EditLargeFileStorageConfigBody { - fn from(value: &EditLargeFileStorageConfigBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditMqttTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_version: Option, - pub enabled: bool, - pub is_flow: bool, - pub mqtt_resource_path: String, - pub path: String, - pub script_path: String, - pub subscribe_topics: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v3_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v5_config: Option, - } - impl From<&EditMqttTrigger> for EditMqttTrigger { - fn from(value: &EditMqttTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditNatsTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub consumer_name: Option, - pub is_flow: bool, - pub nats_resource_path: String, - pub path: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stream_name: Option, - pub subjects: Vec, - pub use_jetstream: bool, - } - impl From<&EditNatsTrigger> for EditNatsTrigger { - fn from(value: &EditNatsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditPostgresTrigger { - pub enabled: bool, - pub is_flow: bool, - pub path: String, - pub postgres_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub publication: Option, - pub publication_name: String, - pub replication_slot_name: String, - pub script_path: String, - } - impl From<&EditPostgresTrigger> for EditPostgresTrigger { - fn from(value: &EditPostgresTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&EditResource> for EditResource { - fn from(value: &EditResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditResourceType { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schema: Option, - } - impl From<&EditResourceType> for EditResourceType { - fn from(value: &EditResourceType) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditSchedule { - pub args: ScriptArgs, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_flow_overlap: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_exact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub paused_until: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub schedule: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - pub timezone: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&EditSchedule> for EditSchedule { - fn from(value: &EditSchedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditSlackCommandBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slack_command_script: Option, - } - impl From<&EditSlackCommandBody> for EditSlackCommandBody { - fn from(value: &EditSlackCommandBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditSqsTrigger { - pub aws_resource_path: String, - pub enabled: bool, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub message_attributes: Vec, - pub path: String, - pub queue_url: String, - pub script_path: String, - } - impl From<&EditSqsTrigger> for EditSqsTrigger { - fn from(value: &EditSqsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditTeamsCommandBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slack_command_script: Option, - } - impl From<&EditTeamsCommandBody> for EditTeamsCommandBody { - fn from(value: &EditTeamsCommandBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditVariable { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_secret: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&EditVariable> for EditVariable { - fn from(value: &EditVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWebhookBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub webhook: Option, - } - impl From<&EditWebhookBody> for EditWebhookBody { - fn from(value: &EditWebhookBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWebsocketTrigger { - pub can_return_message: bool, - pub filters: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub initial_messages: Vec, - pub is_flow: bool, - pub path: String, - pub script_path: String, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&EditWebsocketTrigger> for EditWebsocketTrigger { - fn from(value: &EditWebsocketTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWebsocketTriggerFiltersItem { - pub key: String, - pub value: serde_json::Value, - } - impl From<&EditWebsocketTriggerFiltersItem> for EditWebsocketTriggerFiltersItem { - fn from(value: &EditWebsocketTriggerFiltersItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWorkspaceDefaultAppBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default_app_path: Option, - } - impl From<&EditWorkspaceDefaultAppBody> for EditWorkspaceDefaultAppBody { - fn from(value: &EditWorkspaceDefaultAppBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWorkspaceDeployUiSettingsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deploy_ui_settings: Option, - } - impl From<&EditWorkspaceDeployUiSettingsBody> for EditWorkspaceDeployUiSettingsBody { - fn from(value: &EditWorkspaceDeployUiSettingsBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWorkspaceGitSyncConfigBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub git_sync_settings: Option, - } - impl From<&EditWorkspaceGitSyncConfigBody> for EditWorkspaceGitSyncConfigBody { - fn from(value: &EditWorkspaceGitSyncConfigBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWorkspaceUser { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub disabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_admin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator: Option, - } - impl From<&EditWorkspaceUser> for EditWorkspaceUser { - fn from(value: &EditWorkspaceUser) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExecuteComponentBody { - pub args: serde_json::Value, - pub component: String, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub force_viewer_allow_user_resources: Vec, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub force_viewer_one_of_fields: std::collections::HashMap< - String, - serde_json::Value, - >, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub force_viewer_static_fields: std::collections::HashMap< - String, - serde_json::Value, - >, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub version: Option, - } - impl From<&ExecuteComponentBody> for ExecuteComponentBody { - fn from(value: &ExecuteComponentBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExecuteComponentBodyRawCode { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - pub content: String, - pub language: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - } - impl From<&ExecuteComponentBodyRawCode> for ExecuteComponentBodyRawCode { - fn from(value: &ExecuteComponentBodyRawCode) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExistsRouteBody { - pub http_method: ExistsRouteBodyHttpMethod, - pub route_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub trigger_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_route: Option, - } - impl From<&ExistsRouteBody> for ExistsRouteBody { - fn from(value: &ExistsRouteBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ExistsRouteBodyHttpMethod { - #[serde(rename = "get")] - Get, - #[serde(rename = "post")] - Post, - #[serde(rename = "put")] - Put, - #[serde(rename = "delete")] - Delete, - #[serde(rename = "patch")] - Patch, - } - impl From<&ExistsRouteBodyHttpMethod> for ExistsRouteBodyHttpMethod { - fn from(value: &ExistsRouteBodyHttpMethod) -> Self { - value.clone() - } - } - impl ToString for ExistsRouteBodyHttpMethod { - fn to_string(&self) -> String { - match *self { - Self::Get => "get".to_string(), - Self::Post => "post".to_string(), - Self::Put => "put".to_string(), - Self::Delete => "delete".to_string(), - Self::Patch => "patch".to_string(), - } - } - } - impl std::str::FromStr for ExistsRouteBodyHttpMethod { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "get" => Ok(Self::Get), - "post" => Ok(Self::Post), - "put" => Ok(Self::Put), - "delete" => Ok(Self::Delete), - "patch" => Ok(Self::Patch), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ExistsRouteBodyHttpMethod { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ExistsRouteBodyHttpMethod { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ExistsRouteBodyHttpMethod { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExistsUsernameBody { - pub id: String, - pub username: String, - } - impl From<&ExistsUsernameBody> for ExistsUsernameBody { - fn from(value: &ExistsUsernameBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExistsWorkspaceBody { - pub id: String, - } - impl From<&ExistsWorkspaceBody> for ExistsWorkspaceBody { - fn from(value: &ExistsWorkspaceBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExportedInstanceGroup { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub emails: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scim_display_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&ExportedInstanceGroup> for ExportedInstanceGroup { - fn from(value: &ExportedInstanceGroup) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExportedUser { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub company: Option, - pub email: String, - pub first_time_user: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub password_hash: Option, - pub super_admin: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - pub verified: bool, - } - impl From<&ExportedUser> for ExportedUser { - fn from(value: &ExportedUser) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExtendedJobs { - pub jobs: Vec, - pub obscured_jobs: Vec, - ///Obscured jobs omitted for security because of too specific filtering - #[serde(default, skip_serializing_if = "Option::is_none")] - pub omitted_obscured_jobs: Option, - } - impl From<&ExtendedJobs> for ExtendedJobs { - fn from(value: &ExtendedJobs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExtraPerms(pub std::collections::HashMap); - impl std::ops::Deref for ExtraPerms { - type Target = std::collections::HashMap; - fn deref(&self) -> &std::collections::HashMap { - &self.0 - } - } - impl From for std::collections::HashMap { - fn from(value: ExtraPerms) -> Self { - value.0 - } - } - impl From<&ExtraPerms> for ExtraPerms { - fn from(value: &ExtraPerms) -> Self { - value.clone() - } - } - impl From> for ExtraPerms { - fn from(value: std::collections::HashMap) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FileUploadResponse { - pub file_key: String, - } - impl From<&FileUploadResponse> for FileUploadResponse { - fn from(value: &FileUploadResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Flow { - #[serde(flatten)] - pub open_flow: OpenFlow, - #[serde(flatten)] - pub flow_metadata: FlowMetadata, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock_error_logs: Option, - } - impl From<&Flow> for Flow { - fn from(value: &Flow) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowMetadata { - pub archived: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - pub edited_at: chrono::DateTime, - pub edited_by: String, - pub extra_perms: ExtraPerms, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub starred: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&FlowMetadata> for FlowMetadata { - fn from(value: &FlowMetadata) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModule { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub continue_on_error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delete_after_use: Option, - pub id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_if: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sleep: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stop_after_all_iters_if: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stop_after_if: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub suspend: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - pub value: FlowModuleValue, - } - impl From<&FlowModule> for FlowModule { - fn from(value: &FlowModule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleMock { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub return_value: Option, - } - impl From<&FlowModuleMock> for FlowModuleMock { - fn from(value: &FlowModuleMock) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleSkipIf { - pub expr: String, - } - impl From<&FlowModuleSkipIf> for FlowModuleSkipIf { - fn from(value: &FlowModuleSkipIf) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleStopAfterAllItersIf { - pub expr: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_if_stopped: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_message: Option - } - impl From<&FlowModuleStopAfterAllItersIf> for FlowModuleStopAfterAllItersIf { - fn from(value: &FlowModuleStopAfterAllItersIf) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleStopAfterIf { - pub expr: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_if_stopped: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_message: Option - } - impl From<&FlowModuleStopAfterIf> for FlowModuleStopAfterIf { - fn from(value: &FlowModuleStopAfterIf) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleSuspend { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub continue_on_disapprove_timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub hide_cancel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub required_events: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resume_form: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub self_approval_disabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub user_auth_required: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub user_groups_required: Option, - } - impl From<&FlowModuleSuspend> for FlowModuleSuspend { - fn from(value: &FlowModuleSuspend) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleSuspendResumeForm { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - } - impl From<&FlowModuleSuspendResumeForm> for FlowModuleSuspendResumeForm { - fn from(value: &FlowModuleSuspendResumeForm) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(untagged)] - pub enum FlowModuleValue { - RawScript(RawScript), - PathScript(PathScript), - PathFlow(PathFlow), - ForloopFlow(ForloopFlow), - WhileloopFlow(WhileloopFlow), - BranchOne(BranchOne), - BranchAll(BranchAll), - Identity(Identity), - } - impl From<&FlowModuleValue> for FlowModuleValue { - fn from(value: &FlowModuleValue) -> Self { - value.clone() - } - } - impl From for FlowModuleValue { - fn from(value: RawScript) -> Self { - Self::RawScript(value) - } - } - impl From for FlowModuleValue { - fn from(value: PathScript) -> Self { - Self::PathScript(value) - } - } - impl From for FlowModuleValue { - fn from(value: PathFlow) -> Self { - Self::PathFlow(value) - } - } - impl From for FlowModuleValue { - fn from(value: ForloopFlow) -> Self { - Self::ForloopFlow(value) - } - } - impl From for FlowModuleValue { - fn from(value: WhileloopFlow) -> Self { - Self::WhileloopFlow(value) - } - } - impl From for FlowModuleValue { - fn from(value: BranchOne) -> Self { - Self::BranchOne(value) - } - } - impl From for FlowModuleValue { - fn from(value: BranchAll) -> Self { - Self::BranchAll(value) - } - } - impl From for FlowModuleValue { - fn from(value: Identity) -> Self { - Self::Identity(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowPreview { - pub args: ScriptArgs, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restarted_from: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - pub value: FlowValue, - } - impl From<&FlowPreview> for FlowPreview { - fn from(value: &FlowPreview) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatus { - pub failure_module: FlowStatusFailureModule, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessor_module: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub step: i64, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub user_states: std::collections::HashMap, - } - impl From<&FlowStatus> for FlowStatus { - fn from(value: &FlowStatus) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusFailureModule { - #[serde(flatten)] - pub flow_status_module: FlowStatusModule, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_module: Option, - } - impl From<&FlowStatusFailureModule> for FlowStatusFailureModule { - fn from(value: &FlowStatusFailureModule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModule { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub approvers: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branch_chosen: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branchall: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub count: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub failed_retries: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub flow_jobs: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub flow_jobs_success: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub iterator: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub job: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub progress: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skipped: Option, - #[serde(rename = "type")] - pub type_: FlowStatusModuleType, - } - impl From<&FlowStatusModule> for FlowStatusModule { - fn from(value: &FlowStatusModule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleApproversItem { - pub approver: String, - pub resume_id: i64, - } - impl From<&FlowStatusModuleApproversItem> for FlowStatusModuleApproversItem { - fn from(value: &FlowStatusModuleApproversItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleBranchChosen { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branch: Option, - #[serde(rename = "type")] - pub type_: FlowStatusModuleBranchChosenType, - } - impl From<&FlowStatusModuleBranchChosen> for FlowStatusModuleBranchChosen { - fn from(value: &FlowStatusModuleBranchChosen) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum FlowStatusModuleBranchChosenType { - #[serde(rename = "branch")] - Branch, - #[serde(rename = "default")] - Default, - } - impl From<&FlowStatusModuleBranchChosenType> for FlowStatusModuleBranchChosenType { - fn from(value: &FlowStatusModuleBranchChosenType) -> Self { - value.clone() - } - } - impl ToString for FlowStatusModuleBranchChosenType { - fn to_string(&self) -> String { - match *self { - Self::Branch => "branch".to_string(), - Self::Default => "default".to_string(), - } - } - } - impl std::str::FromStr for FlowStatusModuleBranchChosenType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "branch" => Ok(Self::Branch), - "default" => Ok(Self::Default), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for FlowStatusModuleBranchChosenType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for FlowStatusModuleBranchChosenType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for FlowStatusModuleBranchChosenType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleBranchall { - pub branch: i64, - pub len: i64, - } - impl From<&FlowStatusModuleBranchall> for FlowStatusModuleBranchall { - fn from(value: &FlowStatusModuleBranchall) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleIterator { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub index: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub itered: Vec, - } - impl From<&FlowStatusModuleIterator> for FlowStatusModuleIterator { - fn from(value: &FlowStatusModuleIterator) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum FlowStatusModuleType { - WaitingForPriorSteps, - WaitingForEvents, - WaitingForExecutor, - InProgress, - Success, - Failure, - } - impl From<&FlowStatusModuleType> for FlowStatusModuleType { - fn from(value: &FlowStatusModuleType) -> Self { - value.clone() - } - } - impl ToString for FlowStatusModuleType { - fn to_string(&self) -> String { - match *self { - Self::WaitingForPriorSteps => "WaitingForPriorSteps".to_string(), - Self::WaitingForEvents => "WaitingForEvents".to_string(), - Self::WaitingForExecutor => "WaitingForExecutor".to_string(), - Self::InProgress => "InProgress".to_string(), - Self::Success => "Success".to_string(), - Self::Failure => "Failure".to_string(), - } - } - } - impl std::str::FromStr for FlowStatusModuleType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "WaitingForPriorSteps" => Ok(Self::WaitingForPriorSteps), - "WaitingForEvents" => Ok(Self::WaitingForEvents), - "WaitingForExecutor" => Ok(Self::WaitingForExecutor), - "InProgress" => Ok(Self::InProgress), - "Success" => Ok(Self::Success), - "Failure" => Ok(Self::Failure), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for FlowStatusModuleType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for FlowStatusModuleType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for FlowStatusModuleType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusRetry { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub fail_count: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub failed_jobs: Vec, - } - impl From<&FlowStatusRetry> for FlowStatusRetry { - fn from(value: &FlowStatusRetry) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowValue { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub early_return: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub failure_module: Option, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessor_module: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub same_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_expr: Option, - } - impl From<&FlowValue> for FlowValue { - fn from(value: &FlowValue) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowVersion { - pub created_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - pub id: i64, - } - impl From<&FlowVersion> for FlowVersion { - fn from(value: &FlowVersion) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Folder { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - pub extra_perms: std::collections::HashMap, - pub name: String, - pub owners: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&Folder> for Folder { - fn from(value: &Folder) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ForceCancelQueuedJobBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub reason: Option, - } - impl From<&ForceCancelQueuedJobBody> for ForceCancelQueuedJobBody { - fn from(value: &ForceCancelQueuedJobBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ForloopFlow { - pub iterator: InputTransform, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallelism: Option, - pub skip_failures: bool, - #[serde(rename = "type")] - pub type_: ForloopFlowType, - } - impl From<&ForloopFlow> for ForloopFlow { - fn from(value: &ForloopFlow) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ForloopFlowType { - #[serde(rename = "forloopflow")] - Forloopflow, - } - impl From<&ForloopFlowType> for ForloopFlowType { - fn from(value: &ForloopFlowType) -> Self { - value.clone() - } - } - impl ToString for ForloopFlowType { - fn to_string(&self) -> String { - match *self { - Self::Forloopflow => "forloopflow".to_string(), - } - } - } - impl std::str::FromStr for ForloopFlowType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "forloopflow" => Ok(Self::Forloopflow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ForloopFlowType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ForloopFlowType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ForloopFlowType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum GetCaptureConfigsRunnableKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&GetCaptureConfigsRunnableKind> for GetCaptureConfigsRunnableKind { - fn from(value: &GetCaptureConfigsRunnableKind) -> Self { - value.clone() - } - } - impl ToString for GetCaptureConfigsRunnableKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for GetCaptureConfigsRunnableKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for GetCaptureConfigsRunnableKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for GetCaptureConfigsRunnableKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for GetCaptureConfigsRunnableKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetCompletedCountResponse { - pub database_length: i64, - } - impl From<&GetCompletedCountResponse> for GetCompletedCountResponse { - fn from(value: &GetCompletedCountResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetCompletedJobResultMaybeResponse { - pub completed: bool, - pub result: serde_json::Value, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub success: Option, - } - impl From<&GetCompletedJobResultMaybeResponse> - for GetCompletedJobResultMaybeResponse { - fn from(value: &GetCompletedJobResultMaybeResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetCriticalAlertsResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub alerts: Vec, - ///Total number of pages based on the page size. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub total_pages: Option, - ///Total number of rows matching the query. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub total_rows: Option, - } - impl From<&GetCriticalAlertsResponse> for GetCriticalAlertsResponse { - fn from(value: &GetCriticalAlertsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetDeployToResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deploy_to: Option, - } - impl From<&GetDeployToResponse> for GetDeployToResponse { - fn from(value: &GetDeployToResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetFlowByPathWithDraftResponse { - #[serde(flatten)] - pub flow: Flow, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft: Option, - } - impl From<&GetFlowByPathWithDraftResponse> for GetFlowByPathWithDraftResponse { - fn from(value: &GetFlowByPathWithDraftResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetFlowDeploymentStatusResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock_error_logs: Option, - } - impl From<&GetFlowDeploymentStatusResponse> for GetFlowDeploymentStatusResponse { - fn from(value: &GetFlowDeploymentStatusResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetFolderUsageResponse { - pub apps: f64, - pub flows: f64, - pub resources: f64, - pub schedules: f64, - pub scripts: f64, - pub variables: f64, - } - impl From<&GetFolderUsageResponse> for GetFolderUsageResponse { - fn from(value: &GetFolderUsageResponse) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum GetGranularAclsKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "group_")] - Group, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "schedule")] - Schedule, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "folder")] - Folder, - #[serde(rename = "app")] - App, - #[serde(rename = "raw_app")] - RawApp, - #[serde(rename = "http_trigger")] - HttpTrigger, - #[serde(rename = "websocket_trigger")] - WebsocketTrigger, - #[serde(rename = "kafka_trigger")] - KafkaTrigger, - #[serde(rename = "nats_trigger")] - NatsTrigger, - #[serde(rename = "postgres_trigger")] - PostgresTrigger, - #[serde(rename = "mqtt_trigger")] - MqttTrigger, - #[serde(rename = "sqs_trigger")] - SqsTrigger, - } - impl From<&GetGranularAclsKind> for GetGranularAclsKind { - fn from(value: &GetGranularAclsKind) -> Self { - value.clone() - } - } - impl ToString for GetGranularAclsKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Group => "group_".to_string(), - Self::Resource => "resource".to_string(), - Self::Schedule => "schedule".to_string(), - Self::Variable => "variable".to_string(), - Self::Flow => "flow".to_string(), - Self::Folder => "folder".to_string(), - Self::App => "app".to_string(), - Self::RawApp => "raw_app".to_string(), - Self::HttpTrigger => "http_trigger".to_string(), - Self::WebsocketTrigger => "websocket_trigger".to_string(), - Self::KafkaTrigger => "kafka_trigger".to_string(), - Self::NatsTrigger => "nats_trigger".to_string(), - Self::PostgresTrigger => "postgres_trigger".to_string(), - Self::MqttTrigger => "mqtt_trigger".to_string(), - Self::SqsTrigger => "sqs_trigger".to_string(), - } - } - } - impl std::str::FromStr for GetGranularAclsKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "group_" => Ok(Self::Group), - "resource" => Ok(Self::Resource), - "schedule" => Ok(Self::Schedule), - "variable" => Ok(Self::Variable), - "flow" => Ok(Self::Flow), - "folder" => Ok(Self::Folder), - "app" => Ok(Self::App), - "raw_app" => Ok(Self::RawApp), - "http_trigger" => Ok(Self::HttpTrigger), - "websocket_trigger" => Ok(Self::WebsocketTrigger), - "kafka_trigger" => Ok(Self::KafkaTrigger), - "nats_trigger" => Ok(Self::NatsTrigger), - "postgres_trigger" => Ok(Self::PostgresTrigger), - "mqtt_trigger" => Ok(Self::MqttTrigger), - "sqs_trigger" => Ok(Self::SqsTrigger), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for GetGranularAclsKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for GetGranularAclsKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for GetGranularAclsKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetHubAppByIdResponse { - pub app: GetHubAppByIdResponseApp, - } - impl From<&GetHubAppByIdResponse> for GetHubAppByIdResponse { - fn from(value: &GetHubAppByIdResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetHubAppByIdResponseApp { - pub summary: String, - pub value: serde_json::Value, - } - impl From<&GetHubAppByIdResponseApp> for GetHubAppByIdResponseApp { - fn from(value: &GetHubAppByIdResponseApp) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetHubFlowByIdResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow: Option, - } - impl From<&GetHubFlowByIdResponse> for GetHubFlowByIdResponse { - fn from(value: &GetHubFlowByIdResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetHubScriptByPathResponse { - pub content: String, - pub language: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lockfile: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schema: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&GetHubScriptByPathResponse> for GetHubScriptByPathResponse { - fn from(value: &GetHubScriptByPathResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetJobMetricsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub from_timestamp: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeseries_max_datapoints: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub to_timestamp: Option>, - } - impl From<&GetJobMetricsBody> for GetJobMetricsBody { - fn from(value: &GetJobMetricsBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetJobMetricsResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub metrics_metadata: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scalar_metrics: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub timeseries_metrics: Vec, - } - impl From<&GetJobMetricsResponse> for GetJobMetricsResponse { - fn from(value: &GetJobMetricsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetJobUpdatesResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub completed: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub log_offset: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mem_peak: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub new_logs: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub progress: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub running: Option, - } - impl From<&GetJobUpdatesResponse> for GetJobUpdatesResponse { - fn from(value: &GetJobUpdatesResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetLatestKeyRenewalAttemptResponse { - pub attempted_at: chrono::DateTime, - pub result: String, - } - impl From<&GetLatestKeyRenewalAttemptResponse> - for GetLatestKeyRenewalAttemptResponse { - fn from(value: &GetLatestKeyRenewalAttemptResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetOAuthConnectResponse { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_params: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scopes: Vec, - } - impl From<&GetOAuthConnectResponse> for GetOAuthConnectResponse { - fn from(value: &GetOAuthConnectResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetPremiumInfoResponse { - pub automatic_billing: bool, - pub owner: String, - pub premium: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub seats: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub usage: Option, - } - impl From<&GetPremiumInfoResponse> for GetPremiumInfoResponse { - fn from(value: &GetPremiumInfoResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetQueueCountResponse { - pub database_length: i64, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub suspended: Option, - } - impl From<&GetQueueCountResponse> for GetQueueCountResponse { - fn from(value: &GetQueueCountResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetQueueMetricsResponseItem { - pub id: String, - pub values: Vec, - } - impl From<&GetQueueMetricsResponseItem> for GetQueueMetricsResponseItem { - fn from(value: &GetQueueMetricsResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetQueueMetricsResponseItemValuesItem { - pub created_at: String, - pub value: f64, - } - impl From<&GetQueueMetricsResponseItemValuesItem> - for GetQueueMetricsResponseItemValuesItem { - fn from(value: &GetQueueMetricsResponseItemValuesItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetResumeUrlsResponse { - #[serde(rename = "approvalPage")] - pub approval_page: String, - pub cancel: String, - pub resume: String, - } - impl From<&GetResumeUrlsResponse> for GetResumeUrlsResponse { - fn from(value: &GetResumeUrlsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetRunnableResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - pub endpoint_async: String, - pub endpoint_openai_sync: String, - pub endpoint_sync: String, - pub kind: String, - pub summary: String, - pub workspace: String, - } - impl From<&GetRunnableResponse> for GetRunnableResponse { - fn from(value: &GetRunnableResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetScriptDeploymentStatusResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock_error_logs: Option, - } - impl From<&GetScriptDeploymentStatusResponse> for GetScriptDeploymentStatusResponse { - fn from(value: &GetScriptDeploymentStatusResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetSettingsResponse { - pub ai_models: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ai_resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub auto_add: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub auto_invite_domain: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub auto_invite_operator: Option, - pub automatic_billing: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code_completion_model: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub customer_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default_app: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default_scripts: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deploy_to: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deploy_ui: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_extra_args: Option, - pub error_handler_muted_on_cancel: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub git_sync: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub large_file_storage: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mute_critical_alerts: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator_settings: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub plan: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slack_command_script: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slack_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slack_team_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub teams_command_script: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub teams_team_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub teams_team_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub webhook: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&GetSettingsResponse> for GetSettingsResponse { - fn from(value: &GetSettingsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetSuspendedJobFlowResponse { - pub approvers: Vec, - pub job: Job, - } - impl From<&GetSuspendedJobFlowResponse> for GetSuspendedJobFlowResponse { - fn from(value: &GetSuspendedJobFlowResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetSuspendedJobFlowResponseApproversItem { - pub approver: String, - pub resume_id: i64, - } - impl From<&GetSuspendedJobFlowResponseApproversItem> - for GetSuspendedJobFlowResponseApproversItem { - fn from(value: &GetSuspendedJobFlowResponseApproversItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetThresholdAlertResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_alert_sent: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub threshold_alert_amount: Option, - } - impl From<&GetThresholdAlertResponse> for GetThresholdAlertResponse { - fn from(value: &GetThresholdAlertResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetTopHubScriptsResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub asks: Vec, - } - impl From<&GetTopHubScriptsResponse> for GetTopHubScriptsResponse { - fn from(value: &GetTopHubScriptsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetTopHubScriptsResponseAsksItem { - pub app: String, - pub ask_id: f64, - pub id: f64, - pub kind: HubScriptKind, - pub summary: String, - pub version_id: f64, - pub views: f64, - pub votes: f64, - } - impl From<&GetTopHubScriptsResponseAsksItem> for GetTopHubScriptsResponseAsksItem { - fn from(value: &GetTopHubScriptsResponseAsksItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetTutorialProgressResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub progress: Option, - } - impl From<&GetTutorialProgressResponse> for GetTutorialProgressResponse { - fn from(value: &GetTutorialProgressResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetUsedTriggersResponse { - pub http_routes_used: bool, - pub kafka_used: bool, - pub mqtt_used: bool, - pub nats_used: bool, - pub postgres_used: bool, - pub sqs_used: bool, - pub websocket_used: bool, - } - impl From<&GetUsedTriggersResponse> for GetUsedTriggersResponse { - fn from(value: &GetUsedTriggersResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetWorkspaceDefaultAppResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default_app_path: Option, - } - impl From<&GetWorkspaceDefaultAppResponse> for GetWorkspaceDefaultAppResponse { - fn from(value: &GetWorkspaceDefaultAppResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetWorkspaceEncryptionKeyResponse { - pub key: String, - } - impl From<&GetWorkspaceEncryptionKeyResponse> for GetWorkspaceEncryptionKeyResponse { - fn from(value: &GetWorkspaceEncryptionKeyResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GitRepositorySettings { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub exclude_types_override: Vec, - pub git_repo_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub group_by_folder: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub use_individual_branch: Option, - } - impl From<&GitRepositorySettings> for GitRepositorySettings { - fn from(value: &GitRepositorySettings) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum GitRepositorySettingsExcludeTypesOverrideItem { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - #[serde(rename = "folder")] - Folder, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "secret")] - Secret, - #[serde(rename = "resourcetype")] - Resourcetype, - #[serde(rename = "schedule")] - Schedule, - #[serde(rename = "user")] - User, - #[serde(rename = "group")] - Group, - } - impl From<&GitRepositorySettingsExcludeTypesOverrideItem> - for GitRepositorySettingsExcludeTypesOverrideItem { - fn from(value: &GitRepositorySettingsExcludeTypesOverrideItem) -> Self { - value.clone() - } - } - impl ToString for GitRepositorySettingsExcludeTypesOverrideItem { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - Self::Folder => "folder".to_string(), - Self::Resource => "resource".to_string(), - Self::Variable => "variable".to_string(), - Self::Secret => "secret".to_string(), - Self::Resourcetype => "resourcetype".to_string(), - Self::Schedule => "schedule".to_string(), - Self::User => "user".to_string(), - Self::Group => "group".to_string(), - } - } - } - impl std::str::FromStr for GitRepositorySettingsExcludeTypesOverrideItem { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - "folder" => Ok(Self::Folder), - "resource" => Ok(Self::Resource), - "variable" => Ok(Self::Variable), - "secret" => Ok(Self::Secret), - "resourcetype" => Ok(Self::Resourcetype), - "schedule" => Ok(Self::Schedule), - "user" => Ok(Self::User), - "group" => Ok(Self::Group), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for GitRepositorySettingsExcludeTypesOverrideItem { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> - for GitRepositorySettingsExcludeTypesOverrideItem { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom - for GitRepositorySettingsExcludeTypesOverrideItem { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalSetting { - pub name: String, - pub value: std::collections::HashMap, - } - impl From<&GlobalSetting> for GlobalSetting { - fn from(value: &GlobalSetting) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalUserInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub company: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub devops: Option, - pub email: String, - pub login_type: GlobalUserInfoLoginType, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator_only: Option, - pub super_admin: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - pub verified: bool, - } - impl From<&GlobalUserInfo> for GlobalUserInfo { - fn from(value: &GlobalUserInfo) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum GlobalUserInfoLoginType { - #[serde(rename = "password")] - Password, - #[serde(rename = "github")] - Github, - } - impl From<&GlobalUserInfoLoginType> for GlobalUserInfoLoginType { - fn from(value: &GlobalUserInfoLoginType) -> Self { - value.clone() - } - } - impl ToString for GlobalUserInfoLoginType { - fn to_string(&self) -> String { - match *self { - Self::Password => "password".to_string(), - Self::Github => "github".to_string(), - } - } - } - impl std::str::FromStr for GlobalUserInfoLoginType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "password" => Ok(Self::Password), - "github" => Ok(Self::Github), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for GlobalUserInfoLoginType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for GlobalUserInfoLoginType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for GlobalUserInfoLoginType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalUserRenameBody { - pub new_username: String, - } - impl From<&GlobalUserRenameBody> for GlobalUserRenameBody { - fn from(value: &GlobalUserRenameBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalUserUpdateBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_devops: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_super_admin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - } - impl From<&GlobalUserUpdateBody> for GlobalUserUpdateBody { - fn from(value: &GlobalUserUpdateBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalUsernameInfoResponse { - pub username: String, - pub workspace_usernames: Vec, - } - impl From<&GlobalUsernameInfoResponse> for GlobalUsernameInfoResponse { - fn from(value: &GlobalUsernameInfoResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalUsernameInfoResponseWorkspaceUsernamesItem { - pub username: String, - pub workspace_id: String, - } - impl From<&GlobalUsernameInfoResponseWorkspaceUsernamesItem> - for GlobalUsernameInfoResponseWorkspaceUsernamesItem { - fn from(value: &GlobalUsernameInfoResponseWorkspaceUsernamesItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Group { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub members: Vec, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&Group> for Group { - fn from(value: &Group) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct HttpTrigger { - pub http_method: HttpTriggerHttpMethod, - pub is_async: bool, - pub is_static_website: bool, - pub raw_string: bool, - pub requires_auth: bool, - pub route_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub static_asset_config: Option, - pub workspaced_route: bool, - pub wrap_body: bool, - } - impl From<&HttpTrigger> for HttpTrigger { - fn from(value: &HttpTrigger) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum HttpTriggerHttpMethod { - #[serde(rename = "get")] - Get, - #[serde(rename = "post")] - Post, - #[serde(rename = "put")] - Put, - #[serde(rename = "delete")] - Delete, - #[serde(rename = "patch")] - Patch, - } - impl From<&HttpTriggerHttpMethod> for HttpTriggerHttpMethod { - fn from(value: &HttpTriggerHttpMethod) -> Self { - value.clone() - } - } - impl ToString for HttpTriggerHttpMethod { - fn to_string(&self) -> String { - match *self { - Self::Get => "get".to_string(), - Self::Post => "post".to_string(), - Self::Put => "put".to_string(), - Self::Delete => "delete".to_string(), - Self::Patch => "patch".to_string(), - } - } - } - impl std::str::FromStr for HttpTriggerHttpMethod { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "get" => Ok(Self::Get), - "post" => Ok(Self::Post), - "put" => Ok(Self::Put), - "delete" => Ok(Self::Delete), - "patch" => Ok(Self::Patch), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for HttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for HttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for HttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct HttpTriggerStaticAssetConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&HttpTriggerStaticAssetConfig> for HttpTriggerStaticAssetConfig { - fn from(value: &HttpTriggerStaticAssetConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct HubScriptKind(pub serde_json::Value); - impl std::ops::Deref for HubScriptKind { - type Target = serde_json::Value; - fn deref(&self) -> &serde_json::Value { - &self.0 - } - } - impl From for serde_json::Value { - fn from(value: HubScriptKind) -> Self { - value.0 - } - } - impl From<&HubScriptKind> for HubScriptKind { - fn from(value: &HubScriptKind) -> Self { - value.clone() - } - } - impl From for HubScriptKind { - fn from(value: serde_json::Value) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Identity { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow: Option, - #[serde(rename = "type")] - pub type_: IdentityType, - } - impl From<&Identity> for Identity { - fn from(value: &Identity) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum IdentityType { - #[serde(rename = "identity")] - Identity, - } - impl From<&IdentityType> for IdentityType { - fn from(value: &IdentityType) -> Self { - value.clone() - } - } - impl ToString for IdentityType { - fn to_string(&self) -> String { - match *self { - Self::Identity => "identity".to_string(), - } - } - } - impl std::str::FromStr for IdentityType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "identity" => Ok(Self::Identity), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for IdentityType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for IdentityType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for IdentityType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Input { - pub created_at: chrono::DateTime, - pub created_by: String, - pub id: String, - pub is_public: bool, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub success: Option, - } - impl From<&Input> for Input { - fn from(value: &Input) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(untagged)] - pub enum InputTransform { - StaticTransform(StaticTransform), - JavascriptTransform(JavascriptTransform), - } - impl From<&InputTransform> for InputTransform { - fn from(value: &InputTransform) -> Self { - value.clone() - } - } - impl From for InputTransform { - fn from(value: StaticTransform) -> Self { - Self::StaticTransform(value) - } - } - impl From for InputTransform { - fn from(value: JavascriptTransform) -> Self { - Self::JavascriptTransform(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct InstanceGroup { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub emails: Vec, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&InstanceGroup> for InstanceGroup { - fn from(value: &InstanceGroup) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct InviteUserBody { - pub email: String, - pub is_admin: bool, - pub operator: bool, - } - impl From<&InviteUserBody> for InviteUserBody { - fn from(value: &InviteUserBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JavascriptTransform { - pub expr: String, - #[serde(rename = "type")] - pub type_: JavascriptTransformType, - } - impl From<&JavascriptTransform> for JavascriptTransform { - fn from(value: &JavascriptTransform) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum JavascriptTransformType { - #[serde(rename = "javascript")] - Javascript, - } - impl From<&JavascriptTransformType> for JavascriptTransformType { - fn from(value: &JavascriptTransformType) -> Self { - value.clone() - } - } - impl ToString for JavascriptTransformType { - fn to_string(&self) -> String { - match *self { - Self::Javascript => "javascript".to_string(), - } - } - } - impl std::str::FromStr for JavascriptTransformType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "javascript" => Ok(Self::Javascript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for JavascriptTransformType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for JavascriptTransformType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for JavascriptTransformType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(untagged)] - pub enum Job { - Variant0(JobVariant0), - Variant1(JobVariant1), - } - impl From<&Job> for Job { - fn from(value: &Job) -> Self { - value.clone() - } - } - impl From for Job { - fn from(value: JobVariant0) -> Self { - Self::Variant0(value) - } - } - impl From for Job { - fn from(value: JobVariant1) -> Self { - Self::Variant1(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JobSearchHit { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dancer: Option, - } - impl From<&JobSearchHit> for JobSearchHit { - fn from(value: &JobSearchHit) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JobVariant0 { - #[serde(flatten)] - pub completed_job: CompletedJob, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&JobVariant0> for JobVariant0 { - fn from(value: &JobVariant0) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum JobVariant0Type { - CompletedJob, - } - impl From<&JobVariant0Type> for JobVariant0Type { - fn from(value: &JobVariant0Type) -> Self { - value.clone() - } - } - impl ToString for JobVariant0Type { - fn to_string(&self) -> String { - match *self { - Self::CompletedJob => "CompletedJob".to_string(), - } - } - } - impl std::str::FromStr for JobVariant0Type { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "CompletedJob" => Ok(Self::CompletedJob), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for JobVariant0Type { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for JobVariant0Type { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for JobVariant0Type { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JobVariant1 { - #[serde(flatten)] - pub queued_job: QueuedJob, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&JobVariant1> for JobVariant1 { - fn from(value: &JobVariant1) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum JobVariant1Type { - QueuedJob, - } - impl From<&JobVariant1Type> for JobVariant1Type { - fn from(value: &JobVariant1Type) -> Self { - value.clone() - } - } - impl ToString for JobVariant1Type { - fn to_string(&self) -> String { - match *self { - Self::QueuedJob => "QueuedJob".to_string(), - } - } - } - impl std::str::FromStr for JobVariant1Type { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "QueuedJob" => Ok(Self::QueuedJob), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for JobVariant1Type { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for JobVariant1Type { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for JobVariant1Type { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct KafkaTrigger { - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - pub group_id: String, - pub kafka_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub topics: Vec, - } - impl From<&KafkaTrigger> for KafkaTrigger { - fn from(value: &KafkaTrigger) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum Language { - Typescript, - } - impl From<&Language> for Language { - fn from(value: &Language) -> Self { - value.clone() - } - } - impl ToString for Language { - fn to_string(&self) -> String { - match *self { - Self::Typescript => "Typescript".to_string(), - } - } - } - impl std::str::FromStr for Language { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Typescript" => Ok(Self::Typescript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for Language { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for Language { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for Language { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LargeFileStorage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub azure_blob_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub public_resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub secondary_storage: std::collections::HashMap< - String, - LargeFileStorageSecondaryStorageValue, - >, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&LargeFileStorage> for LargeFileStorage { - fn from(value: &LargeFileStorage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LargeFileStorageSecondaryStorageValue { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub azure_blob_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub public_resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&LargeFileStorageSecondaryStorageValue> - for LargeFileStorageSecondaryStorageValue { - fn from(value: &LargeFileStorageSecondaryStorageValue) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum LargeFileStorageSecondaryStorageValueType { - S3Storage, - AzureBlobStorage, - AzureWorkloadIdentity, - S3AwsOidc, - } - impl From<&LargeFileStorageSecondaryStorageValueType> - for LargeFileStorageSecondaryStorageValueType { - fn from(value: &LargeFileStorageSecondaryStorageValueType) -> Self { - value.clone() - } - } - impl ToString for LargeFileStorageSecondaryStorageValueType { - fn to_string(&self) -> String { - match *self { - Self::S3Storage => "S3Storage".to_string(), - Self::AzureBlobStorage => "AzureBlobStorage".to_string(), - Self::AzureWorkloadIdentity => "AzureWorkloadIdentity".to_string(), - Self::S3AwsOidc => "S3AwsOidc".to_string(), - } - } - } - impl std::str::FromStr for LargeFileStorageSecondaryStorageValueType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "S3Storage" => Ok(Self::S3Storage), - "AzureBlobStorage" => Ok(Self::AzureBlobStorage), - "AzureWorkloadIdentity" => Ok(Self::AzureWorkloadIdentity), - "S3AwsOidc" => Ok(Self::S3AwsOidc), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for LargeFileStorageSecondaryStorageValueType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for LargeFileStorageSecondaryStorageValueType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for LargeFileStorageSecondaryStorageValueType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum LargeFileStorageType { - S3Storage, - AzureBlobStorage, - AzureWorkloadIdentity, - S3AwsOidc, - } - impl From<&LargeFileStorageType> for LargeFileStorageType { - fn from(value: &LargeFileStorageType) -> Self { - value.clone() - } - } - impl ToString for LargeFileStorageType { - fn to_string(&self) -> String { - match *self { - Self::S3Storage => "S3Storage".to_string(), - Self::AzureBlobStorage => "AzureBlobStorage".to_string(), - Self::AzureWorkloadIdentity => "AzureWorkloadIdentity".to_string(), - Self::S3AwsOidc => "S3AwsOidc".to_string(), - } - } - } - impl std::str::FromStr for LargeFileStorageType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "S3Storage" => Ok(Self::S3Storage), - "AzureBlobStorage" => Ok(Self::AzureBlobStorage), - "AzureWorkloadIdentity" => Ok(Self::AzureWorkloadIdentity), - "S3AwsOidc" => Ok(Self::S3AwsOidc), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for LargeFileStorageType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for LargeFileStorageType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for LargeFileStorageType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ListAuditLogsActionKind { - Create, - Update, - Delete, - Execute, - } - impl From<&ListAuditLogsActionKind> for ListAuditLogsActionKind { - fn from(value: &ListAuditLogsActionKind) -> Self { - value.clone() - } - } - impl ToString for ListAuditLogsActionKind { - fn to_string(&self) -> String { - match *self { - Self::Create => "Create".to_string(), - Self::Update => "Update".to_string(), - Self::Delete => "Delete".to_string(), - Self::Execute => "Execute".to_string(), - } - } - } - impl std::str::FromStr for ListAuditLogsActionKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Create" => Ok(Self::Create), - "Update" => Ok(Self::Update), - "Delete" => Ok(Self::Delete), - "Execute" => Ok(Self::Execute), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ListAuditLogsActionKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ListAuditLogsActionKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ListAuditLogsActionKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListAvailableTeamsChannelsResponseItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub channel_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub channel_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub service_url: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tenant_id: Option, - } - impl From<&ListAvailableTeamsChannelsResponseItem> - for ListAvailableTeamsChannelsResponseItem { - fn from(value: &ListAvailableTeamsChannelsResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListAvailableTeamsIdsResponseItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub team_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub team_name: Option, - } - impl From<&ListAvailableTeamsIdsResponseItem> for ListAvailableTeamsIdsResponseItem { - fn from(value: &ListAvailableTeamsIdsResponseItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ListCapturesRunnableKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&ListCapturesRunnableKind> for ListCapturesRunnableKind { - fn from(value: &ListCapturesRunnableKind) -> Self { - value.clone() - } - } - impl ToString for ListCapturesRunnableKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for ListCapturesRunnableKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ListCapturesRunnableKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ListCapturesRunnableKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ListCapturesRunnableKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ListFlowPathsFromWorkspaceRunnableRunnableKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&ListFlowPathsFromWorkspaceRunnableRunnableKind> - for ListFlowPathsFromWorkspaceRunnableRunnableKind { - fn from(value: &ListFlowPathsFromWorkspaceRunnableRunnableKind) -> Self { - value.clone() - } - } - impl ToString for ListFlowPathsFromWorkspaceRunnableRunnableKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for ListFlowPathsFromWorkspaceRunnableRunnableKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ListFlowPathsFromWorkspaceRunnableRunnableKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> - for ListFlowPathsFromWorkspaceRunnableRunnableKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom - for ListFlowPathsFromWorkspaceRunnableRunnableKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListFlowsResponseItem { - #[serde(flatten)] - pub flow: Flow, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_draft: Option, - } - impl From<&ListFlowsResponseItem> for ListFlowsResponseItem { - fn from(value: &ListFlowsResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListHubAppsResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub apps: Vec, - } - impl From<&ListHubAppsResponse> for ListHubAppsResponse { - fn from(value: &ListHubAppsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListHubAppsResponseAppsItem { - pub app_id: f64, - pub approved: bool, - pub apps: Vec, - pub id: f64, - pub summary: String, - pub votes: f64, - } - impl From<&ListHubAppsResponseAppsItem> for ListHubAppsResponseAppsItem { - fn from(value: &ListHubAppsResponseAppsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListHubFlowsResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub flows: Vec, - } - impl From<&ListHubFlowsResponse> for ListHubFlowsResponse { - fn from(value: &ListHubFlowsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListHubFlowsResponseFlowsItem { - pub approved: bool, - pub apps: Vec, - pub flow_id: f64, - pub id: f64, - pub summary: String, - pub votes: f64, - } - impl From<&ListHubFlowsResponseFlowsItem> for ListHubFlowsResponseFlowsItem { - fn from(value: &ListHubFlowsResponseFlowsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListHubIntegrationsResponseItem { - pub name: String, - } - impl From<&ListHubIntegrationsResponseItem> for ListHubIntegrationsResponseItem { - fn from(value: &ListHubIntegrationsResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListLogFilesResponseItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub err_lines: Option, - pub file_path: String, - pub hostname: String, - pub json_fmt: bool, - pub log_ts: chrono::DateTime, - pub mode: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ok_lines: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker_group: Option, - } - impl From<&ListLogFilesResponseItem> for ListLogFilesResponseItem { - fn from(value: &ListLogFilesResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListOAuthLoginsResponse { - pub oauth: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub saml: Option, - } - impl From<&ListOAuthLoginsResponse> for ListOAuthLoginsResponse { - fn from(value: &ListOAuthLoginsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListOAuthLoginsResponseOauthItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "type")] - pub type_: String, - } - impl From<&ListOAuthLoginsResponseOauthItem> for ListOAuthLoginsResponseOauthItem { - fn from(value: &ListOAuthLoginsResponseOauthItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListResourceNamesResponseItem { - pub name: String, - pub path: String, - } - impl From<&ListResourceNamesResponseItem> for ListResourceNamesResponseItem { - fn from(value: &ListResourceNamesResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListSearchAppResponseItem { - pub path: String, - pub value: serde_json::Value, - } - impl From<&ListSearchAppResponseItem> for ListSearchAppResponseItem { - fn from(value: &ListSearchAppResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListSearchFlowResponseItem { - pub path: String, - pub value: serde_json::Value, - } - impl From<&ListSearchFlowResponseItem> for ListSearchFlowResponseItem { - fn from(value: &ListSearchFlowResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListSearchResourceResponseItem { - pub path: String, - pub value: serde_json::Value, - } - impl From<&ListSearchResourceResponseItem> for ListSearchResourceResponseItem { - fn from(value: &ListSearchResourceResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListSearchScriptResponseItem { - pub content: String, - pub path: String, - } - impl From<&ListSearchScriptResponseItem> for ListSearchScriptResponseItem { - fn from(value: &ListSearchScriptResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListStoredFilesResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub next_marker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restricted_access: Option, - pub windmill_large_files: Vec, - } - impl From<&ListStoredFilesResponse> for ListStoredFilesResponse { - fn from(value: &ListStoredFilesResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListWorkerGroupsResponseItem { - pub config: serde_json::Value, - pub name: String, - } - impl From<&ListWorkerGroupsResponseItem> for ListWorkerGroupsResponseItem { - fn from(value: &ListWorkerGroupsResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableApp { - pub edited_at: chrono::DateTime, - pub execution_mode: ListableAppExecutionMode, - pub extra_perms: std::collections::HashMap, - pub id: i64, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub starred: Option, - pub summary: String, - pub version: i64, - pub workspace_id: String, - } - impl From<&ListableApp> for ListableApp { - fn from(value: &ListableApp) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ListableAppExecutionMode { - #[serde(rename = "viewer")] - Viewer, - #[serde(rename = "publisher")] - Publisher, - #[serde(rename = "anonymous")] - Anonymous, - } - impl From<&ListableAppExecutionMode> for ListableAppExecutionMode { - fn from(value: &ListableAppExecutionMode) -> Self { - value.clone() - } - } - impl ToString for ListableAppExecutionMode { - fn to_string(&self) -> String { - match *self { - Self::Viewer => "viewer".to_string(), - Self::Publisher => "publisher".to_string(), - Self::Anonymous => "anonymous".to_string(), - } - } - } - impl std::str::FromStr for ListableAppExecutionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "viewer" => Ok(Self::Viewer), - "publisher" => Ok(Self::Publisher), - "anonymous" => Ok(Self::Anonymous), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ListableAppExecutionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ListableAppExecutionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ListableAppExecutionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableRawApp { - pub edited_at: chrono::DateTime, - pub extra_perms: std::collections::HashMap, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub starred: Option, - pub summary: String, - pub version: f64, - pub workspace_id: String, - } - impl From<&ListableRawApp> for ListableRawApp { - fn from(value: &ListableRawApp) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub account: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_expired: Option, - pub is_linked: bool, - pub is_oauth: bool, - pub is_refreshed: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_error: Option, - pub resource_type: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&ListableResource> for ListableResource { - fn from(value: &ListableResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableVariable { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub account: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires_at: Option>, - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_expired: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_linked: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_oauth: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_refreshed: Option, - pub is_secret: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - pub workspace_id: String, - } - impl From<&ListableVariable> for ListableVariable { - fn from(value: &ListableVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LoadTableRowCountResponse { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub count: Option, - } - impl From<&LoadTableRowCountResponse> for LoadTableRowCountResponse { - fn from(value: &LoadTableRowCountResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LogSearchHit { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dancer: Option, - } - impl From<&LogSearchHit> for LogSearchHit { - fn from(value: &LogSearchHit) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Login { - pub email: String, - pub password: String, - } - impl From<&Login> for Login { - fn from(value: &Login) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LoginWithOauthBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub state: Option, - } - impl From<&LoginWithOauthBody> for LoginWithOauthBody { - fn from(value: &LoginWithOauthBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MainArgSignature { - pub args: Vec, - pub error: String, - pub has_preprocessor: Option, - pub no_main_func: Option, - pub star_args: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub star_kwargs: Option, - #[serde(rename = "type")] - pub type_: MainArgSignatureType, - } - impl From<&MainArgSignature> for MainArgSignature { - fn from(value: &MainArgSignature) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MainArgSignatureArgsItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_default: Option, - pub name: String, - pub typ: MainArgSignatureArgsItemTyp, - } - impl From<&MainArgSignatureArgsItem> for MainArgSignatureArgsItem { - fn from(value: &MainArgSignatureArgsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum MainArgSignatureArgsItemTyp { - #[serde(rename = "float")] - Float, - #[serde(rename = "int")] - Int, - #[serde(rename = "bool")] - Bool, - #[serde(rename = "email")] - Email, - #[serde(rename = "unknown")] - Unknown, - #[serde(rename = "bytes")] - Bytes, - #[serde(rename = "dict")] - Dict, - #[serde(rename = "datetime")] - Datetime, - #[serde(rename = "sql")] - Sql, - #[serde(rename = "resource")] - Resource(Option), - #[serde(rename = "str")] - Str(Option>), - #[serde(rename = "object")] - Object(Vec), - #[serde(rename = "list")] - List(MainArgSignatureArgsItemTypList), - } - impl From<&MainArgSignatureArgsItemTyp> for MainArgSignatureArgsItemTyp { - fn from(value: &MainArgSignatureArgsItemTyp) -> Self { - value.clone() - } - } - impl From> for MainArgSignatureArgsItemTyp { - fn from(value: Option) -> Self { - Self::Resource(value) - } - } - impl From>> for MainArgSignatureArgsItemTyp { - fn from(value: Option>) -> Self { - Self::Str(value) - } - } - impl From> - for MainArgSignatureArgsItemTyp { - fn from(value: Vec) -> Self { - Self::Object(value) - } - } - impl From for MainArgSignatureArgsItemTyp { - fn from(value: MainArgSignatureArgsItemTypList) -> Self { - Self::List(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum MainArgSignatureArgsItemTypList { - #[serde(rename = "float")] - Float, - #[serde(rename = "int")] - Int, - #[serde(rename = "bool")] - Bool, - #[serde(rename = "email")] - Email, - #[serde(rename = "unknown")] - Unknown, - #[serde(rename = "bytes")] - Bytes, - #[serde(rename = "dict")] - Dict, - #[serde(rename = "datetime")] - Datetime, - #[serde(rename = "sql")] - Sql, - #[serde(rename = "str")] - Str(serde_json::Value), - } - impl From<&MainArgSignatureArgsItemTypList> for MainArgSignatureArgsItemTypList { - fn from(value: &MainArgSignatureArgsItemTypList) -> Self { - value.clone() - } - } - impl From for MainArgSignatureArgsItemTypList { - fn from(value: serde_json::Value) -> Self { - Self::Str(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MainArgSignatureArgsItemTypObjectItem { - pub key: String, - pub typ: MainArgSignatureArgsItemTypObjectItemTyp, - } - impl From<&MainArgSignatureArgsItemTypObjectItem> - for MainArgSignatureArgsItemTypObjectItem { - fn from(value: &MainArgSignatureArgsItemTypObjectItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum MainArgSignatureArgsItemTypObjectItemTyp { - #[serde(rename = "float")] - Float, - #[serde(rename = "int")] - Int, - #[serde(rename = "bool")] - Bool, - #[serde(rename = "email")] - Email, - #[serde(rename = "unknown")] - Unknown, - #[serde(rename = "bytes")] - Bytes, - #[serde(rename = "dict")] - Dict, - #[serde(rename = "datetime")] - Datetime, - #[serde(rename = "sql")] - Sql, - #[serde(rename = "str")] - Str(serde_json::Value), - } - impl From<&MainArgSignatureArgsItemTypObjectItemTyp> - for MainArgSignatureArgsItemTypObjectItemTyp { - fn from(value: &MainArgSignatureArgsItemTypObjectItemTyp) -> Self { - value.clone() - } - } - impl From for MainArgSignatureArgsItemTypObjectItemTyp { - fn from(value: serde_json::Value) -> Self { - Self::Str(value) - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MainArgSignatureType { - Valid, - Invalid, - } - impl From<&MainArgSignatureType> for MainArgSignatureType { - fn from(value: &MainArgSignatureType) -> Self { - value.clone() - } - } - impl ToString for MainArgSignatureType { - fn to_string(&self) -> String { - match *self { - Self::Valid => "Valid".to_string(), - Self::Invalid => "Invalid".to_string(), - } - } - } - impl std::str::FromStr for MainArgSignatureType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Valid" => Ok(Self::Valid), - "Invalid" => Ok(Self::Invalid), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MainArgSignatureType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MainArgSignatureType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MainArgSignatureType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MetricDataPoint { - pub timestamp: chrono::DateTime, - pub value: f64, - } - impl From<&MetricDataPoint> for MetricDataPoint { - fn from(value: &MetricDataPoint) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MetricMetadata { - pub id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - } - impl From<&MetricMetadata> for MetricMetadata { - fn from(value: &MetricMetadata) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MoveCapturesAndConfigsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub new_path: Option, - } - impl From<&MoveCapturesAndConfigsBody> for MoveCapturesAndConfigsBody { - fn from(value: &MoveCapturesAndConfigsBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MoveCapturesAndConfigsRunnableKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&MoveCapturesAndConfigsRunnableKind> - for MoveCapturesAndConfigsRunnableKind { - fn from(value: &MoveCapturesAndConfigsRunnableKind) -> Self { - value.clone() - } - } - impl ToString for MoveCapturesAndConfigsRunnableKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for MoveCapturesAndConfigsRunnableKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MoveCapturesAndConfigsRunnableKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MoveCapturesAndConfigsRunnableKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MoveCapturesAndConfigsRunnableKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MqttClientVersion { - #[serde(rename = "v3")] - V3, - #[serde(rename = "v5")] - V5, - } - impl From<&MqttClientVersion> for MqttClientVersion { - fn from(value: &MqttClientVersion) -> Self { - value.clone() - } - } - impl ToString for MqttClientVersion { - fn to_string(&self) -> String { - match *self { - Self::V3 => "v3".to_string(), - Self::V5 => "v5".to_string(), - } - } - } - impl std::str::FromStr for MqttClientVersion { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "v3" => Ok(Self::V3), - "v5" => Ok(Self::V5), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MqttClientVersion { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MqttClientVersion { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MqttClientVersion { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MqttQoS { - #[serde(rename = "qos0")] - Qos0, - #[serde(rename = "qos1")] - Qos1, - #[serde(rename = "qos2")] - Qos2, - } - impl From<&MqttQoS> for MqttQoS { - fn from(value: &MqttQoS) -> Self { - value.clone() - } - } - impl ToString for MqttQoS { - fn to_string(&self) -> String { - match *self { - Self::Qos0 => "qos0".to_string(), - Self::Qos1 => "qos1".to_string(), - Self::Qos2 => "qos2".to_string(), - } - } - } - impl std::str::FromStr for MqttQoS { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "qos0" => Ok(Self::Qos0), - "qos1" => Ok(Self::Qos1), - "qos2" => Ok(Self::Qos2), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MqttQoS { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MqttQoS { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MqttQoS { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttSubscribeTopic { - pub qos: MqttQoS, - pub topic: String, - } - impl From<&MqttSubscribeTopic> for MqttSubscribeTopic { - fn from(value: &MqttSubscribeTopic) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_version: Option, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - pub mqtt_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub subscribe_topics: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v3_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v5_config: Option, - } - impl From<&MqttTrigger> for MqttTrigger { - fn from(value: &MqttTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttV3Config { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub clean_session: Option, - } - impl From<&MqttV3Config> for MqttV3Config { - fn from(value: &MqttV3Config) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttV5Config { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub clean_start: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub session_expiry_interval: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub topic_alias: Option, - } - impl From<&MqttV5Config> for MqttV5Config { - fn from(value: &MqttV5Config) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NatsTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub consumer_name: Option, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - pub nats_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stream_name: Option, - pub subjects: Vec, - pub use_jetstream: bool, - } - impl From<&NatsTrigger> for NatsTrigger { - fn from(value: &NatsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewHttpTrigger { - pub http_method: NewHttpTriggerHttpMethod, - pub is_async: bool, - pub is_flow: bool, - pub is_static_website: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_string: Option, - pub requires_auth: bool, - pub route_path: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub static_asset_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_route: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub wrap_body: Option, - } - impl From<&NewHttpTrigger> for NewHttpTrigger { - fn from(value: &NewHttpTrigger) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum NewHttpTriggerHttpMethod { - #[serde(rename = "get")] - Get, - #[serde(rename = "post")] - Post, - #[serde(rename = "put")] - Put, - #[serde(rename = "delete")] - Delete, - #[serde(rename = "patch")] - Patch, - } - impl From<&NewHttpTriggerHttpMethod> for NewHttpTriggerHttpMethod { - fn from(value: &NewHttpTriggerHttpMethod) -> Self { - value.clone() - } - } - impl ToString for NewHttpTriggerHttpMethod { - fn to_string(&self) -> String { - match *self { - Self::Get => "get".to_string(), - Self::Post => "post".to_string(), - Self::Put => "put".to_string(), - Self::Delete => "delete".to_string(), - Self::Patch => "patch".to_string(), - } - } - } - impl std::str::FromStr for NewHttpTriggerHttpMethod { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "get" => Ok(Self::Get), - "post" => Ok(Self::Post), - "put" => Ok(Self::Put), - "delete" => Ok(Self::Delete), - "patch" => Ok(Self::Patch), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for NewHttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for NewHttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for NewHttpTriggerHttpMethod { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewHttpTriggerStaticAssetConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&NewHttpTriggerStaticAssetConfig> for NewHttpTriggerStaticAssetConfig { - fn from(value: &NewHttpTriggerStaticAssetConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewKafkaTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub group_id: String, - pub is_flow: bool, - pub kafka_resource_path: String, - pub path: String, - pub script_path: String, - pub topics: Vec, - } - impl From<&NewKafkaTrigger> for NewKafkaTrigger { - fn from(value: &NewKafkaTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewMqttTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_version: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub is_flow: bool, - pub mqtt_resource_path: String, - pub path: String, - pub script_path: String, - pub subscribe_topics: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v3_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v5_config: Option, - } - impl From<&NewMqttTrigger> for NewMqttTrigger { - fn from(value: &NewMqttTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewNatsTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub consumer_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub is_flow: bool, - pub nats_resource_path: String, - pub path: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stream_name: Option, - pub subjects: Vec, - pub use_jetstream: bool, - } - impl From<&NewNatsTrigger> for NewNatsTrigger { - fn from(value: &NewNatsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewPostgresTrigger { - pub enabled: bool, - pub is_flow: bool, - pub path: String, - pub postgres_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub publication: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub publication_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub replication_slot_name: Option, - pub script_path: String, - } - impl From<&NewPostgresTrigger> for NewPostgresTrigger { - fn from(value: &NewPostgresTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewSchedule { - pub args: ScriptArgs, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_flow_overlap: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_exact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success_extra_args: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub paused_until: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub schedule: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - pub timezone: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&NewSchedule> for NewSchedule { - fn from(value: &NewSchedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewScript { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub codebase: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - pub content: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delete_after_use: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - pub description: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub envs: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_preprocessor: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_template: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - pub language: ScriptLang, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_main_func: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_hash: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restart_unless_cancelled: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - pub summary: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&NewScript> for NewScript { - fn from(value: &NewScript) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum NewScriptKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "failure")] - Failure, - #[serde(rename = "trigger")] - Trigger, - #[serde(rename = "command")] - Command, - #[serde(rename = "approval")] - Approval, - #[serde(rename = "preprocessor")] - Preprocessor, - } - impl From<&NewScriptKind> for NewScriptKind { - fn from(value: &NewScriptKind) -> Self { - value.clone() - } - } - impl ToString for NewScriptKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Failure => "failure".to_string(), - Self::Trigger => "trigger".to_string(), - Self::Command => "command".to_string(), - Self::Approval => "approval".to_string(), - Self::Preprocessor => "preprocessor".to_string(), - } - } - } - impl std::str::FromStr for NewScriptKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "failure" => Ok(Self::Failure), - "trigger" => Ok(Self::Trigger), - "command" => Ok(Self::Command), - "approval" => Ok(Self::Approval), - "preprocessor" => Ok(Self::Preprocessor), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for NewScriptKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for NewScriptKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for NewScriptKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewScriptWithDraft { - #[serde(flatten)] - pub new_script: NewScript, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft: Option, - pub hash: String, - } - impl From<&NewScriptWithDraft> for NewScriptWithDraft { - fn from(value: &NewScriptWithDraft) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewSqsTrigger { - pub aws_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub message_attributes: Vec, - pub path: String, - pub queue_url: String, - pub script_path: String, - } - impl From<&NewSqsTrigger> for NewSqsTrigger { - fn from(value: &NewSqsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewToken { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expiration: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub label: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scopes: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&NewToken> for NewToken { - fn from(value: &NewToken) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewTokenImpersonate { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expiration: Option>, - pub impersonate_email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub label: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&NewTokenImpersonate> for NewTokenImpersonate { - fn from(value: &NewTokenImpersonate) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewWebsocketTrigger { - pub can_return_message: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - pub filters: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub initial_messages: Vec, - pub is_flow: bool, - pub path: String, - pub script_path: String, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&NewWebsocketTrigger> for NewWebsocketTrigger { - fn from(value: &NewWebsocketTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewWebsocketTriggerFiltersItem { - pub key: String, - pub value: serde_json::Value, - } - impl From<&NewWebsocketTriggerFiltersItem> for NewWebsocketTriggerFiltersItem { - fn from(value: &NewWebsocketTriggerFiltersItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ObscuredJob { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub typ: Option, - } - impl From<&ObscuredJob> for ObscuredJob { - fn from(value: &ObscuredJob) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenFlow { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - pub summary: String, - pub value: FlowValue, - } - impl From<&OpenFlow> for OpenFlow { - fn from(value: &OpenFlow) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenFlowWPath { - #[serde(flatten)] - pub open_flow: OpenFlow, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&OpenFlowWPath> for OpenFlowWPath { - fn from(value: &OpenFlowWPath) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OperatorSettings(pub Option); - impl std::ops::Deref for OperatorSettings { - type Target = Option; - fn deref(&self) -> &Option { - &self.0 - } - } - impl From for Option { - fn from(value: OperatorSettings) -> Self { - value.0 - } - } - impl From<&OperatorSettings> for OperatorSettings { - fn from(value: &OperatorSettings) -> Self { - value.clone() - } - } - impl From> for OperatorSettings { - fn from(value: Option) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OperatorSettingsInner { - ///Whether operators can view audit logs - pub audit_logs: bool, - ///Whether operators can view folders page - pub folders: bool, - ///Whether operators can view groups page - pub groups: bool, - ///Whether operators can view resources - pub resources: bool, - ///Whether operators can view runs - pub runs: bool, - ///Whether operators can view schedules - pub schedules: bool, - ///Whether operators can view triggers - pub triggers: bool, - ///Whether operators can view variables - pub variables: bool, - ///Whether operators can view workers page - pub workers: bool, - } - impl From<&OperatorSettingsInner> for OperatorSettingsInner { - fn from(value: &OperatorSettingsInner) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PathFlow { - pub input_transforms: std::collections::HashMap, - pub path: String, - #[serde(rename = "type")] - pub type_: PathFlowType, - } - impl From<&PathFlow> for PathFlow { - fn from(value: &PathFlow) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PathFlowType { - #[serde(rename = "flow")] - Flow, - } - impl From<&PathFlowType> for PathFlowType { - fn from(value: &PathFlowType) -> Self { - value.clone() - } - } - impl ToString for PathFlowType { - fn to_string(&self) -> String { - match *self { - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for PathFlowType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PathFlowType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PathFlowType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PathFlowType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PathScript { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub hash: Option, - pub input_transforms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_trigger: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag_override: Option, - #[serde(rename = "type")] - pub type_: PathScriptType, - } - impl From<&PathScript> for PathScript { - fn from(value: &PathScript) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PathScriptType { - #[serde(rename = "script")] - Script, - } - impl From<&PathScriptType> for PathScriptType { - fn from(value: &PathScriptType) -> Self { - value.clone() - } - } - impl ToString for PathScriptType { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - } - } - } - impl std::str::FromStr for PathScriptType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PathScriptType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PathScriptType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PathScriptType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PingCaptureConfigRunnableKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&PingCaptureConfigRunnableKind> for PingCaptureConfigRunnableKind { - fn from(value: &PingCaptureConfigRunnableKind) -> Self { - value.clone() - } - } - impl ToString for PingCaptureConfigRunnableKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for PingCaptureConfigRunnableKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PingCaptureConfigRunnableKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PingCaptureConfigRunnableKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PingCaptureConfigRunnableKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsClientKwargs { - pub region_name: String, - } - impl From<&PolarsClientKwargs> for PolarsClientKwargs { - fn from(value: &PolarsClientKwargs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsConnectionSettingsBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource: Option, - } - impl From<&PolarsConnectionSettingsBody> for PolarsConnectionSettingsBody { - fn from(value: &PolarsConnectionSettingsBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsConnectionSettingsResponse { - pub cache_regions: bool, - pub client_kwargs: PolarsClientKwargs, - pub endpoint_url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secret: Option, - pub use_ssl: bool, - } - impl From<&PolarsConnectionSettingsResponse> for PolarsConnectionSettingsResponse { - fn from(value: &PolarsConnectionSettingsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsConnectionSettingsV2Body { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - } - impl From<&PolarsConnectionSettingsV2Body> for PolarsConnectionSettingsV2Body { - fn from(value: &PolarsConnectionSettingsV2Body) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsConnectionSettingsV2Response { - pub s3fs_args: PolarsConnectionSettingsV2ResponseS3fsArgs, - pub storage_options: PolarsConnectionSettingsV2ResponseStorageOptions, - } - impl From<&PolarsConnectionSettingsV2Response> - for PolarsConnectionSettingsV2Response { - fn from(value: &PolarsConnectionSettingsV2Response) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsConnectionSettingsV2ResponseS3fsArgs { - pub cache_regions: bool, - pub client_kwargs: PolarsClientKwargs, - pub endpoint_url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secret: Option, - pub use_ssl: bool, - } - impl From<&PolarsConnectionSettingsV2ResponseS3fsArgs> - for PolarsConnectionSettingsV2ResponseS3fsArgs { - fn from(value: &PolarsConnectionSettingsV2ResponseS3fsArgs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsConnectionSettingsV2ResponseStorageOptions { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub aws_access_key_id: Option, - pub aws_allow_http: String, - pub aws_endpoint_url: String, - pub aws_region: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub aws_secret_access_key: Option, - } - impl From<&PolarsConnectionSettingsV2ResponseStorageOptions> - for PolarsConnectionSettingsV2ResponseStorageOptions { - fn from(value: &PolarsConnectionSettingsV2ResponseStorageOptions) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Policy { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub allowed_s3_keys: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub execution_mode: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub s3_inputs: Vec>, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub triggerables: std::collections::HashMap< - String, - std::collections::HashMap, - >, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub triggerables_v2: std::collections::HashMap< - String, - std::collections::HashMap, - >, - } - impl From<&Policy> for Policy { - fn from(value: &Policy) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolicyAllowedS3KeysItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_path: Option, - } - impl From<&PolicyAllowedS3KeysItem> for PolicyAllowedS3KeysItem { - fn from(value: &PolicyAllowedS3KeysItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PolicyExecutionMode { - #[serde(rename = "viewer")] - Viewer, - #[serde(rename = "publisher")] - Publisher, - #[serde(rename = "anonymous")] - Anonymous, - } - impl From<&PolicyExecutionMode> for PolicyExecutionMode { - fn from(value: &PolicyExecutionMode) -> Self { - value.clone() - } - } - impl ToString for PolicyExecutionMode { - fn to_string(&self) -> String { - match *self { - Self::Viewer => "viewer".to_string(), - Self::Publisher => "publisher".to_string(), - Self::Anonymous => "anonymous".to_string(), - } - } - } - impl std::str::FromStr for PolicyExecutionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "viewer" => Ok(Self::Viewer), - "publisher" => Ok(Self::Publisher), - "anonymous" => Ok(Self::Anonymous), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PolicyExecutionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PolicyExecutionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PolicyExecutionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PostgresTrigger { - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - pub postgres_resource_path: String, - pub publication_name: String, - pub replication_slot_name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - } - impl From<&PostgresTrigger> for PostgresTrigger { - fn from(value: &PostgresTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Preview { - pub args: ScriptArgs, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub content: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub language: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - } - impl From<&Preview> for Preview { - fn from(value: &Preview) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PreviewKind { - #[serde(rename = "code")] - Code, - #[serde(rename = "identity")] - Identity, - #[serde(rename = "http")] - Http, - } - impl From<&PreviewKind> for PreviewKind { - fn from(value: &PreviewKind) -> Self { - value.clone() - } - } - impl ToString for PreviewKind { - fn to_string(&self) -> String { - match *self { - Self::Code => "code".to_string(), - Self::Identity => "identity".to_string(), - Self::Http => "http".to_string(), - } - } - } - impl std::str::FromStr for PreviewKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "code" => Ok(Self::Code), - "identity" => Ok(Self::Identity), - "http" => Ok(Self::Http), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PreviewKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PreviewKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PreviewKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PreviewScheduleBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - pub schedule: String, - pub timezone: String, - } - impl From<&PreviewScheduleBody> for PreviewScheduleBody { - fn from(value: &PreviewScheduleBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PublicationData { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub table_to_track: Vec, - pub transaction_to_track: Vec, - } - impl From<&PublicationData> for PublicationData { - fn from(value: &PublicationData) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct QueryHubScriptsResponseItem { - pub app: String, - pub ask_id: f64, - pub id: f64, - pub kind: HubScriptKind, - pub score: f64, - pub summary: String, - pub version_id: f64, - } - impl From<&QueryHubScriptsResponseItem> for QueryHubScriptsResponseItem { - fn from(value: &QueryHubScriptsResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct QueryResourceTypesResponseItem { - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schema: Option, - pub score: f64, - } - impl From<&QueryResourceTypesResponseItem> for QueryResourceTypesResponseItem { - fn from(value: &QueryResourceTypesResponseItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct QueuedJob { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub aggregate_wait_time_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - pub canceled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_reason: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - pub email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_status: Option, - pub id: uuid::Uuid, - pub is_flow_step: bool, - pub job_kind: QueuedJobJobKind, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub language: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub logs: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mem_peak: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_job: Option, - /**The user (u/userfoo) or group (g/groupfoo) whom -the execution of this script will be permissioned_as and by extension its DT_TOKEN. -*/ - pub permissioned_as: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessed: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_flow: Option, - pub running: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scheduled_for: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_hash: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub self_wait_time_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub suspend: Option, - pub tag: String, - pub visible_to_owner: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&QueuedJob> for QueuedJob { - fn from(value: &QueuedJob) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum QueuedJobJobKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "preview")] - Preview, - #[serde(rename = "dependencies")] - Dependencies, - #[serde(rename = "flowdependencies")] - Flowdependencies, - #[serde(rename = "appdependencies")] - Appdependencies, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "flowpreview")] - Flowpreview, - #[serde(rename = "script_hub")] - ScriptHub, - #[serde(rename = "identity")] - Identity, - #[serde(rename = "deploymentcallback")] - Deploymentcallback, - #[serde(rename = "singlescriptflow")] - Singlescriptflow, - #[serde(rename = "flowscript")] - Flowscript, - #[serde(rename = "flownode")] - Flownode, - #[serde(rename = "appscript")] - Appscript, - } - impl From<&QueuedJobJobKind> for QueuedJobJobKind { - fn from(value: &QueuedJobJobKind) -> Self { - value.clone() - } - } - impl ToString for QueuedJobJobKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Preview => "preview".to_string(), - Self::Dependencies => "dependencies".to_string(), - Self::Flowdependencies => "flowdependencies".to_string(), - Self::Appdependencies => "appdependencies".to_string(), - Self::Flow => "flow".to_string(), - Self::Flowpreview => "flowpreview".to_string(), - Self::ScriptHub => "script_hub".to_string(), - Self::Identity => "identity".to_string(), - Self::Deploymentcallback => "deploymentcallback".to_string(), - Self::Singlescriptflow => "singlescriptflow".to_string(), - Self::Flowscript => "flowscript".to_string(), - Self::Flownode => "flownode".to_string(), - Self::Appscript => "appscript".to_string(), - } - } - } - impl std::str::FromStr for QueuedJobJobKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "preview" => Ok(Self::Preview), - "dependencies" => Ok(Self::Dependencies), - "flowdependencies" => Ok(Self::Flowdependencies), - "appdependencies" => Ok(Self::Appdependencies), - "flow" => Ok(Self::Flow), - "flowpreview" => Ok(Self::Flowpreview), - "script_hub" => Ok(Self::ScriptHub), - "identity" => Ok(Self::Identity), - "deploymentcallback" => Ok(Self::Deploymentcallback), - "singlescriptflow" => Ok(Self::Singlescriptflow), - "flowscript" => Ok(Self::Flowscript), - "flownode" => Ok(Self::Flownode), - "appscript" => Ok(Self::Appscript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for QueuedJobJobKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for QueuedJobJobKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for QueuedJobJobKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RawScript { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - pub content: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub custom_concurrency_key: Option, - pub input_transforms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_trigger: Option, - pub language: RawScriptLanguage, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(rename = "type")] - pub type_: RawScriptType, - } - impl From<&RawScript> for RawScript { - fn from(value: &RawScript) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RawScriptForDependencies { - pub language: ScriptLang, - pub path: String, - pub raw_code: String, - } - impl From<&RawScriptForDependencies> for RawScriptForDependencies { - fn from(value: &RawScriptForDependencies) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptLanguage { - #[serde(rename = "deno")] - Deno, - #[serde(rename = "bun")] - Bun, - #[serde(rename = "python3")] - Python3, - #[serde(rename = "go")] - Go, - #[serde(rename = "bash")] - Bash, - #[serde(rename = "powershell")] - Powershell, - #[serde(rename = "postgresql")] - Postgresql, - #[serde(rename = "mysql")] - Mysql, - #[serde(rename = "bigquery")] - Bigquery, - #[serde(rename = "snowflake")] - Snowflake, - #[serde(rename = "mssql")] - Mssql, - #[serde(rename = "oracledb")] - Oracledb, - #[serde(rename = "graphql")] - Graphql, - #[serde(rename = "nativets")] - Nativets, - #[serde(rename = "php")] - Php, - } - impl From<&RawScriptLanguage> for RawScriptLanguage { - fn from(value: &RawScriptLanguage) -> Self { - value.clone() - } - } - impl ToString for RawScriptLanguage { - fn to_string(&self) -> String { - match *self { - Self::Deno => "deno".to_string(), - Self::Bun => "bun".to_string(), - Self::Python3 => "python3".to_string(), - Self::Go => "go".to_string(), - Self::Bash => "bash".to_string(), - Self::Powershell => "powershell".to_string(), - Self::Postgresql => "postgresql".to_string(), - Self::Mysql => "mysql".to_string(), - Self::Bigquery => "bigquery".to_string(), - Self::Snowflake => "snowflake".to_string(), - Self::Mssql => "mssql".to_string(), - Self::Oracledb => "oracledb".to_string(), - Self::Graphql => "graphql".to_string(), - Self::Nativets => "nativets".to_string(), - Self::Php => "php".to_string(), - } - } - } - impl std::str::FromStr for RawScriptLanguage { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "deno" => Ok(Self::Deno), - "bun" => Ok(Self::Bun), - "python3" => Ok(Self::Python3), - "go" => Ok(Self::Go), - "bash" => Ok(Self::Bash), - "powershell" => Ok(Self::Powershell), - "postgresql" => Ok(Self::Postgresql), - "mysql" => Ok(Self::Mysql), - "bigquery" => Ok(Self::Bigquery), - "snowflake" => Ok(Self::Snowflake), - "mssql" => Ok(Self::Mssql), - "oracledb" => Ok(Self::Oracledb), - "graphql" => Ok(Self::Graphql), - "nativets" => Ok(Self::Nativets), - "php" => Ok(Self::Php), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptLanguage { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptLanguage { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptLanguage { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptType { - #[serde(rename = "rawscript")] - Rawscript, - } - impl From<&RawScriptType> for RawScriptType { - fn from(value: &RawScriptType) -> Self { - value.clone() - } - } - impl ToString for RawScriptType { - fn to_string(&self) -> String { - match *self { - Self::Rawscript => "rawscript".to_string(), - } - } - } - impl std::str::FromStr for RawScriptType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "rawscript" => Ok(Self::Rawscript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RefreshTokenBody { - pub path: String, - } - impl From<&RefreshTokenBody> for RefreshTokenBody { - fn from(value: &RefreshTokenBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Relations { - pub schema_name: String, - pub table_to_track: TableToTrack, - } - impl From<&Relations> for Relations { - fn from(value: &Relations) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RemoveGranularAclsBody { - pub owner: String, - } - impl From<&RemoveGranularAclsBody> for RemoveGranularAclsBody { - fn from(value: &RemoveGranularAclsBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RemoveGranularAclsKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "group_")] - Group, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "schedule")] - Schedule, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "folder")] - Folder, - #[serde(rename = "app")] - App, - #[serde(rename = "raw_app")] - RawApp, - #[serde(rename = "http_trigger")] - HttpTrigger, - #[serde(rename = "websocket_trigger")] - WebsocketTrigger, - #[serde(rename = "kafka_trigger")] - KafkaTrigger, - #[serde(rename = "nats_trigger")] - NatsTrigger, - #[serde(rename = "postgres_trigger")] - PostgresTrigger, - #[serde(rename = "mqtt_trigger")] - MqttTrigger, - #[serde(rename = "sqs_trigger")] - SqsTrigger, - } - impl From<&RemoveGranularAclsKind> for RemoveGranularAclsKind { - fn from(value: &RemoveGranularAclsKind) -> Self { - value.clone() - } - } - impl ToString for RemoveGranularAclsKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Group => "group_".to_string(), - Self::Resource => "resource".to_string(), - Self::Schedule => "schedule".to_string(), - Self::Variable => "variable".to_string(), - Self::Flow => "flow".to_string(), - Self::Folder => "folder".to_string(), - Self::App => "app".to_string(), - Self::RawApp => "raw_app".to_string(), - Self::HttpTrigger => "http_trigger".to_string(), - Self::WebsocketTrigger => "websocket_trigger".to_string(), - Self::KafkaTrigger => "kafka_trigger".to_string(), - Self::NatsTrigger => "nats_trigger".to_string(), - Self::PostgresTrigger => "postgres_trigger".to_string(), - Self::MqttTrigger => "mqtt_trigger".to_string(), - Self::SqsTrigger => "sqs_trigger".to_string(), - } - } - } - impl std::str::FromStr for RemoveGranularAclsKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "group_" => Ok(Self::Group), - "resource" => Ok(Self::Resource), - "schedule" => Ok(Self::Schedule), - "variable" => Ok(Self::Variable), - "flow" => Ok(Self::Flow), - "folder" => Ok(Self::Folder), - "app" => Ok(Self::App), - "raw_app" => Ok(Self::RawApp), - "http_trigger" => Ok(Self::HttpTrigger), - "websocket_trigger" => Ok(Self::WebsocketTrigger), - "kafka_trigger" => Ok(Self::KafkaTrigger), - "nats_trigger" => Ok(Self::NatsTrigger), - "postgres_trigger" => Ok(Self::PostgresTrigger), - "mqtt_trigger" => Ok(Self::MqttTrigger), - "sqs_trigger" => Ok(Self::SqsTrigger), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RemoveGranularAclsKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RemoveGranularAclsKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RemoveGranularAclsKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RemoveOwnerToFolderBody { - pub owner: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub write: Option, - } - impl From<&RemoveOwnerToFolderBody> for RemoveOwnerToFolderBody { - fn from(value: &RemoveOwnerToFolderBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RemoveUserFromInstanceGroupBody { - pub email: String, - } - impl From<&RemoveUserFromInstanceGroupBody> for RemoveUserFromInstanceGroupBody { - fn from(value: &RemoveUserFromInstanceGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RemoveUserToGroupBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - } - impl From<&RemoveUserToGroupBody> for RemoveUserToGroupBody { - fn from(value: &RemoveUserToGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Resource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - pub is_oauth: bool, - pub path: String, - pub resource_type: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&Resource> for Resource { - fn from(value: &Resource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ResourceType { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub format_extension: Option, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schema: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&ResourceType> for ResourceType { - fn from(value: &ResourceType) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RestartedFrom { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branch_or_iteration_n: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_job_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub step_id: Option, - } - impl From<&RestartedFrom> for RestartedFrom { - fn from(value: &RestartedFrom) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Retry { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub constant: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub exponential: Option, - } - impl From<&Retry> for Retry { - fn from(value: &Retry) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RetryConstant { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub attempts: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub seconds: Option, - } - impl From<&RetryConstant> for RetryConstant { - fn from(value: &RetryConstant) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RetryExponential { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub attempts: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub multiplier: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub random_factor: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub seconds: Option, - } - impl From<&RetryExponential> for RetryExponential { - fn from(value: &RetryExponential) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RunRawScriptDependenciesBody { - pub entrypoint: String, - pub raw_scripts: Vec, - } - impl From<&RunRawScriptDependenciesBody> for RunRawScriptDependenciesBody { - fn from(value: &RunRawScriptDependenciesBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RunRawScriptDependenciesResponse { - pub lock: String, - } - impl From<&RunRawScriptDependenciesResponse> for RunRawScriptDependenciesResponse { - fn from(value: &RunRawScriptDependenciesResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RunSlackMessageTestJobBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub channel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub hub_script_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub test_msg: Option, - } - impl From<&RunSlackMessageTestJobBody> for RunSlackMessageTestJobBody { - fn from(value: &RunSlackMessageTestJobBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RunTeamsMessageTestJobBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub channel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub hub_script_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub test_msg: Option, - } - impl From<&RunTeamsMessageTestJobBody> for RunTeamsMessageTestJobBody { - fn from(value: &RunTeamsMessageTestJobBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RunnableType { - ScriptHash, - ScriptPath, - FlowPath, - } - impl From<&RunnableType> for RunnableType { - fn from(value: &RunnableType) -> Self { - value.clone() - } - } - impl ToString for RunnableType { - fn to_string(&self) -> String { - match *self { - Self::ScriptHash => "ScriptHash".to_string(), - Self::ScriptPath => "ScriptPath".to_string(), - Self::FlowPath => "FlowPath".to_string(), - } - } - } - impl std::str::FromStr for RunnableType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "ScriptHash" => Ok(Self::ScriptHash), - "ScriptPath" => Ok(Self::ScriptPath), - "FlowPath" => Ok(Self::FlowPath), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RunnableType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RunnableType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RunnableType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct S3Resource { - #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] - pub access_key: Option, - pub bucket: String, - #[serde(rename = "endPoint")] - pub end_point: String, - #[serde(rename = "pathStyle")] - pub path_style: bool, - pub region: String, - #[serde(rename = "secretKey", default, skip_serializing_if = "Option::is_none")] - pub secret_key: Option, - #[serde(rename = "useSSL")] - pub use_ssl: bool, - } - impl From<&S3Resource> for S3Resource { - fn from(value: &S3Resource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct S3ResourceInfoBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - } - impl From<&S3ResourceInfoBody> for S3ResourceInfoBody { - fn from(value: &S3ResourceInfoBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScalarMetric { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub metric_id: Option, - pub value: f64, - } - impl From<&ScalarMetric> for ScalarMetric { - fn from(value: &ScalarMetric) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Schedule { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - pub edited_at: chrono::DateTime, - pub edited_by: String, - pub email: String, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - pub extra_perms: std::collections::HashMap, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_flow_overlap: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_exact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success_extra_args: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub paused_until: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub schedule: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - pub timezone: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&Schedule> for Schedule { - fn from(value: &Schedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScheduleWJobs { - #[serde(flatten)] - pub schedule: Schedule, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub jobs: Vec, - } - impl From<&ScheduleWJobs> for ScheduleWJobs { - fn from(value: &ScheduleWJobs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScheduleWJobsJobsItem { - pub duration_ms: f64, - pub id: String, - pub success: bool, - } - impl From<&ScheduleWJobsJobsItem> for ScheduleWJobsJobsItem { - fn from(value: &ScheduleWJobsJobsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Script { - pub archived: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub codebase: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - pub content: String, - pub created_at: chrono::DateTime, - pub created_by: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delete_after_use: Option, - pub deleted: bool, - pub description: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub envs: Vec, - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_draft: Option, - pub has_preprocessor: bool, - pub hash: String, - pub is_template: bool, - pub kind: ScriptKind, - pub language: ScriptLang, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock_error_logs: Option, - pub no_main_func: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - /**The first element is the direct parent of the script, the second is the parent of the first, etc -*/ - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub parent_hashes: Vec, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restart_unless_cancelled: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - pub starred: bool, - pub summary: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&Script> for Script { - fn from(value: &Script) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScriptArgs(pub std::collections::HashMap); - impl std::ops::Deref for ScriptArgs { - type Target = std::collections::HashMap; - fn deref(&self) -> &std::collections::HashMap { - &self.0 - } - } - impl From for std::collections::HashMap { - fn from(value: ScriptArgs) -> Self { - value.0 - } - } - impl From<&ScriptArgs> for ScriptArgs { - fn from(value: &ScriptArgs) -> Self { - value.clone() - } - } - impl From> for ScriptArgs { - fn from(value: std::collections::HashMap) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScriptHistory { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - pub script_hash: String, - } - impl From<&ScriptHistory> for ScriptHistory { - fn from(value: &ScriptHistory) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ScriptKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "failure")] - Failure, - #[serde(rename = "trigger")] - Trigger, - #[serde(rename = "command")] - Command, - #[serde(rename = "approval")] - Approval, - #[serde(rename = "preprocessor")] - Preprocessor, - } - impl From<&ScriptKind> for ScriptKind { - fn from(value: &ScriptKind) -> Self { - value.clone() - } - } - impl ToString for ScriptKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Failure => "failure".to_string(), - Self::Trigger => "trigger".to_string(), - Self::Command => "command".to_string(), - Self::Approval => "approval".to_string(), - Self::Preprocessor => "preprocessor".to_string(), - } - } - } - impl std::str::FromStr for ScriptKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "failure" => Ok(Self::Failure), - "trigger" => Ok(Self::Trigger), - "command" => Ok(Self::Command), - "approval" => Ok(Self::Approval), - "preprocessor" => Ok(Self::Preprocessor), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ScriptKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ScriptKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ScriptKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ScriptLang { - #[serde(rename = "python3")] - Python3, - #[serde(rename = "deno")] - Deno, - #[serde(rename = "go")] - Go, - #[serde(rename = "bash")] - Bash, - #[serde(rename = "powershell")] - Powershell, - #[serde(rename = "postgresql")] - Postgresql, - #[serde(rename = "mysql")] - Mysql, - #[serde(rename = "bigquery")] - Bigquery, - #[serde(rename = "snowflake")] - Snowflake, - #[serde(rename = "mssql")] - Mssql, - #[serde(rename = "oracledb")] - Oracledb, - #[serde(rename = "graphql")] - Graphql, - #[serde(rename = "nativets")] - Nativets, - #[serde(rename = "bun")] - Bun, - #[serde(rename = "php")] - Php, - #[serde(rename = "rust")] - Rust, - #[serde(rename = "ansible")] - Ansible, - #[serde(rename = "csharp")] - Csharp, - #[serde(rename = "nu")] - Nu, - #[serde(rename = "ruby")] - Ruby, - // for related places search: ADD_NEW_LANG - } - impl From<&ScriptLang> for ScriptLang { - fn from(value: &ScriptLang) -> Self { - value.clone() - } - } - impl ToString for ScriptLang { - fn to_string(&self) -> String { - match *self { - Self::Python3 => "python3".to_string(), - Self::Deno => "deno".to_string(), - Self::Go => "go".to_string(), - Self::Bash => "bash".to_string(), - Self::Powershell => "powershell".to_string(), - Self::Postgresql => "postgresql".to_string(), - Self::Mysql => "mysql".to_string(), - Self::Bigquery => "bigquery".to_string(), - Self::Snowflake => "snowflake".to_string(), - Self::Mssql => "mssql".to_string(), - Self::Oracledb => "oracledb".to_string(), - Self::Graphql => "graphql".to_string(), - Self::Nativets => "nativets".to_string(), - Self::Bun => "bun".to_string(), - Self::Php => "php".to_string(), - Self::Rust => "rust".to_string(), - Self::Ansible => "ansible".to_string(), - Self::Csharp => "csharp".to_string(), - Self::Nu => "nu".to_string(), - Self::Ruby => "ruby".to_string(), - // for related places search: ADD_NEW_LANG - } - } - } - impl std::str::FromStr for ScriptLang { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "python3" => Ok(Self::Python3), - "deno" => Ok(Self::Deno), - "go" => Ok(Self::Go), - "bash" => Ok(Self::Bash), - "powershell" => Ok(Self::Powershell), - "postgresql" => Ok(Self::Postgresql), - "mysql" => Ok(Self::Mysql), - "bigquery" => Ok(Self::Bigquery), - "snowflake" => Ok(Self::Snowflake), - "mssql" => Ok(Self::Mssql), - "oracledb" => Ok(Self::Oracledb), - "graphql" => Ok(Self::Graphql), - "nativets" => Ok(Self::Nativets), - "bun" => Ok(Self::Bun), - "php" => Ok(Self::Php), - "rust" => Ok(Self::Rust), - "ansible" => Ok(Self::Ansible), - "csharp" => Ok(Self::Csharp), - "nu" => Ok(Self::Nu), - "ruby" => Ok(Self::Ruby), - // for related places search: ADD_NEW_LANG - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ScriptLang { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ScriptLang { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ScriptLang { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SearchJobsIndexResponse { - ///the jobs that matched the query - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub hits: Vec, - ///a list of the terms that couldn't be parsed (and thus ignored) - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub query_parse_errors: Vec, - } - impl From<&SearchJobsIndexResponse> for SearchJobsIndexResponse { - fn from(value: &SearchJobsIndexResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SearchJobsIndexResponseQueryParseErrorsItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dancer: Option, - } - impl From<&SearchJobsIndexResponseQueryParseErrorsItem> - for SearchJobsIndexResponseQueryParseErrorsItem { - fn from(value: &SearchJobsIndexResponseQueryParseErrorsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SearchLogsIndexResponse { - ///log files that matched the query - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub hits: Vec, - ///a list of the terms that couldn't be parsed (and thus ignored) - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub query_parse_errors: Vec, - } - impl From<&SearchLogsIndexResponse> for SearchLogsIndexResponse { - fn from(value: &SearchLogsIndexResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SendMessageToConversationBody { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub card_block: std::collections::HashMap, - ///The ID of the Teams conversation/activity - pub conversation_id: String, - ///Used for styling the card conditionally - #[serde(default = "defaults::default_bool::")] - pub success: bool, - ///The message text to be sent in the Teams card - pub text: String, - } - impl From<&SendMessageToConversationBody> for SendMessageToConversationBody { - fn from(value: &SendMessageToConversationBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetAutomaticBillingBody { - pub automatic_billing: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub seats: Option, - } - impl From<&SetAutomaticBillingBody> for SetAutomaticBillingBody { - fn from(value: &SetAutomaticBillingBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetCaptureConfigBody { - pub is_flow: bool, - pub path: String, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub trigger_config: std::collections::HashMap, - pub trigger_kind: CaptureTriggerKind, - } - impl From<&SetCaptureConfigBody> for SetCaptureConfigBody { - fn from(value: &SetCaptureConfigBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetDefaultErrorOrRecoveryHandlerBody { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_args: std::collections::HashMap, - pub handler_type: SetDefaultErrorOrRecoveryHandlerBodyHandlerType, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub number_of_occurence: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub number_of_occurence_exact: Option, - pub override_existing: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_handler_muted: Option, - } - impl From<&SetDefaultErrorOrRecoveryHandlerBody> - for SetDefaultErrorOrRecoveryHandlerBody { - fn from(value: &SetDefaultErrorOrRecoveryHandlerBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - #[serde(rename = "error")] - Error, - #[serde(rename = "recovery")] - Recovery, - #[serde(rename = "success")] - Success, - } - impl From<&SetDefaultErrorOrRecoveryHandlerBodyHandlerType> - for SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - fn from(value: &SetDefaultErrorOrRecoveryHandlerBodyHandlerType) -> Self { - value.clone() - } - } - impl ToString for SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - fn to_string(&self) -> String { - match *self { - Self::Error => "error".to_string(), - Self::Recovery => "recovery".to_string(), - Self::Success => "success".to_string(), - } - } - } - impl std::str::FromStr for SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "error" => Ok(Self::Error), - "recovery" => Ok(Self::Recovery), - "success" => Ok(Self::Success), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> - for SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> - for SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom - for SetDefaultErrorOrRecoveryHandlerBodyHandlerType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetEnvironmentVariableBody { - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&SetEnvironmentVariableBody> for SetEnvironmentVariableBody { - fn from(value: &SetEnvironmentVariableBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetGlobalBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&SetGlobalBody> for SetGlobalBody { - fn from(value: &SetGlobalBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetJobProgressBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_job_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub percent: Option, - } - impl From<&SetJobProgressBody> for SetJobProgressBody { - fn from(value: &SetJobProgressBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetKafkaTriggerEnabledBody { - pub enabled: bool, - } - impl From<&SetKafkaTriggerEnabledBody> for SetKafkaTriggerEnabledBody { - fn from(value: &SetKafkaTriggerEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetLoginTypeForUserBody { - pub login_type: String, - } - impl From<&SetLoginTypeForUserBody> for SetLoginTypeForUserBody { - fn from(value: &SetLoginTypeForUserBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetMqttTriggerEnabledBody { - pub enabled: bool, - } - impl From<&SetMqttTriggerEnabledBody> for SetMqttTriggerEnabledBody { - fn from(value: &SetMqttTriggerEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetNatsTriggerEnabledBody { - pub enabled: bool, - } - impl From<&SetNatsTriggerEnabledBody> for SetNatsTriggerEnabledBody { - fn from(value: &SetNatsTriggerEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetPasswordBody { - pub password: String, - } - impl From<&SetPasswordBody> for SetPasswordBody { - fn from(value: &SetPasswordBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetPasswordForUserBody { - pub password: String, - } - impl From<&SetPasswordForUserBody> for SetPasswordForUserBody { - fn from(value: &SetPasswordForUserBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetPostgresTriggerEnabledBody { - pub enabled: bool, - } - impl From<&SetPostgresTriggerEnabledBody> for SetPostgresTriggerEnabledBody { - fn from(value: &SetPostgresTriggerEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetScheduleEnabledBody { - pub enabled: bool, - } - impl From<&SetScheduleEnabledBody> for SetScheduleEnabledBody { - fn from(value: &SetScheduleEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetSqsTriggerEnabledBody { - pub enabled: bool, - } - impl From<&SetSqsTriggerEnabledBody> for SetSqsTriggerEnabledBody { - fn from(value: &SetSqsTriggerEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetThresholdAlertBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub threshold_alert_amount: Option, - } - impl From<&SetThresholdAlertBody> for SetThresholdAlertBody { - fn from(value: &SetThresholdAlertBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetWebsocketTriggerEnabledBody { - pub enabled: bool, - } - impl From<&SetWebsocketTriggerEnabledBody> for SetWebsocketTriggerEnabledBody { - fn from(value: &SetWebsocketTriggerEnabledBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SetWorkspaceEncryptionKeyBody { - pub new_key: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_reencrypt: Option, - } - impl From<&SetWorkspaceEncryptionKeyBody> for SetWorkspaceEncryptionKeyBody { - fn from(value: &SetWorkspaceEncryptionKeyBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SlackToken { - pub access_token: String, - pub bot: SlackTokenBot, - pub team_id: String, - pub team_name: String, - } - impl From<&SlackToken> for SlackToken { - fn from(value: &SlackToken) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SlackTokenBot { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub bot_access_token: Option, - } - impl From<&SlackTokenBot> for SlackTokenBot { - fn from(value: &SlackTokenBot) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Slot { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - } - impl From<&Slot> for Slot { - fn from(value: &Slot) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SlotList { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub active: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slot_name: Option, - } - impl From<&SlotList> for SlotList { - fn from(value: &SlotList) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SqsTrigger { - pub aws_resource_path: String, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub message_attributes: Vec, - pub queue_url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - } - impl From<&SqsTrigger> for SqsTrigger { - fn from(value: &SqsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct StarBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub favorite_kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - } - impl From<&StarBody> for StarBody { - fn from(value: &StarBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum StarBodyFavoriteKind { - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - #[serde(rename = "script")] - Script, - #[serde(rename = "raw_app")] - RawApp, - } - impl From<&StarBodyFavoriteKind> for StarBodyFavoriteKind { - fn from(value: &StarBodyFavoriteKind) -> Self { - value.clone() - } - } - impl ToString for StarBodyFavoriteKind { - fn to_string(&self) -> String { - match *self { - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - Self::Script => "script".to_string(), - Self::RawApp => "raw_app".to_string(), - } - } - } - impl std::str::FromStr for StarBodyFavoriteKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - "script" => Ok(Self::Script), - "raw_app" => Ok(Self::RawApp), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for StarBodyFavoriteKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for StarBodyFavoriteKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for StarBodyFavoriteKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct StaticTransform { - #[serde(rename = "type")] - pub type_: StaticTransformType, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&StaticTransform> for StaticTransform { - fn from(value: &StaticTransform) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum StaticTransformType { - #[serde(rename = "javascript")] - Javascript, - } - impl From<&StaticTransformType> for StaticTransformType { - fn from(value: &StaticTransformType) -> Self { - value.clone() - } - } - impl ToString for StaticTransformType { - fn to_string(&self) -> String { - match *self { - Self::Javascript => "javascript".to_string(), - } - } - } - impl std::str::FromStr for StaticTransformType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "javascript" => Ok(Self::Javascript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for StaticTransformType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for StaticTransformType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for StaticTransformType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TableToTrack(pub Vec); - impl std::ops::Deref for TableToTrack { - type Target = Vec; - fn deref(&self) -> &Vec { - &self.0 - } - } - impl From for Vec { - fn from(value: TableToTrack) -> Self { - value.0 - } - } - impl From<&TableToTrack> for TableToTrack { - fn from(value: &TableToTrack) -> Self { - value.clone() - } - } - impl From> for TableToTrack { - fn from(value: Vec) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TableToTrackItem { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub columns_name: Vec, - pub table_name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub where_clause: Option, - } - impl From<&TableToTrackItem> for TableToTrackItem { - fn from(value: &TableToTrackItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TeamInfo { - ///List of channels within the team - pub channels: Vec, - ///The unique identifier of the Microsoft Teams team - pub team_id: String, - ///The display name of the Microsoft Teams team - pub team_name: String, - } - impl From<&TeamInfo> for TeamInfo { - fn from(value: &TeamInfo) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TemplateScript { - pub language: Language, - pub postgres_resource_path: String, - pub relations: Vec, - } - impl From<&TemplateScript> for TemplateScript { - fn from(value: &TemplateScript) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestCriticalChannelsBodyItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slack_channel: Option, - } - impl From<&TestCriticalChannelsBodyItem> for TestCriticalChannelsBodyItem { - fn from(value: &TestCriticalChannelsBodyItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestKafkaConnectionBody { - pub connection: std::collections::HashMap, - } - impl From<&TestKafkaConnectionBody> for TestKafkaConnectionBody { - fn from(value: &TestKafkaConnectionBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestLicenseKeyBody { - pub license_key: String, - } - impl From<&TestLicenseKeyBody> for TestLicenseKeyBody { - fn from(value: &TestLicenseKeyBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestMqttConnectionBody { - pub connection: std::collections::HashMap, - } - impl From<&TestMqttConnectionBody> for TestMqttConnectionBody { - fn from(value: &TestMqttConnectionBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestNatsConnectionBody { - pub connection: std::collections::HashMap, - } - impl From<&TestNatsConnectionBody> for TestNatsConnectionBody { - fn from(value: &TestNatsConnectionBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestPostgresConnectionBody { - pub database: String, - } - impl From<&TestPostgresConnectionBody> for TestPostgresConnectionBody { - fn from(value: &TestPostgresConnectionBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestSmtpBody { - pub smtp: TestSmtpBodySmtp, - pub to: String, - } - impl From<&TestSmtpBody> for TestSmtpBody { - fn from(value: &TestSmtpBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestSmtpBodySmtp { - pub disable_tls: bool, - pub from: String, - pub host: String, - pub password: String, - pub port: i64, - pub tls_implicit: bool, - pub username: String, - } - impl From<&TestSmtpBodySmtp> for TestSmtpBodySmtp { - fn from(value: &TestSmtpBodySmtp) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestSqsConnectionBody { - pub connection: std::collections::HashMap, - } - impl From<&TestSqsConnectionBody> for TestSqsConnectionBody { - fn from(value: &TestSqsConnectionBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TestWebsocketConnectionBody { - pub can_return_message: bool, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&TestWebsocketConnectionBody> for TestWebsocketConnectionBody { - fn from(value: &TestWebsocketConnectionBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TimeseriesMetric { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub metric_id: Option, - pub values: Vec, - } - impl From<&TimeseriesMetric> for TimeseriesMetric { - fn from(value: &TimeseriesMetric) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ToggleWorkspaceErrorHandlerForFlowBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub muted: Option, - } - impl From<&ToggleWorkspaceErrorHandlerForFlowBody> - for ToggleWorkspaceErrorHandlerForFlowBody { - fn from(value: &ToggleWorkspaceErrorHandlerForFlowBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ToggleWorkspaceErrorHandlerForScriptBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub muted: Option, - } - impl From<&ToggleWorkspaceErrorHandlerForScriptBody> - for ToggleWorkspaceErrorHandlerForScriptBody { - fn from(value: &ToggleWorkspaceErrorHandlerForScriptBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TokenResponse { - pub access_token: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires_in: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_token: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scope: Vec, - } - impl From<&TokenResponse> for TokenResponse { - fn from(value: &TokenResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TriggerExtraProperty { - pub edited_at: chrono::DateTime, - pub edited_by: String, - pub email: String, - pub extra_perms: std::collections::HashMap, - pub is_flow: bool, - pub path: String, - pub script_path: String, - pub workspace_id: String, - } - impl From<&TriggerExtraProperty> for TriggerExtraProperty { - fn from(value: &TriggerExtraProperty) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TriggersCount { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub http_routes_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kafka_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mqtt_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub nats_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub postgres_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub primary_schedule: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sqs_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub webhook_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub websocket_count: Option, - } - impl From<&TriggersCount> for TriggersCount { - fn from(value: &TriggersCount) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TriggersCountPrimarySchedule { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule: Option, - } - impl From<&TriggersCountPrimarySchedule> for TriggersCountPrimarySchedule { - fn from(value: &TriggersCountPrimarySchedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TruncatedToken { - pub created_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expiration: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub label: Option, - pub last_used_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scopes: Vec, - pub token_prefix: String, - } - impl From<&TruncatedToken> for TruncatedToken { - fn from(value: &TruncatedToken) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UnstarBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub favorite_kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - } - impl From<&UnstarBody> for UnstarBody { - fn from(value: &UnstarBody) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum UnstarBodyFavoriteKind { - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - #[serde(rename = "script")] - Script, - #[serde(rename = "raw_app")] - RawApp, - } - impl From<&UnstarBodyFavoriteKind> for UnstarBodyFavoriteKind { - fn from(value: &UnstarBodyFavoriteKind) -> Self { - value.clone() - } - } - impl ToString for UnstarBodyFavoriteKind { - fn to_string(&self) -> String { - match *self { - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - Self::Script => "script".to_string(), - Self::RawApp => "raw_app".to_string(), - } - } - } - impl std::str::FromStr for UnstarBodyFavoriteKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - "script" => Ok(Self::Script), - "raw_app" => Ok(Self::RawApp), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for UnstarBodyFavoriteKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for UnstarBodyFavoriteKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for UnstarBodyFavoriteKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateAppBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub custom_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub policy: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&UpdateAppBody> for UpdateAppBody { - fn from(value: &UpdateAppBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateAppHistoryBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - } - impl From<&UpdateAppHistoryBody> for UpdateAppHistoryBody { - fn from(value: &UpdateAppHistoryBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateFlowBody { - #[serde(flatten)] - pub open_flow_w_path: OpenFlowWPath, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - } - impl From<&UpdateFlowBody> for UpdateFlowBody { - fn from(value: &UpdateFlowBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateFlowHistoryBody { - pub deployment_msg: String, - } - impl From<&UpdateFlowHistoryBody> for UpdateFlowHistoryBody { - fn from(value: &UpdateFlowHistoryBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateFolderBody { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub owners: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&UpdateFolderBody> for UpdateFolderBody { - fn from(value: &UpdateFolderBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateGroupBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&UpdateGroupBody> for UpdateGroupBody { - fn from(value: &UpdateGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateInput { - pub id: String, - pub is_public: bool, - pub name: String, - } - impl From<&UpdateInput> for UpdateInput { - fn from(value: &UpdateInput) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateInstanceGroupBody { - pub new_summary: String, - } - impl From<&UpdateInstanceGroupBody> for UpdateInstanceGroupBody { - fn from(value: &UpdateInstanceGroupBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateRawAppBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&UpdateRawAppBody> for UpdateRawAppBody { - fn from(value: &UpdateRawAppBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateResourceValueBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&UpdateResourceValueBody> for UpdateResourceValueBody { - fn from(value: &UpdateResourceValueBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateScriptHistoryBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - } - impl From<&UpdateScriptHistoryBody> for UpdateScriptHistoryBody { - fn from(value: &UpdateScriptHistoryBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateTutorialProgressBody { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub progress: Option, - } - impl From<&UpdateTutorialProgressBody> for UpdateTutorialProgressBody { - fn from(value: &UpdateTutorialProgressBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UploadFilePart { - pub part_number: i64, - pub tag: String, - } - impl From<&UploadFilePart> for UploadFilePart { - fn from(value: &UploadFilePart) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UploadS3FileFromAppResponse { - pub delete_token: String, - pub file_key: String, - } - impl From<&UploadS3FileFromAppResponse> for UploadS3FileFromAppResponse { - fn from(value: &UploadS3FileFromAppResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct User { - pub created_at: chrono::DateTime, - pub disabled: bool, - pub email: String, - pub folders: Vec, - pub folders_owners: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub groups: Vec, - pub is_admin: bool, - pub is_super_admin: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - pub operator: bool, - pub username: String, - } - impl From<&User> for User { - fn from(value: &User) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub executions: Option, - } - impl From<&UserUsage> for UserUsage { - fn from(value: &UserUsage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserWorkspaceList { - pub email: String, - pub workspaces: Vec, - } - impl From<&UserWorkspaceList> for UserWorkspaceList { - fn from(value: &UserWorkspaceList) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserWorkspaceListWorkspacesItem { - pub color: String, - pub id: String, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator_settings: Option, - pub username: String, - } - impl From<&UserWorkspaceListWorkspacesItem> for UserWorkspaceListWorkspacesItem { - fn from(value: &UserWorkspaceListWorkspacesItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WebsocketTrigger { - pub can_return_message: bool, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - pub filters: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub initial_messages: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&WebsocketTrigger> for WebsocketTrigger { - fn from(value: &WebsocketTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WebsocketTriggerFiltersItem { - pub key: String, - pub value: serde_json::Value, - } - impl From<&WebsocketTriggerFiltersItem> for WebsocketTriggerFiltersItem { - fn from(value: &WebsocketTriggerFiltersItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum WebsocketTriggerInitialMessage { - #[serde(rename = "raw_message")] - RawMessage(String), - #[serde(rename = "runnable_result")] - RunnableResult { args: ScriptArgs, is_flow: bool, path: String }, - } - impl From<&WebsocketTriggerInitialMessage> for WebsocketTriggerInitialMessage { - fn from(value: &WebsocketTriggerInitialMessage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WhileloopFlow { - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallelism: Option, - pub skip_failures: bool, - #[serde(rename = "type")] - pub type_: WhileloopFlowType, - } - impl From<&WhileloopFlow> for WhileloopFlow { - fn from(value: &WhileloopFlow) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WhileloopFlowType { - #[serde(rename = "forloopflow")] - Forloopflow, - } - impl From<&WhileloopFlowType> for WhileloopFlowType { - fn from(value: &WhileloopFlowType) -> Self { - value.clone() - } - } - impl ToString for WhileloopFlowType { - fn to_string(&self) -> String { - match *self { - Self::Forloopflow => "forloopflow".to_string(), - } - } - } - impl std::str::FromStr for WhileloopFlowType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "forloopflow" => Ok(Self::Forloopflow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WhileloopFlowType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WhileloopFlowType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WhileloopFlowType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WindmillFileMetadata { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_modified: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub size_in_bytes: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub version_id: Option, - } - impl From<&WindmillFileMetadata> for WindmillFileMetadata { - fn from(value: &WindmillFileMetadata) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WindmillFilePreview { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub content: Option, - pub content_type: WindmillFilePreviewContentType, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub msg: Option, - } - impl From<&WindmillFilePreview> for WindmillFilePreview { - fn from(value: &WindmillFilePreview) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WindmillFilePreviewContentType { - RawText, - Csv, - Parquet, - Unknown, - } - impl From<&WindmillFilePreviewContentType> for WindmillFilePreviewContentType { - fn from(value: &WindmillFilePreviewContentType) -> Self { - value.clone() - } - } - impl ToString for WindmillFilePreviewContentType { - fn to_string(&self) -> String { - match *self { - Self::RawText => "RawText".to_string(), - Self::Csv => "Csv".to_string(), - Self::Parquet => "Parquet".to_string(), - Self::Unknown => "Unknown".to_string(), - } - } - } - impl std::str::FromStr for WindmillFilePreviewContentType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "RawText" => Ok(Self::RawText), - "Csv" => Ok(Self::Csv), - "Parquet" => Ok(Self::Parquet), - "Unknown" => Ok(Self::Unknown), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WindmillFilePreviewContentType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WindmillFilePreviewContentType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WindmillFilePreviewContentType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WindmillLargeFile { - pub s3: String, - } - impl From<&WindmillLargeFile> for WindmillLargeFile { - fn from(value: &WindmillLargeFile) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkerPing { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub custom_tags: Vec, - pub ip: String, - pub jobs_executed: i64, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_job_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_job_workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_ping: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub memory: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub memory_usage: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate_15s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate_30m: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate_5m: Option, - pub started_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub vcpus: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub wm_memory_usage: Option, - pub wm_version: String, - pub worker: String, - pub worker_group: String, - pub worker_instance: String, - } - impl From<&WorkerPing> for WorkerPing { - fn from(value: &WorkerPing) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkflowStatus { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scheduled_for: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started_at: Option>, - } - impl From<&WorkflowStatus> for WorkflowStatus { - fn from(value: &WorkflowStatus) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkflowStatusRecord( - pub std::collections::HashMap, - ); - impl std::ops::Deref for WorkflowStatusRecord { - type Target = std::collections::HashMap; - fn deref(&self) -> &std::collections::HashMap { - &self.0 - } - } - impl From - for std::collections::HashMap { - fn from(value: WorkflowStatusRecord) -> Self { - value.0 - } - } - impl From<&WorkflowStatusRecord> for WorkflowStatusRecord { - fn from(value: &WorkflowStatusRecord) -> Self { - value.clone() - } - } - impl From> - for WorkflowStatusRecord { - fn from(value: std::collections::HashMap) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkflowTask { - pub args: ScriptArgs, - } - impl From<&WorkflowTask> for WorkflowTask { - fn from(value: &WorkflowTask) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Workspace { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub domain: Option, - pub id: String, - pub name: String, - pub owner: String, - } - impl From<&Workspace> for Workspace { - fn from(value: &Workspace) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceDefaultScripts { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub default_script_content: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub hidden: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub order: Vec, - } - impl From<&WorkspaceDefaultScripts> for WorkspaceDefaultScripts { - fn from(value: &WorkspaceDefaultScripts) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceDeployUiSettings { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_path: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_type: Vec, - } - impl From<&WorkspaceDeployUiSettings> for WorkspaceDeployUiSettings { - fn from(value: &WorkspaceDeployUiSettings) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WorkspaceDeployUiSettingsIncludeTypeItem { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "secret")] - Secret, - #[serde(rename = "trigger")] - Trigger, - } - impl From<&WorkspaceDeployUiSettingsIncludeTypeItem> - for WorkspaceDeployUiSettingsIncludeTypeItem { - fn from(value: &WorkspaceDeployUiSettingsIncludeTypeItem) -> Self { - value.clone() - } - } - impl ToString for WorkspaceDeployUiSettingsIncludeTypeItem { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - Self::Resource => "resource".to_string(), - Self::Variable => "variable".to_string(), - Self::Secret => "secret".to_string(), - Self::Trigger => "trigger".to_string(), - } - } - } - impl std::str::FromStr for WorkspaceDeployUiSettingsIncludeTypeItem { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - "resource" => Ok(Self::Resource), - "variable" => Ok(Self::Variable), - "secret" => Ok(Self::Secret), - "trigger" => Ok(Self::Trigger), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WorkspaceDeployUiSettingsIncludeTypeItem { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WorkspaceDeployUiSettingsIncludeTypeItem { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WorkspaceDeployUiSettingsIncludeTypeItem { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceGetCriticalAlertsResponse { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub alerts: Vec, - ///Total number of pages based on the page size. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub total_pages: Option, - ///Total number of rows matching the query. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub total_rows: Option, - } - impl From<&WorkspaceGetCriticalAlertsResponse> - for WorkspaceGetCriticalAlertsResponse { - fn from(value: &WorkspaceGetCriticalAlertsResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceGitSyncSettings { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_path: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_type: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub repositories: Vec, - } - impl From<&WorkspaceGitSyncSettings> for WorkspaceGitSyncSettings { - fn from(value: &WorkspaceGitSyncSettings) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WorkspaceGitSyncSettingsIncludeTypeItem { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - #[serde(rename = "folder")] - Folder, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "secret")] - Secret, - #[serde(rename = "resourcetype")] - Resourcetype, - #[serde(rename = "schedule")] - Schedule, - #[serde(rename = "user")] - User, - #[serde(rename = "group")] - Group, - } - impl From<&WorkspaceGitSyncSettingsIncludeTypeItem> - for WorkspaceGitSyncSettingsIncludeTypeItem { - fn from(value: &WorkspaceGitSyncSettingsIncludeTypeItem) -> Self { - value.clone() - } - } - impl ToString for WorkspaceGitSyncSettingsIncludeTypeItem { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - Self::Folder => "folder".to_string(), - Self::Resource => "resource".to_string(), - Self::Variable => "variable".to_string(), - Self::Secret => "secret".to_string(), - Self::Resourcetype => "resourcetype".to_string(), - Self::Schedule => "schedule".to_string(), - Self::User => "user".to_string(), - Self::Group => "group".to_string(), - } - } - } - impl std::str::FromStr for WorkspaceGitSyncSettingsIncludeTypeItem { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - "folder" => Ok(Self::Folder), - "resource" => Ok(Self::Resource), - "variable" => Ok(Self::Variable), - "secret" => Ok(Self::Secret), - "resourcetype" => Ok(Self::Resourcetype), - "schedule" => Ok(Self::Schedule), - "user" => Ok(Self::User), - "group" => Ok(Self::Group), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WorkspaceGitSyncSettingsIncludeTypeItem { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WorkspaceGitSyncSettingsIncludeTypeItem { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WorkspaceGitSyncSettingsIncludeTypeItem { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceInvite { - pub email: String, - pub is_admin: bool, - pub operator: bool, - pub workspace_id: String, - } - impl From<&WorkspaceInvite> for WorkspaceInvite { - fn from(value: &WorkspaceInvite) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceMuteCriticalAlertsUiBody { - ///Whether critical alerts should be muted. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mute_critical_alerts: Option, - } - impl From<&WorkspaceMuteCriticalAlertsUiBody> for WorkspaceMuteCriticalAlertsUiBody { - fn from(value: &WorkspaceMuteCriticalAlertsUiBody) -> Self { - value.clone() - } - } - pub mod defaults { - pub(super) fn default_bool() -> bool { - V - } - } -} -#[derive(Clone, Debug)] -/**Client for Windmill API - -Version: 1.478.1*/ -pub struct Client { - pub(crate) baseurl: String, - pub(crate) client: reqwest::Client, -} -impl Client { - /// Create a new client. - /// - /// `baseurl` is the base URL provided to the internal - /// `reqwest::Client`, and should include a scheme and hostname, - /// as well as port and a path stem if applicable. - pub fn new(baseurl: &str) -> Self { - #[cfg(not(target_arch = "wasm32"))] - let client = { - let dur = std::time::Duration::from_secs(15); - reqwest::ClientBuilder::new().connect_timeout(dur).timeout(dur) - }; - #[cfg(target_arch = "wasm32")] - let client = reqwest::ClientBuilder::new(); - Self::new_with_client(baseurl, client.build().unwrap()) - } - /// Construct a new client with an existing `reqwest::Client`, - /// allowing more control over its configuration. - /// - /// `baseurl` is the base URL provided to the internal - /// `reqwest::Client`, and should include a scheme and hostname, - /// as well as port and a path stem if applicable. - pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self { - Self { - baseurl: baseurl.to_string(), - client, - } - } - /// Get the base URL to which requests are made. - pub fn baseurl(&self) -> &String { - &self.baseurl - } - /// Get the internal `reqwest::Client` used to make requests. - pub fn client(&self) -> &reqwest::Client { - &self.client - } - /// Get the version of this API. - /// - /// This string is pulled directly from the source OpenAPI - /// document and may be in any format the API selects. - pub fn api_version(&self) -> &'static str { - "1.478.1" - } -} -impl Client { - /**get backend version - -Sends a `GET` request to `/version` - -*/ - pub async fn backend_version<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/version", self.baseurl,); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**is backend up to date - -Sends a `GET` request to `/uptodate` - -*/ - pub async fn backend_uptodate<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/uptodate", self.baseurl,); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get license id - -Sends a `GET` request to `/ee_license` - -*/ - pub async fn get_license_id<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/ee_license", self.baseurl,); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get openapi yaml spec - -Sends a `GET` request to `/openapi.yaml` - -*/ - pub async fn get_open_api_yaml<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/openapi.yaml", self.baseurl,); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get audit log (requires admin privilege) - -Sends a `GET` request to `/w/{workspace}/audit/get/{id}` - -*/ - pub async fn get_audit_log<'a>( - &'a self, - workspace: &'a str, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/audit/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list audit logs (requires admin privilege) - -Sends a `GET` request to `/w/{workspace}/audit/list` - -Arguments: -- `workspace` -- `action_kind`: filter on type of operation -- `after`: filter on created after (exclusive) timestamp -- `all_workspaces`: get audit logs for all workspaces -- `before`: filter on started before (inclusive) timestamp -- `exclude_operations`: comma separated list of operations to exclude -- `operation`: filter on exact or prefix name of operation -- `operations`: comma separated list of exact operations to include -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -- `resource`: filter on exact or prefix name of resource -- `username`: filter on exact username of user -*/ - pub async fn list_audit_logs<'a>( - &'a self, - workspace: &'a str, - action_kind: Option, - after: Option<&'a chrono::DateTime>, - all_workspaces: Option, - before: Option<&'a chrono::DateTime>, - exclude_operations: Option<&'a str>, - operation: Option<&'a str>, - operations: Option<&'a str>, - page: Option, - per_page: Option, - resource: Option<&'a str>, - username: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/audit/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(11usize); - if let Some(v) = &action_kind { - query.push(("action_kind", v.to_string())); - } - if let Some(v) = &after { - query.push(("after", v.to_string())); - } - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - if let Some(v) = &before { - query.push(("before", v.to_string())); - } - if let Some(v) = &exclude_operations { - query.push(("exclude_operations", v.to_string())); - } - if let Some(v) = &operation { - query.push(("operation", v.to_string())); - } - if let Some(v) = &operations { - query.push(("operations", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &resource { - query.push(("resource", v.to_string())); - } - if let Some(v) = &username { - query.push(("username", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**login with password - -Sends a `POST` request to `/auth/login` - -Arguments: -- `body`: credentials -*/ - pub async fn login<'a>( - &'a self, - body: &'a types::Login, - ) -> Result, Error<()>> { - let url = format!("{}/auth/login", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**logout - -Sends a `POST` request to `/auth/logout` - -*/ - pub async fn logout<'a>(&'a self) -> Result, Error<()>> { - let url = format!("{}/auth/logout", self.baseurl,); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get user (require admin privilege) - -Sends a `GET` request to `/w/{workspace}/users/get/{username}` - -*/ - pub async fn get_user<'a>( - &'a self, - workspace: &'a str, - username: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& username.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update user (require admin privilege) - -Sends a `POST` request to `/w/{workspace}/users/update/{username}` - -Arguments: -- `workspace` -- `username` -- `body`: new user -*/ - pub async fn update_user<'a>( - &'a self, - workspace: &'a str, - username: &'a str, - body: &'a types::EditWorkspaceUser, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& username.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**is owner of path - -Sends a `GET` request to `/w/{workspace}/users/is_owner/{path}` - -*/ - pub async fn is_owner_of_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/is_owner/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set password - -Sends a `POST` request to `/users/setpassword` - -Arguments: -- `body`: set password -*/ - pub async fn set_password<'a>( - &'a self, - body: &'a types::SetPasswordBody, - ) -> Result, Error<()>> { - let url = format!("{}/users/setpassword", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set password for a specific user (require super admin) - -Sends a `POST` request to `/users/set_password_of/{user}` - -Arguments: -- `user` -- `body`: set password -*/ - pub async fn set_password_for_user<'a>( - &'a self, - user: &'a str, - body: &'a types::SetPasswordForUserBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/set_password_of/{}", self.baseurl, encode_path(& user.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set login type for a specific user (require super admin) - -Sends a `POST` request to `/users/set_login_type/{user}` - -Arguments: -- `user` -- `body`: set login type -*/ - pub async fn set_login_type_for_user<'a>( - &'a self, - user: &'a str, - body: &'a types::SetLoginTypeForUserBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/set_login_type/{}", self.baseurl, encode_path(& user.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create user - -Sends a `POST` request to `/users/create` - -Arguments: -- `body`: user info -*/ - pub async fn create_user_globally<'a>( - &'a self, - body: &'a types::CreateUserGloballyBody, - ) -> Result, Error<()>> { - let url = format!("{}/users/create", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**global update user (require super admin) - -Sends a `POST` request to `/users/update/{email}` - -Arguments: -- `email` -- `body`: new user info -*/ - pub async fn global_user_update<'a>( - &'a self, - email: &'a str, - body: &'a types::GlobalUserUpdateBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/update/{}", self.baseurl, encode_path(& email.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**global username info (require super admin) - -Sends a `GET` request to `/users/username_info/{email}` - -*/ - pub async fn global_username_info<'a>( - &'a self, - email: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/username_info/{}", self.baseurl, encode_path(& email.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**global rename user (require super admin) - -Sends a `POST` request to `/users/rename/{email}` - -Arguments: -- `email` -- `body`: new username -*/ - pub async fn global_user_rename<'a>( - &'a self, - email: &'a str, - body: &'a types::GlobalUserRenameBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/rename/{}", self.baseurl, encode_path(& email.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**global delete user (require super admin) - -Sends a `DELETE` request to `/users/delete/{email}` - -*/ - pub async fn global_user_delete<'a>( - &'a self, - email: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/delete/{}", self.baseurl, encode_path(& email.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**global overwrite users (require super admin and EE) - -Sends a `POST` request to `/users/overwrite` - -Arguments: -- `body`: List of users -*/ - pub async fn global_users_overwrite<'a>( - &'a self, - body: &'a Vec, - ) -> Result, Error<()>> { - let url = format!("{}/users/overwrite", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**global export users (require super admin and EE) - -Sends a `GET` request to `/users/export` - -*/ - pub async fn global_users_export<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/users/export", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete user (require admin privilege) - -Sends a `DELETE` request to `/w/{workspace}/users/delete/{username}` - -*/ - pub async fn delete_user<'a>( - &'a self, - workspace: &'a str, - username: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& username.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all workspaces visible to me - -Sends a `GET` request to `/workspaces/list` - -*/ - pub async fn list_workspaces<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/workspaces/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**is domain allowed for auto invi - -Sends a `GET` request to `/workspaces/allowed_domain_auto_invite` - -*/ - pub async fn is_domain_allowed<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/workspaces/allowed_domain_auto_invite", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all workspaces visible to me with user info - -Sends a `GET` request to `/workspaces/users` - -*/ - pub async fn list_user_workspaces<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/workspaces/users", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all workspaces as super admin (require to be super admin) - -Sends a `GET` request to `/workspaces/list_as_superadmin` - -Arguments: -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_workspaces_as_super_admin<'a>( - &'a self, - page: Option, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!("{}/workspaces/list_as_superadmin", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create workspace - -Sends a `POST` request to `/workspaces/create` - -Arguments: -- `body`: new token -*/ - pub async fn create_workspace<'a>( - &'a self, - body: &'a types::CreateWorkspace, - ) -> Result, Error<()>> { - let url = format!("{}/workspaces/create", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists workspace - -Sends a `POST` request to `/workspaces/exists` - -Arguments: -- `body`: id of workspace -*/ - pub async fn exists_workspace<'a>( - &'a self, - body: &'a types::ExistsWorkspaceBody, - ) -> Result, Error<()>> { - let url = format!("{}/workspaces/exists", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists username - -Sends a `POST` request to `/workspaces/exists_username` - -*/ - pub async fn exists_username<'a>( - &'a self, - body: &'a types::ExistsUsernameBody, - ) -> Result, Error<()>> { - let url = format!("{}/workspaces/exists_username", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get global settings - -Sends a `GET` request to `/settings/global/{key}` - -*/ - pub async fn get_global<'a>( - &'a self, - key: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/settings/global/{}", self.baseurl, encode_path(& key.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**post global settings - -Sends a `POST` request to `/settings/global/{key}` - -Arguments: -- `key` -- `body`: value set -*/ - pub async fn set_global<'a>( - &'a self, - key: &'a str, - body: &'a types::SetGlobalBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/settings/global/{}", self.baseurl, encode_path(& key.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get local settings - -Sends a `GET` request to `/settings/local` - -*/ - pub async fn get_local<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/settings/local", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test smtp - -Sends a `POST` request to `/settings/test_smtp` - -Arguments: -- `body`: test smtp payload -*/ - pub async fn test_smtp<'a>( - &'a self, - body: &'a types::TestSmtpBody, - ) -> Result, Error<()>> { - let url = format!("{}/settings/test_smtp", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test critical channels - -Sends a `POST` request to `/settings/test_critical_channels` - -Arguments: -- `body`: test critical channel payload -*/ - pub async fn test_critical_channels<'a>( - &'a self, - body: &'a Vec, - ) -> Result, Error<()>> { - let url = format!("{}/settings/test_critical_channels", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Get all critical alerts - -Sends a `GET` request to `/settings/critical_alerts` - -*/ - pub async fn get_critical_alerts<'a>( - &'a self, - acknowledged: Option, - page: Option, - page_size: Option, - ) -> Result, Error<()>> { - let url = format!("{}/settings/critical_alerts", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &acknowledged { - query.push(("acknowledged", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &page_size { - query.push(("page_size", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Acknowledge a critical alert - -Sends a `POST` request to `/settings/critical_alerts/{id}/acknowledge` - -Arguments: -- `id`: The ID of the critical alert to acknowledge -*/ - pub async fn acknowledge_critical_alert<'a>( - &'a self, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/settings/critical_alerts/{}/acknowledge", self.baseurl, encode_path(& id - .to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Acknowledge all unacknowledged critical alerts - -Sends a `POST` request to `/settings/critical_alerts/acknowledge_all` - -*/ - pub async fn acknowledge_all_critical_alerts<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/settings/critical_alerts/acknowledge_all", self.baseurl,); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test license key - -Sends a `POST` request to `/settings/test_license_key` - -Arguments: -- `body`: test license key -*/ - pub async fn test_license_key<'a>( - &'a self, - body: &'a types::TestLicenseKeyBody, - ) -> Result, Error<()>> { - let url = format!("{}/settings/test_license_key", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test object storage config - -Sends a `POST` request to `/settings/test_object_storage_config` - -Arguments: -- `body`: test object storage config -*/ - pub async fn test_object_storage_config<'a>( - &'a self, - body: &'a std::collections::HashMap, - ) -> Result, Error<()>> { - let url = format!("{}/settings/test_object_storage_config", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**send stats - -Sends a `POST` request to `/settings/send_stats` - -*/ - pub async fn send_stats<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/settings/send_stats", self.baseurl,); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get latest key renewal attempt - -Sends a `GET` request to `/settings/latest_key_renewal_attempt` - -*/ - pub async fn get_latest_key_renewal_attempt<'a>( - &'a self, - ) -> Result< - ResponseValue>, - Error<()>, - > { - let url = format!("{}/settings/latest_key_renewal_attempt", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**renew license key - -Sends a `POST` request to `/settings/renew_license_key` - -*/ - pub async fn renew_license_key<'a>( - &'a self, - license_key: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!("{}/settings/renew_license_key", self.baseurl,); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &license_key { - query.push(("license_key", v.to_string())); - } - let request = self.client.post(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create customer portal session - -Sends a `POST` request to `/settings/customer_portal` - -*/ - pub async fn create_customer_portal_session<'a>( - &'a self, - license_key: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!("{}/settings/customer_portal", self.baseurl,); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &license_key { - query.push(("license_key", v.to_string())); - } - let request = self.client.post(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test metadata - -Sends a `POST` request to `/saml/test_metadata` - -Arguments: -- `body`: test metadata -*/ - pub async fn test_metadata<'a>( - &'a self, - body: &'a str, - ) -> Result, Error<()>> { - let url = format!("{}/saml/test_metadata", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list global settings - -Sends a `GET` request to `/settings/list_global` - -*/ - pub async fn list_global_settings<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/settings/list_global", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get current user email (if logged in) - -Sends a `GET` request to `/users/email` - -*/ - pub async fn get_current_email<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/users/email", self.baseurl,); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**refresh the current token - -Sends a `GET` request to `/users/refresh_token` - -*/ - pub async fn refresh_user_token<'a>( - &'a self, - if_expiring_in_less_than_s: Option, - ) -> Result, Error<()>> { - let url = format!("{}/users/refresh_token", self.baseurl,); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &if_expiring_in_less_than_s { - query.push(("if_expiring_in_less_than_s", v.to_string())); - } - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get tutorial progress - -Sends a `GET` request to `/users/tutorial_progress` - -*/ - pub async fn get_tutorial_progress<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/users/tutorial_progress", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update tutorial progress - -Sends a `POST` request to `/users/tutorial_progress` - -Arguments: -- `body`: progress update -*/ - pub async fn update_tutorial_progress<'a>( - &'a self, - body: &'a types::UpdateTutorialProgressBody, - ) -> Result, Error<()>> { - let url = format!("{}/users/tutorial_progress", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**leave instance - -Sends a `POST` request to `/users/leave_instance` - -*/ - pub async fn leave_instance<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/users/leave_instance", self.baseurl,); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get current usage outside of premium workspaces - -Sends a `GET` request to `/users/usage` - -*/ - pub async fn get_usage<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/users/usage", self.baseurl,); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get all runnables in every workspace - -Sends a `GET` request to `/users/all_runnables` - -*/ - pub async fn get_runnable<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/users/all_runnables", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get current global whoami (if logged in) - -Sends a `GET` request to `/users/whoami` - -*/ - pub async fn global_whoami<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/users/whoami", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all workspace invites - -Sends a `GET` request to `/users/list_invites` - -*/ - pub async fn list_workspace_invites<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/users/list_invites", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**whoami - -Sends a `GET` request to `/w/{workspace}/users/whoami` - -*/ - pub async fn whoami<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/whoami", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**accept invite to workspace - -Sends a `POST` request to `/users/accept_invite` - -Arguments: -- `body`: accept invite -*/ - pub async fn accept_invite<'a>( - &'a self, - body: &'a types::AcceptInviteBody, - ) -> Result, Error<()>> { - let url = format!("{}/users/accept_invite", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**decline invite to workspace - -Sends a `POST` request to `/users/decline_invite` - -Arguments: -- `body`: decline invite -*/ - pub async fn decline_invite<'a>( - &'a self, - body: &'a types::DeclineInviteBody, - ) -> Result, Error<()>> { - let url = format!("{}/users/decline_invite", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**invite user to workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/invite_user` - -Arguments: -- `workspace` -- `body`: WorkspaceInvite -*/ - pub async fn invite_user<'a>( - &'a self, - workspace: &'a str, - body: &'a types::InviteUserBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/invite_user", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**add user to workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/add_user` - -Arguments: -- `workspace` -- `body`: WorkspaceInvite -*/ - pub async fn add_user<'a>( - &'a self, - workspace: &'a str, - body: &'a types::AddUserBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/add_user", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete user invite - -Sends a `POST` request to `/w/{workspace}/workspaces/delete_invite` - -Arguments: -- `workspace` -- `body`: WorkspaceInvite -*/ - pub async fn delete_invite<'a>( - &'a self, - workspace: &'a str, - body: &'a types::DeleteInviteBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/delete_invite", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**archive workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/archive` - -*/ - pub async fn archive_workspace<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/archive", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**unarchive workspace - -Sends a `POST` request to `/workspaces/unarchive/{workspace}` - -*/ - pub async fn unarchive_workspace<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/workspaces/unarchive/{}", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete workspace (require super admin) - -Sends a `DELETE` request to `/workspaces/delete/{workspace}` - -*/ - pub async fn delete_workspace<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/workspaces/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**leave workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/leave` - -*/ - pub async fn leave_workspace<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/leave", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get workspace name - -Sends a `GET` request to `/w/{workspace}/workspaces/get_workspace_name` - -*/ - pub async fn get_workspace_name<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/get_workspace_name", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**change workspace name - -Sends a `POST` request to `/w/{workspace}/workspaces/change_workspace_name` - -*/ - pub async fn change_workspace_name<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ChangeWorkspaceNameBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/change_workspace_name", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**change workspace id - -Sends a `POST` request to `/w/{workspace}/workspaces/change_workspace_id` - -*/ - pub async fn change_workspace_id<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ChangeWorkspaceIdBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/change_workspace_id", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**change workspace id - -Sends a `POST` request to `/w/{workspace}/workspaces/change_workspace_color` - -*/ - pub async fn change_workspace_color<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ChangeWorkspaceColorBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/change_workspace_color", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**whois - -Sends a `GET` request to `/w/{workspace}/users/whois/{username}` - -*/ - pub async fn whois<'a>( - &'a self, - workspace: &'a str, - username: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/whois/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& username.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Update operator settings for a workspace - -Updates the operator settings for a specific workspace. Requires workspace admin privileges. - -Sends a `POST` request to `/w/{workspace}/workspaces/operator_settings` - -*/ - pub async fn update_operator_settings<'a>( - &'a self, - workspace: &'a str, - body: &'a types::OperatorSettings, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/operator_settings", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists email - -Sends a `GET` request to `/users/exists/{email}` - -*/ - pub async fn exists_email<'a>( - &'a self, - email: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/exists/{}", self.baseurl, encode_path(& email.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all users as super admin (require to be super amdin) - -Sends a `GET` request to `/users/list_as_super_admin` - -Arguments: -- `active_only`: filter only active users -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_users_as_super_admin<'a>( - &'a self, - active_only: Option, - page: Option, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!("{}/users/list_as_super_admin", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &active_only { - query.push(("active_only", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list pending invites for a workspace - -Sends a `GET` request to `/w/{workspace}/workspaces/list_pending_invites` - -*/ - pub async fn list_pending_invites<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/list_pending_invites", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get settings - -Sends a `GET` request to `/w/{workspace}/workspaces/get_settings` - -*/ - pub async fn get_settings<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/get_settings", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get deploy to - -Sends a `GET` request to `/w/{workspace}/workspaces/get_deploy_to` - -*/ - pub async fn get_deploy_to<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/get_deploy_to", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get if workspace is premium - -Sends a `GET` request to `/w/{workspace}/workspaces/is_premium` - -*/ - pub async fn get_is_premium<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/is_premium", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get premium info - -Sends a `GET` request to `/w/{workspace}/workspaces/premium_info` - -*/ - pub async fn get_premium_info<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/premium_info", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set automatic billing - -Sends a `POST` request to `/w/{workspace}/workspaces/set_automatic_billing` - -Arguments: -- `workspace` -- `body`: automatic billing -*/ - pub async fn set_automatic_billing<'a>( - &'a self, - workspace: &'a str, - body: &'a types::SetAutomaticBillingBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/set_automatic_billing", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get threshold alert info - -Sends a `GET` request to `/w/{workspace}/workspaces/threshold_alert` - -*/ - pub async fn get_threshold_alert<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/threshold_alert", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set threshold alert info - -Sends a `POST` request to `/w/{workspace}/workspaces/threshold_alert` - -Arguments: -- `workspace` -- `body`: threshold alert info -*/ - pub async fn set_threshold_alert<'a>( - &'a self, - workspace: &'a str, - body: &'a types::SetThresholdAlertBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/threshold_alert", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit slack command - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_slack_command` - -Arguments: -- `workspace` -- `body`: WorkspaceInvite -*/ - pub async fn edit_slack_command<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditSlackCommandBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_slack_command", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit teams command - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_teams_command` - -Arguments: -- `workspace` -- `body`: WorkspaceInvite -*/ - pub async fn edit_teams_command<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditTeamsCommandBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_teams_command", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list available teams ids - -Sends a `GET` request to `/w/{workspace}/workspaces/available_teams_ids` - -*/ - pub async fn list_available_teams_ids<'a>( - &'a self, - workspace: &'a str, - ) -> Result< - ResponseValue>, - Error<()>, - > { - let url = format!( - "{}/w/{}/workspaces/available_teams_ids", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list available teams channels - -Sends a `GET` request to `/w/{workspace}/workspaces/available_teams_channels` - -*/ - pub async fn list_available_teams_channels<'a>( - &'a self, - workspace: &'a str, - ) -> Result< - ResponseValue>, - Error<()>, - > { - let url = format!( - "{}/w/{}/workspaces/available_teams_channels", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**connect teams - -Sends a `POST` request to `/w/{workspace}/workspaces/connect_teams` - -Arguments: -- `workspace` -- `body`: connect teams -*/ - pub async fn connect_teams<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ConnectTeamsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/connect_teams", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run a job that sends a message to Slack - -Sends a `POST` request to `/w/{workspace}/workspaces/run_slack_message_test_job` - -Arguments: -- `workspace` -- `body`: path to hub script to run and its corresponding args -*/ - pub async fn run_slack_message_test_job<'a>( - &'a self, - workspace: &'a str, - body: &'a types::RunSlackMessageTestJobBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/run_slack_message_test_job", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run a job that sends a message to Teams - -Sends a `POST` request to `/w/{workspace}/workspaces/run_teams_message_test_job` - -Arguments: -- `workspace` -- `body`: path to hub script to run and its corresponding args -*/ - pub async fn run_teams_message_test_job<'a>( - &'a self, - workspace: &'a str, - body: &'a types::RunTeamsMessageTestJobBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/run_teams_message_test_job", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit deploy to - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_deploy_to` - -*/ - pub async fn edit_deploy_to<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditDeployToBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_deploy_to", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit auto invite - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_auto_invite` - -Arguments: -- `workspace` -- `body`: WorkspaceInvite -*/ - pub async fn edit_auto_invite<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditAutoInviteBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_auto_invite", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit webhook - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_webhook` - -Arguments: -- `workspace` -- `body`: WorkspaceWebhook -*/ - pub async fn edit_webhook<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditWebhookBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_webhook", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit copilot config - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_copilot_config` - -Arguments: -- `workspace` -- `body`: WorkspaceCopilotConfig -*/ - pub async fn edit_copilot_config<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditCopilotConfigBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_copilot_config", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get copilot info - -Sends a `GET` request to `/w/{workspace}/workspaces/get_copilot_info` - -*/ - pub async fn get_copilot_info<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/get_copilot_info", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit error handler - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_error_handler` - -Arguments: -- `workspace` -- `body`: WorkspaceErrorHandler -*/ - pub async fn edit_error_handler<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditErrorHandlerBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_error_handler", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit large file storage settings - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_large_file_storage_config` - -Arguments: -- `workspace` -- `body`: LargeFileStorage info -*/ - pub async fn edit_large_file_storage_config<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditLargeFileStorageConfigBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_large_file_storage_config", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit workspace git sync settings - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_git_sync_config` - -Arguments: -- `workspace` -- `body`: Workspace Git sync settings -*/ - pub async fn edit_workspace_git_sync_config<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditWorkspaceGitSyncConfigBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_git_sync_config", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit workspace deploy ui settings - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_deploy_ui_config` - -Arguments: -- `workspace` -- `body`: Workspace deploy UI settings -*/ - pub async fn edit_workspace_deploy_ui_settings<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditWorkspaceDeployUiSettingsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_deploy_ui_config", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit default app for workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/edit_default_app` - -Arguments: -- `workspace` -- `body`: Workspace default app -*/ - pub async fn edit_workspace_default_app<'a>( - &'a self, - workspace: &'a str, - body: &'a types::EditWorkspaceDefaultAppBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/edit_default_app", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get default scripts for workspace - -Sends a `GET` request to `/w/{workspace}/workspaces/default_scripts` - -*/ - pub async fn get_default_scripts<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/default_scripts", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**edit default scripts for workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/default_scripts` - -Arguments: -- `workspace` -- `body`: Workspace default app -*/ - pub async fn edit_default_scripts<'a>( - &'a self, - workspace: &'a str, - body: &'a types::WorkspaceDefaultScripts, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/default_scripts", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set environment variable - -Sends a `POST` request to `/w/{workspace}/workspaces/set_environment_variable` - -Arguments: -- `workspace` -- `body`: Workspace default app -*/ - pub async fn set_environment_variable<'a>( - &'a self, - workspace: &'a str, - body: &'a types::SetEnvironmentVariableBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/set_environment_variable", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**retrieves the encryption key for this workspace - -Sends a `GET` request to `/w/{workspace}/workspaces/encryption_key` - -*/ - pub async fn get_workspace_encryption_key<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/encryption_key", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update the encryption key for this workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/encryption_key` - -Arguments: -- `workspace` -- `body`: New encryption key -*/ - pub async fn set_workspace_encryption_key<'a>( - &'a self, - workspace: &'a str, - body: &'a types::SetWorkspaceEncryptionKeyBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/encryption_key", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get default app for workspace - -Sends a `GET` request to `/w/{workspace}/workspaces/default_app` - -*/ - pub async fn get_workspace_default_app<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/default_app", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get large file storage config - -Sends a `GET` request to `/w/{workspace}/workspaces/get_large_file_storage_config` - -*/ - pub async fn get_large_file_storage_config<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/get_large_file_storage_config", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get usage - -Sends a `GET` request to `/w/{workspace}/workspaces/usage` - -*/ - pub async fn get_workspace_usage<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/usage", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get used triggers - -Sends a `GET` request to `/w/{workspace}/workspaces/used_triggers` - -*/ - pub async fn get_used_triggers<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/used_triggers", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list users - -Sends a `GET` request to `/w/{workspace}/users/list` - -*/ - pub async fn list_users<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/users/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list users usage - -Sends a `GET` request to `/w/{workspace}/users/list_usage` - -*/ - pub async fn list_users_usage<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/users/list_usage", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list usernames - -Sends a `GET` request to `/w/{workspace}/users/list_usernames` - -*/ - pub async fn list_usernames<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/users/list_usernames", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get email from username - -Sends a `GET` request to `/w/{workspace}/users/username_to_email/{username}` - -*/ - pub async fn username_to_email<'a>( - &'a self, - workspace: &'a str, - username: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/users/username_to_email/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& username.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create token - -Sends a `POST` request to `/users/tokens/create` - -Arguments: -- `body`: new token -*/ - pub async fn create_token<'a>( - &'a self, - body: &'a types::NewToken, - ) -> Result, Error<()>> { - let url = format!("{}/users/tokens/create", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create token to impersonate a user (require superadmin) - -Sends a `POST` request to `/users/tokens/impersonate` - -Arguments: -- `body`: new token -*/ - pub async fn create_token_impersonate<'a>( - &'a self, - body: &'a types::NewTokenImpersonate, - ) -> Result, Error<()>> { - let url = format!("{}/users/tokens/impersonate", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete token - -Sends a `DELETE` request to `/users/tokens/delete/{token_prefix}` - -*/ - pub async fn delete_token<'a>( - &'a self, - token_prefix: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/users/tokens/delete/{}", self.baseurl, encode_path(& token_prefix - .to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list token - -Sends a `GET` request to `/users/tokens/list` - -Arguments: -- `exclude_ephemeral` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_tokens<'a>( - &'a self, - exclude_ephemeral: Option, - page: Option, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!("{}/users/tokens/list", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &exclude_ephemeral { - query.push(("exclude_ephemeral", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get OIDC token (ee only) - -Sends a `POST` request to `/w/{workspace}/oidc/token/{audience}` - -*/ - pub async fn get_oidc_token<'a>( - &'a self, - workspace: &'a str, - audience: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oidc/token/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& audience.to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create variable - -Sends a `POST` request to `/w/{workspace}/variables/create` - -Arguments: -- `workspace` -- `already_encrypted` -- `body`: new variable -*/ - pub async fn create_variable<'a>( - &'a self, - workspace: &'a str, - already_encrypted: Option, - body: &'a types::CreateVariable, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &already_encrypted { - query.push(("already_encrypted", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**encrypt value - -Sends a `POST` request to `/w/{workspace}/variables/encrypt` - -Arguments: -- `workspace` -- `body`: new variable -*/ - pub async fn encrypt_value<'a>( - &'a self, - workspace: &'a str, - body: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/encrypt", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete variable - -Sends a `DELETE` request to `/w/{workspace}/variables/delete/{path}` - -*/ - pub async fn delete_variable<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update variable - -Sends a `POST` request to `/w/{workspace}/variables/update/{path}` - -Arguments: -- `workspace` -- `path` -- `already_encrypted` -- `body`: updated variable -*/ - pub async fn update_variable<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - already_encrypted: Option, - body: &'a types::EditVariable, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &already_encrypted { - query.push(("already_encrypted", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get variable - -Sends a `GET` request to `/w/{workspace}/variables/get/{path}` - -Arguments: -- `workspace` -- `path` -- `decrypt_secret`: ask to decrypt secret if this variable is secret -(if not secret no effect, default: true) - -- `include_encrypted`: ask to include the encrypted value if secret and decrypt secret is not true (default: false) - -*/ - pub async fn get_variable<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - decrypt_secret: Option, - include_encrypted: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &decrypt_secret { - query.push(("decrypt_secret", v.to_string())); - } - if let Some(v) = &include_encrypted { - query.push(("include_encrypted", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get variable value - -Sends a `GET` request to `/w/{workspace}/variables/get_value/{path}` - -*/ - pub async fn get_variable_value<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/get_value/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does variable exists at path - -Sends a `GET` request to `/w/{workspace}/variables/exists/{path}` - -*/ - pub async fn exists_variable<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/variables/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list variables - -Sends a `GET` request to `/w/{workspace}/variables/list` - -Arguments: -- `workspace` -- `page`: which page to return (start at 1, default 1) -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_variable<'a>( - &'a self, - workspace: &'a str, - page: Option, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/variables/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list contextual variables - -Sends a `GET` request to `/w/{workspace}/variables/list_contextual` - -*/ - pub async fn list_contextual_variables<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/variables/list_contextual", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Get all critical alerts for this workspace - -Sends a `GET` request to `/w/{workspace}/workspaces/critical_alerts` - -*/ - pub async fn workspace_get_critical_alerts<'a>( - &'a self, - workspace: &'a str, - acknowledged: Option, - page: Option, - page_size: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/critical_alerts", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &acknowledged { - query.push(("acknowledged", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &page_size { - query.push(("page_size", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Acknowledge a critical alert for this workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/critical_alerts/{id}/acknowledge` - -Arguments: -- `workspace` -- `id`: The ID of the critical alert to acknowledge -*/ - pub async fn workspace_acknowledge_critical_alert<'a>( - &'a self, - workspace: &'a str, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/critical_alerts/{}/acknowledge", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Acknowledge all unacknowledged critical alerts for this workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/critical_alerts/acknowledge_all` - -*/ - pub async fn workspace_acknowledge_all_critical_alerts<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/critical_alerts/acknowledge_all", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Mute critical alert UI for this workspace - -Sends a `POST` request to `/w/{workspace}/workspaces/critical_alerts/mute` - -Arguments: -- `workspace` -- `body`: Boolean flag to mute critical alerts. -*/ - pub async fn workspace_mute_critical_alerts_ui<'a>( - &'a self, - workspace: &'a str, - body: &'a types::WorkspaceMuteCriticalAlertsUiBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/workspaces/critical_alerts/mute", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**login with oauth authorization flow - -Sends a `POST` request to `/oauth/login_callback/{client_name}` - -Arguments: -- `client_name` -- `body`: Partially filled script -*/ - pub async fn login_with_oauth<'a>( - &'a self, - client_name: &'a str, - body: &'a types::LoginWithOauthBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/oauth/login_callback/{}", self.baseurl, encode_path(& client_name - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**connect slack callback - -Sends a `POST` request to `/w/{workspace}/oauth/connect_slack_callback` - -Arguments: -- `workspace` -- `body`: code endpoint -*/ - pub async fn connect_slack_callback<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ConnectSlackCallbackBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oauth/connect_slack_callback", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**connect slack callback instance - -Sends a `POST` request to `/oauth/connect_slack_callback` - -Arguments: -- `body`: code endpoint -*/ - pub async fn connect_slack_callback_instance<'a>( - &'a self, - body: &'a types::ConnectSlackCallbackInstanceBody, - ) -> Result, Error<()>> { - let url = format!("{}/oauth/connect_slack_callback", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**connect callback - -Sends a `POST` request to `/oauth/connect_callback/{client_name}` - -Arguments: -- `client_name` -- `body`: code endpoint -*/ - pub async fn connect_callback<'a>( - &'a self, - client_name: &'a str, - body: &'a types::ConnectCallbackBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/oauth/connect_callback/{}", self.baseurl, encode_path(& client_name - .to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create OAuth account - -Sends a `POST` request to `/w/{workspace}/oauth/create_account` - -Arguments: -- `workspace` -- `body`: code endpoint -*/ - pub async fn create_account<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateAccountBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oauth/create_account", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**refresh token - -Sends a `POST` request to `/w/{workspace}/oauth/refresh_token/{id}` - -Arguments: -- `workspace` -- `id` -- `body`: variable path -*/ - pub async fn refresh_token<'a>( - &'a self, - workspace: &'a str, - id: i64, - body: &'a types::RefreshTokenBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oauth/refresh_token/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**disconnect account - -Sends a `POST` request to `/w/{workspace}/oauth/disconnect/{id}` - -*/ - pub async fn disconnect_account<'a>( - &'a self, - workspace: &'a str, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oauth/disconnect/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**disconnect slack - -Sends a `POST` request to `/w/{workspace}/oauth/disconnect_slack` - -*/ - pub async fn disconnect_slack<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oauth/disconnect_slack", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**disconnect teams - -Sends a `POST` request to `/w/{workspace}/oauth/disconnect_teams` - -*/ - pub async fn disconnect_teams<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/oauth/disconnect_teams", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list oauth logins - -Sends a `GET` request to `/oauth/list_logins` - -*/ - pub async fn list_o_auth_logins<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/oauth/list_logins", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list oauth connects - -Sends a `GET` request to `/oauth/list_connects` - -*/ - pub async fn list_o_auth_connects<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/oauth/list_connects", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get oauth connect - -Sends a `GET` request to `/oauth/get_connect/{client}` - -Arguments: -- `client`: client name -*/ - pub async fn get_o_auth_connect<'a>( - &'a self, - client: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/oauth/get_connect/{}", self.baseurl, encode_path(& client.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**synchronize Microsoft Teams information (teams/channels) - -Sends a `POST` request to `/teams/sync` - -*/ - pub async fn sync_teams<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/teams/sync", self.baseurl,); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**send update to Microsoft Teams activity - -Respond to a Microsoft Teams activity after a workspace command is run - -Sends a `POST` request to `/teams/activities` - -*/ - pub async fn send_message_to_conversation<'a>( - &'a self, - body: &'a types::SendMessageToConversationBody, - ) -> Result, Error<()>> { - let url = format!("{}/teams/activities", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create resource - -Sends a `POST` request to `/w/{workspace}/resources/create` - -Arguments: -- `workspace` -- `update_if_exists` -- `body`: new resource -*/ - pub async fn create_resource<'a>( - &'a self, - workspace: &'a str, - update_if_exists: Option, - body: &'a types::CreateResource, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &update_if_exists { - query.push(("update_if_exists", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete resource - -Sends a `DELETE` request to `/w/{workspace}/resources/delete/{path}` - -*/ - pub async fn delete_resource<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update resource - -Sends a `POST` request to `/w/{workspace}/resources/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated resource -*/ - pub async fn update_resource<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditResource, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update resource value - -Sends a `POST` request to `/w/{workspace}/resources/update_value/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated resource -*/ - pub async fn update_resource_value<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::UpdateResourceValueBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/update_value/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get resource - -Sends a `GET` request to `/w/{workspace}/resources/get/{path}` - -*/ - pub async fn get_resource<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get resource interpolated (variables and resources are fully unrolled) - -Sends a `GET` request to `/w/{workspace}/resources/get_value_interpolated/{path}` - -Arguments: -- `workspace` -- `path` -- `job_id`: job id -*/ - pub async fn get_resource_value_interpolated<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - job_id: Option<&'a uuid::Uuid>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/get_value_interpolated/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get resource value - -Sends a `GET` request to `/w/{workspace}/resources/get_value/{path}` - -*/ - pub async fn get_resource_value<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/get_value/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does resource exists - -Sends a `GET` request to `/w/{workspace}/resources/exists/{path}` - -*/ - pub async fn exists_resource<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list resources - -Sends a `GET` request to `/w/{workspace}/resources/list` - -Arguments: -- `workspace` -- `page`: which page to return (start at 1, default 1) -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -- `resource_type`: resource_types to list from, separated by ',', -- `resource_type_exclude`: resource_types to not list from, separated by ',', -*/ - pub async fn list_resource<'a>( - &'a self, - workspace: &'a str, - page: Option, - path_start: Option<&'a str>, - per_page: Option, - resource_type: Option<&'a str>, - resource_type_exclude: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/resources/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &resource_type { - query.push(("resource_type", v.to_string())); - } - if let Some(v) = &resource_type_exclude { - query.push(("resource_type_exclude", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list resources for search - -Sends a `GET` request to `/w/{workspace}/resources/list_search` - -*/ - pub async fn list_search_resource<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/resources/list_search", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list resource names - -Sends a `GET` request to `/w/{workspace}/resources/list_names/{name}` - -*/ - pub async fn list_resource_names<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/resources/list_names/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create resource_type - -Sends a `POST` request to `/w/{workspace}/resources/type/create` - -Arguments: -- `workspace` -- `body`: new resource_type -*/ - pub async fn create_resource_type<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ResourceType, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get map from resource type to format extension - -Sends a `GET` request to `/w/{workspace}/resources/file_resource_type_to_file_ext_map` - -*/ - pub async fn file_resource_type_to_file_ext_map<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/file_resource_type_to_file_ext_map", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete resource_type - -Sends a `DELETE` request to `/w/{workspace}/resources/type/delete/{path}` - -*/ - pub async fn delete_resource_type<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update resource_type - -Sends a `POST` request to `/w/{workspace}/resources/type/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated resource_type -*/ - pub async fn update_resource_type<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditResourceType, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get resource_type - -Sends a `GET` request to `/w/{workspace}/resources/type/get/{path}` - -*/ - pub async fn get_resource_type<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does resource_type exists - -Sends a `GET` request to `/w/{workspace}/resources/type/exists/{path}` - -*/ - pub async fn exists_resource_type<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list resource_types - -Sends a `GET` request to `/w/{workspace}/resources/type/list` - -*/ - pub async fn list_resource_type<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list resource_types names - -Sends a `GET` request to `/w/{workspace}/resources/type/listnames` - -*/ - pub async fn list_resource_type_names<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/resources/type/listnames", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**query resource types by similarity - -Sends a `GET` request to `/w/{workspace}/embeddings/query_resource_types` - -Arguments: -- `workspace` -- `limit`: query limit -- `text`: query text -*/ - pub async fn query_resource_types<'a>( - &'a self, - workspace: &'a str, - limit: Option, - text: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/embeddings/query_resource_types", self.baseurl, encode_path(& - workspace.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - query.push(("text", text.to_string())); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list hub integrations - -Sends a `GET` request to `/integrations/hub/list` - -Arguments: -- `kind`: query integrations kind -*/ - pub async fn list_hub_integrations<'a>( - &'a self, - kind: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!("{}/integrations/hub/list", self.baseurl,); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &kind { - query.push(("kind", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all hub flows - -Sends a `GET` request to `/flows/hub/list` - -*/ - pub async fn list_hub_flows<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/flows/hub/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get hub flow by id - -Sends a `GET` request to `/flows/hub/get/{id}` - -*/ - pub async fn get_hub_flow_by_id<'a>( - &'a self, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/flows/hub/get/{}", self.baseurl, encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all hub apps - -Sends a `GET` request to `/apps/hub/list` - -*/ - pub async fn list_hub_apps<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/apps/hub/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get hub app by id - -Sends a `GET` request to `/apps/hub/get/{id}` - -*/ - pub async fn get_hub_app_by_id<'a>( - &'a self, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/apps/hub/get/{}", self.baseurl, encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get public app by custom path - -Sends a `GET` request to `/apps_u/public_app_by_custom_path/{custom_path}` - -*/ - pub async fn get_public_app_by_custom_path<'a>( - &'a self, - custom_path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/apps_u/public_app_by_custom_path/{}", self.baseurl, encode_path(& - custom_path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get hub script content by path - -Sends a `GET` request to `/scripts/hub/get/{path}` - -*/ - pub async fn get_hub_script_content_by_path<'a>( - &'a self, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/scripts/hub/get/{}", self.baseurl, encode_path(& path.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get full hub script by path - -Sends a `GET` request to `/scripts/hub/get_full/{path}` - -*/ - pub async fn get_hub_script_by_path<'a>( - &'a self, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/scripts/hub/get_full/{}", self.baseurl, encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get top hub scripts - -Sends a `GET` request to `/scripts/hub/top` - -Arguments: -- `app`: query scripts app -- `kind`: query scripts kind -- `limit`: query limit -*/ - pub async fn get_top_hub_scripts<'a>( - &'a self, - app: Option<&'a str>, - kind: Option<&'a str>, - limit: Option, - ) -> Result, Error<()>> { - let url = format!("{}/scripts/hub/top", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &app { - query.push(("app", v.to_string())); - } - if let Some(v) = &kind { - query.push(("kind", v.to_string())); - } - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**query hub scripts by similarity - -Sends a `GET` request to `/embeddings/query_hub_scripts` - -Arguments: -- `app`: query scripts app -- `kind`: query scripts kind -- `limit`: query limit -- `text`: query text -*/ - pub async fn query_hub_scripts<'a>( - &'a self, - app: Option<&'a str>, - kind: Option<&'a str>, - limit: Option, - text: &'a str, - ) -> Result>, Error<()>> { - let url = format!("{}/embeddings/query_hub_scripts", self.baseurl,); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &app { - query.push(("app", v.to_string())); - } - if let Some(v) = &kind { - query.push(("kind", v.to_string())); - } - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - query.push(("text", text.to_string())); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list scripts for search - -Sends a `GET` request to `/w/{workspace}/scripts/list_search` - -*/ - pub async fn list_search_script<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/scripts/list_search", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all scripts - -Sends a `GET` request to `/w/{workspace}/scripts/list` - -Arguments: -- `workspace` -- `created_by`: mask to filter exact matching user creator -- `first_parent_hash`: mask to filter scripts whom first direct parent has exact hash -- `include_draft_only`: (default false) -include scripts that have no deployed version - -- `include_without_main`: (default false) -include scripts without an exported main function - -- `is_template`: (default regardless) -if true show only the templates -if false show only the non templates -if not defined, show all regardless of if the script is a template - -- `kinds`: (default regardless) -script kinds to filter, split by comma - -- `last_parent_hash`: mask to filter scripts whom last parent in the chain has exact hash. -Beware that each script stores only a limited number of parents. Hence -the last parent hash for a script is not necessarily its top-most parent. -To find the top-most parent you will have to jump from last to last hash - until finding the parent - -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `parent_hash`: is the hash present in the array of stored parent hashes for this script. -The same warning applies than for last_parent_hash. A script only store a -limited number of direct parent - -- `path_exact`: mask to filter exact matching path -- `path_start`: mask to filter matching starting path -- `per_page`: number of items to return for a given page (default 30, max 100) -- `show_archived`: (default false) -show only the archived files. -when multiple archived hash share the same path, only the ones with the latest create_at -are -ed. - -- `starred_only`: (default false) -show only the starred items - -- `with_deployment_msg`: (default false) -include deployment message - -*/ - pub async fn list_scripts<'a>( - &'a self, - workspace: &'a str, - created_by: Option<&'a str>, - first_parent_hash: Option<&'a str>, - include_draft_only: Option, - include_without_main: Option, - is_template: Option, - kinds: Option<&'a str>, - last_parent_hash: Option<&'a str>, - order_desc: Option, - page: Option, - parent_hash: Option<&'a str>, - path_exact: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - show_archived: Option, - starred_only: Option, - with_deployment_msg: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/scripts/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(16usize); - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &first_parent_hash { - query.push(("first_parent_hash", v.to_string())); - } - if let Some(v) = &include_draft_only { - query.push(("include_draft_only", v.to_string())); - } - if let Some(v) = &include_without_main { - query.push(("include_without_main", v.to_string())); - } - if let Some(v) = &is_template { - query.push(("is_template", v.to_string())); - } - if let Some(v) = &kinds { - query.push(("kinds", v.to_string())); - } - if let Some(v) = &last_parent_hash { - query.push(("last_parent_hash", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &parent_hash { - query.push(("parent_hash", v.to_string())); - } - if let Some(v) = &path_exact { - query.push(("path_exact", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &show_archived { - query.push(("show_archived", v.to_string())); - } - if let Some(v) = &starred_only { - query.push(("starred_only", v.to_string())); - } - if let Some(v) = &with_deployment_msg { - query.push(("with_deployment_msg", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all scripts paths - -Sends a `GET` request to `/w/{workspace}/scripts/list_paths` - -*/ - pub async fn list_script_paths<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/list_paths", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create draft - -Sends a `POST` request to `/w/{workspace}/drafts/create` - -*/ - pub async fn create_draft<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateDraftBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/drafts/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete draft - -Sends a `DELETE` request to `/w/{workspace}/drafts/delete/{kind}/{path}` - -*/ - pub async fn delete_draft<'a>( - &'a self, - workspace: &'a str, - kind: types::DeleteDraftKind, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/drafts/delete/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& kind.to_string()), encode_path(& path - .to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create script - -Sends a `POST` request to `/w/{workspace}/scripts/create` - -Arguments: -- `workspace` -- `body`: Partially filled script -*/ - pub async fn create_script<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewScript, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Toggle ON and OFF the workspace error handler for a given script - -Sends a `POST` request to `/w/{workspace}/scripts/toggle_workspace_error_handler/p/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: Workspace error handler enabled -*/ - pub async fn toggle_workspace_error_handler_for_script<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::ToggleWorkspaceErrorHandlerForScriptBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/toggle_workspace_error_handler/p/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get all instance custom tags (tags are used to dispatch jobs to different worker groups) - -Sends a `GET` request to `/workers/custom_tags` - -*/ - pub async fn get_custom_tags<'a>( - &'a self, - show_workspace_restriction: Option, - workspace: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!("{}/workers/custom_tags", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &show_workspace_restriction { - query.push(("show_workspace_restriction", v.to_string())); - } - if let Some(v) = &workspace { - query.push(("workspace", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get all instance default tags - -Sends a `GET` request to `/workers/get_default_tags` - -*/ - pub async fn ge_default_tags<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/workers/get_default_tags", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**is default tags per workspace - -Sends a `GET` request to `/workers/is_default_tags_per_workspace` - -*/ - pub async fn is_default_tags_per_workspace<'a>( - &'a self, - ) -> Result, Error<()>> { - let url = format!("{}/workers/is_default_tags_per_workspace", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**archive script by path - -Sends a `POST` request to `/w/{workspace}/scripts/archive/p/{path}` - -*/ - pub async fn archive_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/archive/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**archive script by hash - -Sends a `POST` request to `/w/{workspace}/scripts/archive/h/{hash}` - -*/ - pub async fn archive_script_by_hash<'a>( - &'a self, - workspace: &'a str, - hash: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/archive/h/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& hash.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete script by hash (erase content but keep hash, require admin) - -Sends a `POST` request to `/w/{workspace}/scripts/delete/h/{hash}` - -*/ - pub async fn delete_script_by_hash<'a>( - &'a self, - workspace: &'a str, - hash: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/delete/h/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& hash.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete script at a given path (require admin) - -Sends a `POST` request to `/w/{workspace}/scripts/delete/p/{path}` - -Arguments: -- `workspace` -- `path` -- `keep_captures`: keep captures -*/ - pub async fn delete_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - keep_captures: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/delete/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &keep_captures { - query.push(("keep_captures", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get script by path - -Sends a `GET` request to `/w/{workspace}/scripts/get/p/{path}` - -*/ - pub async fn get_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - with_starred_info: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/get/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &with_starred_info { - query.push(("with_starred_info", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get triggers count of script - -Sends a `GET` request to `/w/{workspace}/scripts/get_triggers_count/{path}` - -*/ - pub async fn get_triggers_count_of_script<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/get_triggers_count/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get tokens with script scope - -Sends a `GET` request to `/w/{workspace}/scripts/list_tokens/{path}` - -*/ - pub async fn list_tokens_of_script<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/scripts/list_tokens/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get script by path with draft - -Sends a `GET` request to `/w/{workspace}/scripts/get/draft/{path}` - -*/ - pub async fn get_script_by_path_with_draft<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/get/draft/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get history of a script by path - -Sends a `GET` request to `/w/{workspace}/scripts/history/p/{path}` - -*/ - pub async fn get_script_history_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/scripts/history/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get scripts's latest version (hash) - -Sends a `GET` request to `/w/{workspace}/scripts/get_latest_version/{path}` - -*/ - pub async fn get_script_latest_version<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/get_latest_version/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update history of a script - -Sends a `POST` request to `/w/{workspace}/scripts/history_update/h/{hash}/p/{path}` - -Arguments: -- `workspace` -- `hash` -- `path` -- `body`: Script deployment message -*/ - pub async fn update_script_history<'a>( - &'a self, - workspace: &'a str, - hash: &'a str, - path: &'a str, - body: &'a types::UpdateScriptHistoryBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/history_update/h/{}/p/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& hash.to_string()), encode_path(& path - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**raw script by path - -Sends a `GET` request to `/w/{workspace}/scripts/raw/p/{path}` - -*/ - pub async fn raw_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/raw/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**raw script by path with a token (mostly used by lsp to be used with import maps to resolve scripts) - -Sends a `GET` request to `/scripts_u/tokened_raw/{workspace}/{token}/{path}` - -*/ - pub async fn raw_script_by_path_tokened<'a>( - &'a self, - workspace: &'a str, - token: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/scripts_u/tokened_raw/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& token.to_string()), encode_path(& path - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists script by path - -Sends a `GET` request to `/w/{workspace}/scripts/exists/p/{path}` - -*/ - pub async fn exists_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/exists/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get script by hash - -Sends a `GET` request to `/w/{workspace}/scripts/get/h/{hash}` - -*/ - pub async fn get_script_by_hash<'a>( - &'a self, - workspace: &'a str, - hash: &'a str, - with_starred_info: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/get/h/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& hash.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &with_starred_info { - query.push(("with_starred_info", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**raw script by hash - -Sends a `GET` request to `/w/{workspace}/scripts/raw/h/{path}` - -*/ - pub async fn raw_script_by_hash<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/raw/h/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get script deployment status - -Sends a `GET` request to `/w/{workspace}/scripts/deployment_status/h/{hash}` - -*/ - pub async fn get_script_deployment_status<'a>( - &'a self, - workspace: &'a str, - hash: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/deployment_status/h/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& hash.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run script by path - -Sends a `POST` request to `/w/{workspace}/jobs/run/p/{path}` - -Arguments: -- `workspace` -- `path` -- `cache_ttl`: Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl -- `invisible_to_owner`: make the run invisible to the the script owner (default false) -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `scheduled_for`: when to schedule this job (leave empty for immediate run) -- `scheduled_in_secs`: schedule the script to execute in the number of seconds starting now -- `skip_preprocessor`: skip the preprocessor -- `tag`: Override the tag to use -- `body`: script args -*/ - pub async fn run_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - cache_ttl: Option<&'a str>, - invisible_to_owner: Option, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - scheduled_for: Option<&'a chrono::DateTime>, - scheduled_in_secs: Option, - skip_preprocessor: Option, - tag: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run/p/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(8usize); - if let Some(v) = &cache_ttl { - query.push(("cache_ttl", v.to_string())); - } - if let Some(v) = &invisible_to_owner { - query.push(("invisible_to_owner", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &scheduled_for { - query.push(("scheduled_for", v.to_string())); - } - if let Some(v) = &scheduled_in_secs { - query.push(("scheduled_in_secs", v.to_string())); - } - if let Some(v) = &skip_preprocessor { - query.push(("skip_preprocessor", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run script by path in openai format - -Sends a `POST` request to `/w/{workspace}/jobs/openai_sync/p/{path}` - -Arguments: -- `workspace` -- `path` -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `queue_limit`: The maximum size of the queue for which the request would get rejected if that job would push it above that limit - -- `body`: script args -*/ - pub async fn openai_sync_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - include_header: Option<&'a str>, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - queue_limit: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/openai_sync/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &queue_limit { - query.push(("queue_limit", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run script by path with get - -Sends a `GET` request to `/w/{workspace}/jobs/run_wait_result/p/{path}` - -Arguments: -- `workspace` -- `path` -- `cache_ttl`: Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `payload`: The base64 encoded payload that has been encoded as a JSON. e.g how to encode such payload encodeURIComponent -`encodeURIComponent(btoa(JSON.stringify({a: 2})))` - -- `queue_limit`: The maximum size of the queue for which the request would get rejected if that job would push it above that limit - -- `tag`: Override the tag to use -*/ - pub async fn run_wait_result_script_by_path_get<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - cache_ttl: Option<&'a str>, - include_header: Option<&'a str>, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - payload: Option<&'a str>, - queue_limit: Option<&'a str>, - tag: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run_wait_result/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &cache_ttl { - query.push(("cache_ttl", v.to_string())); - } - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &payload { - query.push(("payload", v.to_string())); - } - if let Some(v) = &queue_limit { - query.push(("queue_limit", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run script by path - -Sends a `POST` request to `/w/{workspace}/jobs/run_wait_result/p/{path}` - -Arguments: -- `workspace` -- `path` -- `cache_ttl`: Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `queue_limit`: The maximum size of the queue for which the request would get rejected if that job would push it above that limit - -- `tag`: Override the tag to use -- `body`: script args -*/ - pub async fn run_wait_result_script_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - cache_ttl: Option<&'a str>, - include_header: Option<&'a str>, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - queue_limit: Option<&'a str>, - tag: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run_wait_result/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(6usize); - if let Some(v) = &cache_ttl { - query.push(("cache_ttl", v.to_string())); - } - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &queue_limit { - query.push(("queue_limit", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run flow by path and wait until completion in openai format - -Sends a `POST` request to `/w/{workspace}/jobs/openai_sync/f/{path}` - -Arguments: -- `workspace` -- `path` -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `queue_limit`: The maximum size of the queue for which the request would get rejected if that job would push it above that limit - -- `body`: script args -*/ - pub async fn openai_sync_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - include_header: Option<&'a str>, - job_id: Option<&'a uuid::Uuid>, - queue_limit: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/openai_sync/f/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &queue_limit { - query.push(("queue_limit", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run flow by path and wait until completion - -Sends a `POST` request to `/w/{workspace}/jobs/run_wait_result/f/{path}` - -Arguments: -- `workspace` -- `path` -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `queue_limit`: The maximum size of the queue for which the request would get rejected if that job would push it above that limit - -- `body`: script args -*/ - pub async fn run_wait_result_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - include_header: Option<&'a str>, - job_id: Option<&'a uuid::Uuid>, - queue_limit: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run_wait_result/f/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &queue_limit { - query.push(("queue_limit", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job result by id - -Sends a `GET` request to `/w/{workspace}/jobs/result_by_id/{flow_job_id}/{node_id}` - -*/ - pub async fn result_by_id<'a>( - &'a self, - workspace: &'a str, - flow_job_id: &'a str, - node_id: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/result_by_id/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& flow_job_id.to_string()), encode_path(& node_id - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all flow paths - -Sends a `GET` request to `/w/{workspace}/flows/list_paths` - -*/ - pub async fn list_flow_paths<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/list_paths", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list flows for search - -Sends a `GET` request to `/w/{workspace}/flows/list_search` - -*/ - pub async fn list_search_flow<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/flows/list_search", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all flows - -Sends a `GET` request to `/w/{workspace}/flows/list` - -Arguments: -- `workspace` -- `created_by`: mask to filter exact matching user creator -- `include_draft_only`: (default false) -include items that have no deployed version - -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `path_exact`: mask to filter exact matching path -- `path_start`: mask to filter matching starting path -- `per_page`: number of items to return for a given page (default 30, max 100) -- `show_archived`: (default false) -show only the archived files. -when multiple archived hash share the same path, only the ones with the latest create_at -are displayed. - -- `starred_only`: (default false) -show only the starred items - -- `with_deployment_msg`: (default false) -include deployment message - -*/ - pub async fn list_flows<'a>( - &'a self, - workspace: &'a str, - created_by: Option<&'a str>, - include_draft_only: Option, - order_desc: Option, - page: Option, - path_exact: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - show_archived: Option, - starred_only: Option, - with_deployment_msg: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/flows/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(10usize); - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &include_draft_only { - query.push(("include_draft_only", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path_exact { - query.push(("path_exact", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &show_archived { - query.push(("show_archived", v.to_string())); - } - if let Some(v) = &starred_only { - query.push(("starred_only", v.to_string())); - } - if let Some(v) = &with_deployment_msg { - query.push(("with_deployment_msg", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow history by path - -Sends a `GET` request to `/w/{workspace}/flows/history/p/{path}` - -*/ - pub async fn get_flow_history<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/flows/history/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow's latest version - -Sends a `GET` request to `/w/{workspace}/flows/get_latest_version/{path}` - -*/ - pub async fn get_flow_latest_version<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/get_latest_version/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list flow paths from workspace runnable - -Sends a `GET` request to `/w/{workspace}/flows/list_paths_from_workspace_runnable/{runnable_kind}/{path}` - -*/ - pub async fn list_flow_paths_from_workspace_runnable<'a>( - &'a self, - workspace: &'a str, - runnable_kind: types::ListFlowPathsFromWorkspaceRunnableRunnableKind, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/flows/list_paths_from_workspace_runnable/{}/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& runnable_kind - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow version - -Sends a `GET` request to `/w/{workspace}/flows/get/v/{version}/p/{path}` - -*/ - pub async fn get_flow_version<'a>( - &'a self, - workspace: &'a str, - version: f64, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/get/v/{}/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& version.to_string()), encode_path(& path - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update flow history - -Sends a `POST` request to `/w/{workspace}/flows/history_update/v/{version}/p/{path}` - -Arguments: -- `workspace` -- `version` -- `path` -- `body`: Flow deployment message -*/ - pub async fn update_flow_history<'a>( - &'a self, - workspace: &'a str, - version: f64, - path: &'a str, - body: &'a types::UpdateFlowHistoryBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/history_update/v/{}/p/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& version.to_string()), encode_path(& - path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow by path - -Sends a `GET` request to `/w/{workspace}/flows/get/{path}` - -*/ - pub async fn get_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - with_starred_info: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &with_starred_info { - query.push(("with_starred_info", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow deployment status - -Sends a `GET` request to `/w/{workspace}/flows/deployment_status/p/{path}` - -*/ - pub async fn get_flow_deployment_status<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/deployment_status/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get triggers count of flow - -Sends a `GET` request to `/w/{workspace}/flows/get_triggers_count/{path}` - -*/ - pub async fn get_triggers_count_of_flow<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/get_triggers_count/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get tokens with flow scope - -Sends a `GET` request to `/w/{workspace}/flows/list_tokens/{path}` - -*/ - pub async fn list_tokens_of_flow<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/flows/list_tokens/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Toggle ON and OFF the workspace error handler for a given flow - -Sends a `POST` request to `/w/{workspace}/flows/toggle_workspace_error_handler/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: Workspace error handler enabled -*/ - pub async fn toggle_workspace_error_handler_for_flow<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::ToggleWorkspaceErrorHandlerForFlowBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/toggle_workspace_error_handler/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow by path with draft - -Sends a `GET` request to `/w/{workspace}/flows/get/draft/{path}` - -*/ - pub async fn get_flow_by_path_with_draft<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/get/draft/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists flow by path - -Sends a `GET` request to `/w/{workspace}/flows/exists/{path}` - -*/ - pub async fn exists_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create flow - -Sends a `POST` request to `/w/{workspace}/flows/create` - -Arguments: -- `workspace` -- `body`: Partially filled flow -*/ - pub async fn create_flow<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateFlowBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update flow - -Sends a `POST` request to `/w/{workspace}/flows/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: Partially filled flow -*/ - pub async fn update_flow<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::UpdateFlowBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**archive flow by path - -Sends a `POST` request to `/w/{workspace}/flows/archive/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: archiveFlow -*/ - pub async fn archive_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::ArchiveFlowByPathBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/archive/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete flow by path - -Sends a `DELETE` request to `/w/{workspace}/flows/delete/{path}` - -Arguments: -- `workspace` -- `path` -- `keep_captures`: keep captures -*/ - pub async fn delete_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - keep_captures: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &keep_captures { - query.push(("keep_captures", v.to_string())); - } - let request = self.client.delete(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all raw apps - -Sends a `GET` request to `/w/{workspace}/raw_apps/list` - -Arguments: -- `workspace` -- `created_by`: mask to filter exact matching user creator -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `path_exact`: mask to filter exact matching path -- `path_start`: mask to filter matching starting path -- `per_page`: number of items to return for a given page (default 30, max 100) -- `starred_only`: (default false) -show only the starred items - -*/ - pub async fn list_raw_apps<'a>( - &'a self, - workspace: &'a str, - created_by: Option<&'a str>, - order_desc: Option, - page: Option, - path_exact: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - starred_only: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/raw_apps/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path_exact { - query.push(("path_exact", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &starred_only { - query.push(("starred_only", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does an app exisst at path - -Sends a `GET` request to `/w/{workspace}/raw_apps/exists/{path}` - -*/ - pub async fn exists_raw_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/raw_apps/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get app by path - -Sends a `GET` request to `/w/{workspace}/apps/get_data/{version}/{path}` - -*/ - pub async fn get_raw_app_data<'a>( - &'a self, - workspace: &'a str, - version: f64, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/get_data/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& version.to_string()), encode_path(& path - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list apps for search - -Sends a `GET` request to `/w/{workspace}/apps/list_search` - -*/ - pub async fn list_search_app<'a>( - &'a self, - workspace: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/apps/list_search", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all apps - -Sends a `GET` request to `/w/{workspace}/apps/list` - -Arguments: -- `workspace` -- `created_by`: mask to filter exact matching user creator -- `include_draft_only`: (default false) -include items that have no deployed version - -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `path_exact`: mask to filter exact matching path -- `path_start`: mask to filter matching starting path -- `per_page`: number of items to return for a given page (default 30, max 100) -- `starred_only`: (default false) -show only the starred items - -- `with_deployment_msg`: (default false) -include deployment message - -*/ - pub async fn list_apps<'a>( - &'a self, - workspace: &'a str, - created_by: Option<&'a str>, - include_draft_only: Option, - order_desc: Option, - page: Option, - path_exact: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - starred_only: Option, - with_deployment_msg: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/apps/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(9usize); - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &include_draft_only { - query.push(("include_draft_only", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path_exact { - query.push(("path_exact", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &starred_only { - query.push(("starred_only", v.to_string())); - } - if let Some(v) = &with_deployment_msg { - query.push(("with_deployment_msg", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create app - -Sends a `POST` request to `/w/{workspace}/apps/create` - -Arguments: -- `workspace` -- `body`: new app -*/ - pub async fn create_app<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateAppBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does an app exisst at path - -Sends a `GET` request to `/w/{workspace}/apps/exists/{path}` - -*/ - pub async fn exists_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/exists/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get app by path - -Sends a `GET` request to `/w/{workspace}/apps/get/p/{path}` - -*/ - pub async fn get_app_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - with_starred_info: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/get/p/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &with_starred_info { - query.push(("with_starred_info", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get app lite by path - -Sends a `GET` request to `/w/{workspace}/apps/get/lite/{path}` - -*/ - pub async fn get_app_lite_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/get/lite/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get app by path with draft - -Sends a `GET` request to `/w/{workspace}/apps/get/draft/{path}` - -*/ - pub async fn get_app_by_path_with_draft<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/get/draft/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get app history by path - -Sends a `GET` request to `/w/{workspace}/apps/history/p/{path}` - -*/ - pub async fn get_app_history_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/apps/history/p/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get apps's latest version - -Sends a `GET` request to `/w/{workspace}/apps/get_latest_version/{path}` - -*/ - pub async fn get_app_latest_version<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/get_latest_version/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update app history - -Sends a `POST` request to `/w/{workspace}/apps/history_update/a/{id}/v/{version}` - -Arguments: -- `workspace` -- `id` -- `version` -- `body`: App deployment message -*/ - pub async fn update_app_history<'a>( - &'a self, - workspace: &'a str, - id: i64, - version: i64, - body: &'a types::UpdateAppHistoryBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/history_update/a/{}/v/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& id.to_string()), encode_path(& version - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get public app by secret - -Sends a `GET` request to `/w/{workspace}/apps_u/public_app/{path}` - -*/ - pub async fn get_public_app_by_secret<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps_u/public_app/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get public resource - -Sends a `GET` request to `/w/{workspace}/apps_u/public_resource/{path}` - -*/ - pub async fn get_public_resource<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps_u/public_resource/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get public secret of app - -Sends a `GET` request to `/w/{workspace}/apps/secret_of/{path}` - -*/ - pub async fn get_public_secret_of_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/secret_of/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get app by version - -Sends a `GET` request to `/w/{workspace}/apps/get/v/{id}` - -*/ - pub async fn get_app_by_version<'a>( - &'a self, - workspace: &'a str, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/get/v/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create raw app - -Sends a `POST` request to `/w/{workspace}/raw_apps/create` - -Arguments: -- `workspace` -- `body`: new raw app -*/ - pub async fn create_raw_app<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateRawAppBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/raw_apps/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update app - -Sends a `POST` request to `/w/{workspace}/raw_apps/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updateraw app -*/ - pub async fn update_raw_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::UpdateRawAppBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/raw_apps/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete raw app - -Sends a `DELETE` request to `/w/{workspace}/raw_apps/delete/{path}` - -*/ - pub async fn delete_raw_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/raw_apps/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete app - -Sends a `DELETE` request to `/w/{workspace}/apps/delete/{path}` - -*/ - pub async fn delete_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/delete/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update app - -Sends a `POST` request to `/w/{workspace}/apps/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: update app -*/ - pub async fn update_app<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::UpdateAppBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/update/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**check if custom path exists - -Sends a `GET` request to `/w/{workspace}/apps/custom_path_exists/{custom_path}` - -*/ - pub async fn custom_path_exists<'a>( - &'a self, - workspace: &'a str, - custom_path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps/custom_path_exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& custom_path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**executeComponent - -Sends a `POST` request to `/w/{workspace}/apps_u/execute_component/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: update app -*/ - pub async fn execute_component<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::ExecuteComponentBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps_u/execute_component/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**upload s3 file from app - -Sends a `POST` request to `/w/{workspace}/apps_u/upload_s3_file/{path}` - -Arguments: -- `workspace` -- `path` -- `content_disposition` -- `content_type` -- `file_extension` -- `file_key` -- `resource_type` -- `s3_resource_path` -- `storage` -- `body`: File content -*/ - pub async fn upload_s3_file_from_app<'a, B: Into>( - &'a self, - workspace: &'a str, - path: &'a str, - content_disposition: Option<&'a str>, - content_type: Option<&'a str>, - file_extension: Option<&'a str>, - file_key: Option<&'a str>, - resource_type: Option<&'a str>, - s3_resource_path: Option<&'a str>, - storage: Option<&'a str>, - body: B, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps_u/upload_s3_file/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &content_disposition { - query.push(("content_disposition", v.to_string())); - } - if let Some(v) = &content_type { - query.push(("content_type", v.to_string())); - } - if let Some(v) = &file_extension { - query.push(("file_extension", v.to_string())); - } - if let Some(v) = &file_key { - query.push(("file_key", v.to_string())); - } - if let Some(v) = &resource_type { - query.push(("resource_type", v.to_string())); - } - if let Some(v) = &s3_resource_path { - query.push(("s3_resource_path", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete s3 file from app - -Sends a `DELETE` request to `/w/{workspace}/apps_u/delete_s3_file` - -*/ - pub async fn delete_s3_file_from_app<'a>( - &'a self, - workspace: &'a str, - delete_token: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/apps_u/delete_s3_file", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - query.push(("delete_token", delete_token.to_string())); - let request = self.client.delete(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run flow by path - -Sends a `POST` request to `/w/{workspace}/jobs/run/f/{path}` - -Arguments: -- `workspace` -- `path` -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `invisible_to_owner`: make the run invisible to the the flow owner (default false) -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `scheduled_for`: when to schedule this job (leave empty for immediate run) -- `scheduled_in_secs`: schedule the script to execute in the number of seconds starting now -- `skip_preprocessor`: skip the preprocessor -- `tag`: Override the tag to use -- `body`: flow args -*/ - pub async fn run_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - include_header: Option<&'a str>, - invisible_to_owner: Option, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - scheduled_for: Option<&'a chrono::DateTime>, - scheduled_in_secs: Option, - skip_preprocessor: Option, - tag: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run/f/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(8usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &invisible_to_owner { - query.push(("invisible_to_owner", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &scheduled_for { - query.push(("scheduled_for", v.to_string())); - } - if let Some(v) = &scheduled_in_secs { - query.push(("scheduled_in_secs", v.to_string())); - } - if let Some(v) = &skip_preprocessor { - query.push(("skip_preprocessor", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**restart a completed flow at a given step - -Sends a `POST` request to `/w/{workspace}/jobs/restart/f/{id}/from/{step_id}/{branch_or_iteration_n}` - -Arguments: -- `workspace` -- `id` -- `step_id`: step id to restart the flow from -- `branch_or_iteration_n`: for branchall or loop, the iteration at which the flow should restart -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `invisible_to_owner`: make the run invisible to the the flow owner (default false) -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `scheduled_for`: when to schedule this job (leave empty for immediate run) -- `scheduled_in_secs`: schedule the script to execute in the number of seconds starting now -- `tag`: Override the tag to use -- `body`: flow args -*/ - pub async fn restart_flow_at_step<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - step_id: &'a str, - branch_or_iteration_n: i64, - include_header: Option<&'a str>, - invisible_to_owner: Option, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - scheduled_for: Option<&'a chrono::DateTime>, - scheduled_in_secs: Option, - tag: Option<&'a str>, - body: &'a types::ScriptArgs, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/restart/f/{}/from/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& step_id - .to_string()), encode_path(& branch_or_iteration_n.to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &invisible_to_owner { - query.push(("invisible_to_owner", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &scheduled_for { - query.push(("scheduled_for", v.to_string())); - } - if let Some(v) = &scheduled_in_secs { - query.push(("scheduled_in_secs", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run script by hash - -Sends a `POST` request to `/w/{workspace}/jobs/run/h/{hash}` - -Arguments: -- `workspace` -- `hash` -- `cache_ttl`: Override the cache time to live (in seconds). Can not be used to disable caching, only override with a new cache ttl -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `invisible_to_owner`: make the run invisible to the the script owner (default false) -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `scheduled_for`: when to schedule this job (leave empty for immediate run) -- `scheduled_in_secs`: schedule the script to execute in the number of seconds starting now -- `skip_preprocessor`: skip the preprocessor -- `tag`: Override the tag to use -- `body`: Partially filled args -*/ - pub async fn run_script_by_hash<'a>( - &'a self, - workspace: &'a str, - hash: &'a str, - cache_ttl: Option<&'a str>, - include_header: Option<&'a str>, - invisible_to_owner: Option, - job_id: Option<&'a uuid::Uuid>, - parent_job: Option<&'a uuid::Uuid>, - scheduled_for: Option<&'a chrono::DateTime>, - scheduled_in_secs: Option, - skip_preprocessor: Option, - tag: Option<&'a str>, - body: &'a std::collections::HashMap, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run/h/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& hash.to_string()), - ); - let mut query = Vec::with_capacity(9usize); - if let Some(v) = &cache_ttl { - query.push(("cache_ttl", v.to_string())); - } - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &invisible_to_owner { - query.push(("invisible_to_owner", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &scheduled_for { - query.push(("scheduled_for", v.to_string())); - } - if let Some(v) = &scheduled_in_secs { - query.push(("scheduled_in_secs", v.to_string())); - } - if let Some(v) = &skip_preprocessor { - query.push(("skip_preprocessor", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run script preview - -Sends a `POST` request to `/w/{workspace}/jobs/run/preview` - -Arguments: -- `workspace` -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `invisible_to_owner`: make the run invisible to the the script owner (default false) -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `body`: preview -*/ - pub async fn run_script_preview<'a>( - &'a self, - workspace: &'a str, - include_header: Option<&'a str>, - invisible_to_owner: Option, - job_id: Option<&'a uuid::Uuid>, - body: &'a types::Preview, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run/preview", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &invisible_to_owner { - query.push(("invisible_to_owner", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run code-workflow task - -Sends a `POST` request to `/w/{workspace}/jobs/workflow_as_code/{job_id}/{entrypoint}` - -Arguments: -- `workspace` -- `job_id` -- `entrypoint` -- `body`: preview -*/ - pub async fn run_code_workflow_task<'a>( - &'a self, - workspace: &'a str, - job_id: &'a str, - entrypoint: &'a str, - body: &'a types::WorkflowTask, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/workflow_as_code/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& job_id.to_string()), encode_path(& entrypoint - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run a one-off dependencies job - -Sends a `POST` request to `/w/{workspace}/jobs/run/dependencies` - -Arguments: -- `workspace` -- `body`: raw script content -*/ - pub async fn run_raw_script_dependencies<'a>( - &'a self, - workspace: &'a str, - body: &'a types::RunRawScriptDependenciesBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run/dependencies", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**run flow preview - -Sends a `POST` request to `/w/{workspace}/jobs/run/preview_flow` - -Arguments: -- `workspace` -- `include_header`: List of headers's keys (separated with ',') whove value are added to the args -Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key - -- `invisible_to_owner`: make the run invisible to the the script owner (default false) -- `job_id`: The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request) -- `body`: preview -*/ - pub async fn run_flow_preview<'a>( - &'a self, - workspace: &'a str, - include_header: Option<&'a str>, - invisible_to_owner: Option, - job_id: Option<&'a uuid::Uuid>, - body: &'a types::FlowPreview, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/run/preview_flow", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &include_header { - query.push(("include_header", v.to_string())); - } - if let Some(v) = &invisible_to_owner { - query.push(("invisible_to_owner", v.to_string())); - } - if let Some(v) = &job_id { - query.push(("job_id", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all queued jobs - -Sends a `GET` request to `/w/{workspace}/jobs/queue/list` - -Arguments: -- `workspace` -- `all_workspaces`: get jobs from all workspaces (only valid if request come from the `admins` workspace) -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `created_by`: mask to filter exact matching user creator -- `is_not_schedule`: is not a scheduled job -- `job_kinds`: filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `per_page`: number of items to return for a given page (default 30, max 100) -- `result`: filter on jobs containing those result as a json subset (@> in postgres) -- `running`: filter on running jobs -- `schedule_path`: mask to filter by schedule path -- `scheduled_for_before_now`: filter on jobs scheduled_for before now (hence waitinf for a worker) -- `script_hash`: mask to filter exact matching path -- `script_path_exact`: mask to filter exact matching path -- `script_path_start`: mask to filter matching starting path -- `started_after`: filter on started after (exclusive) timestamp -- `started_before`: filter on started before (inclusive) timestamp -- `success`: filter on successful jobs -- `suspended`: filter on suspended jobs -- `tag`: filter on jobs with a given tag/worker group -- `worker`: worker this job was ran on -*/ - pub async fn list_queue<'a>( - &'a self, - workspace: &'a str, - all_workspaces: Option, - args: Option<&'a str>, - created_by: Option<&'a str>, - is_not_schedule: Option, - job_kinds: Option<&'a str>, - order_desc: Option, - page: Option, - parent_job: Option<&'a uuid::Uuid>, - per_page: Option, - result: Option<&'a str>, - running: Option, - schedule_path: Option<&'a str>, - scheduled_for_before_now: Option, - script_hash: Option<&'a str>, - script_path_exact: Option<&'a str>, - script_path_start: Option<&'a str>, - started_after: Option<&'a chrono::DateTime>, - started_before: Option<&'a chrono::DateTime>, - success: Option, - suspended: Option, - tag: Option<&'a str>, - worker: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/jobs/queue/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(22usize); - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &is_not_schedule { - query.push(("is_not_schedule", v.to_string())); - } - if let Some(v) = &job_kinds { - query.push(("job_kinds", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &result { - query.push(("result", v.to_string())); - } - if let Some(v) = &running { - query.push(("running", v.to_string())); - } - if let Some(v) = &schedule_path { - query.push(("schedule_path", v.to_string())); - } - if let Some(v) = &scheduled_for_before_now { - query.push(("scheduled_for_before_now", v.to_string())); - } - if let Some(v) = &script_hash { - query.push(("script_hash", v.to_string())); - } - if let Some(v) = &script_path_exact { - query.push(("script_path_exact", v.to_string())); - } - if let Some(v) = &script_path_start { - query.push(("script_path_start", v.to_string())); - } - if let Some(v) = &started_after { - query.push(("started_after", v.to_string())); - } - if let Some(v) = &started_before { - query.push(("started_before", v.to_string())); - } - if let Some(v) = &success { - query.push(("success", v.to_string())); - } - if let Some(v) = &suspended { - query.push(("suspended", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - if let Some(v) = &worker { - query.push(("worker", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get queue count - -Sends a `GET` request to `/w/{workspace}/jobs/queue/count` - -Arguments: -- `workspace` -- `all_workspaces`: get jobs from all workspaces (only valid if request come from the `admins` workspace) -*/ - pub async fn get_queue_count<'a>( - &'a self, - workspace: &'a str, - all_workspaces: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/queue/count", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get completed count - -Sends a `GET` request to `/w/{workspace}/jobs/completed/count` - -*/ - pub async fn get_completed_count<'a>( - &'a self, - workspace: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/completed/count", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**count number of completed jobs with filter - -Sends a `GET` request to `/w/{workspace}/jobs/completed/count_jobs` - -*/ - pub async fn count_completed_jobs<'a>( - &'a self, - workspace: &'a str, - all_workspaces: Option, - completed_after_s_ago: Option, - success: Option, - tags: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/completed/count_jobs", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - if let Some(v) = &completed_after_s_ago { - query.push(("completed_after_s_ago", v.to_string())); - } - if let Some(v) = &success { - query.push(("success", v.to_string())); - } - if let Some(v) = &tags { - query.push(("tags", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get the ids of all jobs matching the given filters - -Sends a `GET` request to `/w/{workspace}/jobs/queue/list_filtered_uuids` - -Arguments: -- `workspace` -- `all_workspaces`: get jobs from all workspaces (only valid if request come from the `admins` workspace) -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `concurrency_key` -- `created_by`: mask to filter exact matching user creator -- `is_not_schedule`: is not a scheduled job -- `job_kinds`: filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `per_page`: number of items to return for a given page (default 30, max 100) -- `result`: filter on jobs containing those result as a json subset (@> in postgres) -- `running`: filter on running jobs -- `schedule_path`: mask to filter by schedule path -- `scheduled_for_before_now`: filter on jobs scheduled_for before now (hence waitinf for a worker) -- `script_hash`: mask to filter exact matching path -- `script_path_exact`: mask to filter exact matching path -- `script_path_start`: mask to filter matching starting path -- `started_after`: filter on started after (exclusive) timestamp -- `started_before`: filter on started before (inclusive) timestamp -- `success`: filter on successful jobs -- `suspended`: filter on suspended jobs -- `tag`: filter on jobs with a given tag/worker group -*/ - pub async fn list_filtered_uuids<'a>( - &'a self, - workspace: &'a str, - all_workspaces: Option, - args: Option<&'a str>, - concurrency_key: Option<&'a str>, - created_by: Option<&'a str>, - is_not_schedule: Option, - job_kinds: Option<&'a str>, - order_desc: Option, - page: Option, - parent_job: Option<&'a uuid::Uuid>, - per_page: Option, - result: Option<&'a str>, - running: Option, - schedule_path: Option<&'a str>, - scheduled_for_before_now: Option, - script_hash: Option<&'a str>, - script_path_exact: Option<&'a str>, - script_path_start: Option<&'a str>, - started_after: Option<&'a chrono::DateTime>, - started_before: Option<&'a chrono::DateTime>, - success: Option, - suspended: Option, - tag: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/jobs/queue/list_filtered_uuids", self.baseurl, encode_path(& - workspace.to_string()), - ); - let mut query = Vec::with_capacity(22usize); - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &concurrency_key { - query.push(("concurrency_key", v.to_string())); - } - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &is_not_schedule { - query.push(("is_not_schedule", v.to_string())); - } - if let Some(v) = &job_kinds { - query.push(("job_kinds", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &result { - query.push(("result", v.to_string())); - } - if let Some(v) = &running { - query.push(("running", v.to_string())); - } - if let Some(v) = &schedule_path { - query.push(("schedule_path", v.to_string())); - } - if let Some(v) = &scheduled_for_before_now { - query.push(("scheduled_for_before_now", v.to_string())); - } - if let Some(v) = &script_hash { - query.push(("script_hash", v.to_string())); - } - if let Some(v) = &script_path_exact { - query.push(("script_path_exact", v.to_string())); - } - if let Some(v) = &script_path_start { - query.push(("script_path_start", v.to_string())); - } - if let Some(v) = &started_after { - query.push(("started_after", v.to_string())); - } - if let Some(v) = &started_before { - query.push(("started_before", v.to_string())); - } - if let Some(v) = &success { - query.push(("success", v.to_string())); - } - if let Some(v) = &suspended { - query.push(("suspended", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**cancel jobs based on the given uuids - -Sends a `POST` request to `/w/{workspace}/jobs/queue/cancel_selection` - -Arguments: -- `workspace` -- `body`: uuids of the jobs to cancel -*/ - pub async fn cancel_selection<'a>( - &'a self, - workspace: &'a str, - body: &'a Vec, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/jobs/queue/cancel_selection", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all completed jobs - -Sends a `GET` request to `/w/{workspace}/jobs/completed/list` - -Arguments: -- `workspace` -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `created_by`: mask to filter exact matching user creator -- `has_null_parent`: has null parent -- `is_flow_step`: is the job a flow step -- `is_not_schedule`: is not a scheduled job -- `is_skipped`: is the job skipped -- `job_kinds`: filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, -- `label`: mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') -- `order_desc`: order by desc order (default true) -- `page`: which page to return (start at 1, default 1) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `per_page`: number of items to return for a given page (default 30, max 100) -- `result`: filter on jobs containing those result as a json subset (@> in postgres) -- `schedule_path`: mask to filter by schedule path -- `script_hash`: mask to filter exact matching path -- `script_path_exact`: mask to filter exact matching path -- `script_path_start`: mask to filter matching starting path -- `started_after`: filter on started after (exclusive) timestamp -- `started_before`: filter on started before (inclusive) timestamp -- `success`: filter on successful jobs -- `tag`: filter on jobs with a given tag/worker group -- `worker`: worker this job was ran on -*/ - pub async fn list_completed_jobs<'a>( - &'a self, - workspace: &'a str, - args: Option<&'a str>, - created_by: Option<&'a str>, - has_null_parent: Option, - is_flow_step: Option, - is_not_schedule: Option, - is_skipped: Option, - job_kinds: Option<&'a str>, - label: Option<&'a str>, - order_desc: Option, - page: Option, - parent_job: Option<&'a uuid::Uuid>, - per_page: Option, - result: Option<&'a str>, - schedule_path: Option<&'a str>, - script_hash: Option<&'a str>, - script_path_exact: Option<&'a str>, - script_path_start: Option<&'a str>, - started_after: Option<&'a chrono::DateTime>, - started_before: Option<&'a chrono::DateTime>, - success: Option, - tag: Option<&'a str>, - worker: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/jobs/completed/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(22usize); - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &has_null_parent { - query.push(("has_null_parent", v.to_string())); - } - if let Some(v) = &is_flow_step { - query.push(("is_flow_step", v.to_string())); - } - if let Some(v) = &is_not_schedule { - query.push(("is_not_schedule", v.to_string())); - } - if let Some(v) = &is_skipped { - query.push(("is_skipped", v.to_string())); - } - if let Some(v) = &job_kinds { - query.push(("job_kinds", v.to_string())); - } - if let Some(v) = &label { - query.push(("label", v.to_string())); - } - if let Some(v) = &order_desc { - query.push(("order_desc", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &result { - query.push(("result", v.to_string())); - } - if let Some(v) = &schedule_path { - query.push(("schedule_path", v.to_string())); - } - if let Some(v) = &script_hash { - query.push(("script_hash", v.to_string())); - } - if let Some(v) = &script_path_exact { - query.push(("script_path_exact", v.to_string())); - } - if let Some(v) = &script_path_start { - query.push(("script_path_start", v.to_string())); - } - if let Some(v) = &started_after { - query.push(("started_after", v.to_string())); - } - if let Some(v) = &started_before { - query.push(("started_before", v.to_string())); - } - if let Some(v) = &success { - query.push(("success", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - if let Some(v) = &worker { - query.push(("worker", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list all jobs - -Sends a `GET` request to `/w/{workspace}/jobs/list` - -Arguments: -- `workspace` -- `all_workspaces`: get jobs from all workspaces (only valid if request come from the `admins` workspace) -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `created_after`: filter on created after (exclusive) timestamp -- `created_before`: filter on created before (inclusive) timestamp -- `created_by`: mask to filter exact matching user creator -- `created_or_started_after`: filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp -- `created_or_started_after_completed_jobs`: filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp but only for the completed jobs -- `created_or_started_before`: filter on created_at for non non started job and started_at otherwise before (inclusive) timestamp -- `has_null_parent`: has null parent -- `is_flow_step`: is the job a flow step -- `is_not_schedule`: is not a scheduled job -- `is_skipped`: is the job skipped -- `job_kinds`: filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, -- `label`: mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') -- `page`: which page to return (start at 1, default 1) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `per_page`: number of items to return for a given page (default 30, max 100) -- `result`: filter on jobs containing those result as a json subset (@> in postgres) -- `running`: filter on running jobs -- `schedule_path`: mask to filter by schedule path -- `scheduled_for_before_now`: filter on jobs scheduled_for before now (hence waitinf for a worker) -- `script_hash`: mask to filter exact matching path -- `script_path_exact`: mask to filter exact matching path -- `script_path_start`: mask to filter matching starting path -- `started_after`: filter on started after (exclusive) timestamp -- `started_before`: filter on started before (inclusive) timestamp -- `success`: filter on successful jobs -- `suspended`: filter on suspended jobs -- `tag`: filter on jobs with a given tag/worker group -- `worker`: worker this job was ran on -*/ - pub async fn list_jobs<'a>( - &'a self, - workspace: &'a str, - all_workspaces: Option, - args: Option<&'a str>, - created_after: Option<&'a chrono::DateTime>, - created_before: Option<&'a chrono::DateTime>, - created_by: Option<&'a str>, - created_or_started_after: Option<&'a chrono::DateTime>, - created_or_started_after_completed_jobs: Option< - &'a chrono::DateTime, - >, - created_or_started_before: Option<&'a chrono::DateTime>, - has_null_parent: Option, - is_flow_step: Option, - is_not_schedule: Option, - is_skipped: Option, - job_kinds: Option<&'a str>, - label: Option<&'a str>, - page: Option, - parent_job: Option<&'a uuid::Uuid>, - per_page: Option, - result: Option<&'a str>, - running: Option, - schedule_path: Option<&'a str>, - scheduled_for_before_now: Option, - script_hash: Option<&'a str>, - script_path_exact: Option<&'a str>, - script_path_start: Option<&'a str>, - started_after: Option<&'a chrono::DateTime>, - started_before: Option<&'a chrono::DateTime>, - success: Option, - suspended: Option, - tag: Option<&'a str>, - worker: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/jobs/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(30usize); - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &created_after { - query.push(("created_after", v.to_string())); - } - if let Some(v) = &created_before { - query.push(("created_before", v.to_string())); - } - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &created_or_started_after { - query.push(("created_or_started_after", v.to_string())); - } - if let Some(v) = &created_or_started_after_completed_jobs { - query.push(("created_or_started_after_completed_jobs", v.to_string())); - } - if let Some(v) = &created_or_started_before { - query.push(("created_or_started_before", v.to_string())); - } - if let Some(v) = &has_null_parent { - query.push(("has_null_parent", v.to_string())); - } - if let Some(v) = &is_flow_step { - query.push(("is_flow_step", v.to_string())); - } - if let Some(v) = &is_not_schedule { - query.push(("is_not_schedule", v.to_string())); - } - if let Some(v) = &is_skipped { - query.push(("is_skipped", v.to_string())); - } - if let Some(v) = &job_kinds { - query.push(("job_kinds", v.to_string())); - } - if let Some(v) = &label { - query.push(("label", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &result { - query.push(("result", v.to_string())); - } - if let Some(v) = &running { - query.push(("running", v.to_string())); - } - if let Some(v) = &schedule_path { - query.push(("schedule_path", v.to_string())); - } - if let Some(v) = &scheduled_for_before_now { - query.push(("scheduled_for_before_now", v.to_string())); - } - if let Some(v) = &script_hash { - query.push(("script_hash", v.to_string())); - } - if let Some(v) = &script_path_exact { - query.push(("script_path_exact", v.to_string())); - } - if let Some(v) = &script_path_start { - query.push(("script_path_start", v.to_string())); - } - if let Some(v) = &started_after { - query.push(("started_after", v.to_string())); - } - if let Some(v) = &started_before { - query.push(("started_before", v.to_string())); - } - if let Some(v) = &success { - query.push(("success", v.to_string())); - } - if let Some(v) = &suspended { - query.push(("suspended", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - if let Some(v) = &worker { - query.push(("worker", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get db clock - -Sends a `GET` request to `/jobs/db_clock` - -*/ - pub async fn get_db_clock<'a>(&'a self) -> Result, Error<()>> { - let url = format!("{}/jobs/db_clock", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Count jobs by tag - -Sends a `GET` request to `/jobs/completed/count_by_tag` - -Arguments: -- `horizon_secs`: Past Time horizon in seconds (when to start the count = now - horizon) (default is 3600) -- `workspace_id`: Specific workspace ID to filter results (optional) -*/ - pub async fn count_jobs_by_tag<'a>( - &'a self, - horizon_secs: Option, - workspace_id: Option<&'a str>, - ) -> Result>, Error<()>> { - let url = format!("{}/jobs/completed/count_by_tag", self.baseurl,); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &horizon_secs { - query.push(("horizon_secs", v.to_string())); - } - if let Some(v) = &workspace_id { - query.push(("workspace_id", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job - -Sends a `GET` request to `/w/{workspace}/jobs_u/get/{id}` - -*/ - pub async fn get_job<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - no_logs: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& id.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &no_logs { - query.push(("no_logs", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get root job id - -Sends a `GET` request to `/w/{workspace}/jobs_u/get_root_job_id/{id}` - -*/ - pub async fn get_root_job_id<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get_root_job_id/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job logs - -Sends a `GET` request to `/w/{workspace}/jobs_u/get_logs/{id}` - -*/ - pub async fn get_job_logs<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get_logs/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job args - -Sends a `GET` request to `/w/{workspace}/jobs_u/get_args/{id}` - -*/ - pub async fn get_job_args<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get_args/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job updates - -Sends a `GET` request to `/w/{workspace}/jobs_u/getupdate/{id}` - -*/ - pub async fn get_job_updates<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - get_progress: Option, - log_offset: Option, - running: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/getupdate/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &get_progress { - query.push(("get_progress", v.to_string())); - } - if let Some(v) = &log_offset { - query.push(("log_offset", v.to_string())); - } - if let Some(v) = &running { - query.push(("running", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get log file from object store - -Sends a `GET` request to `/w/{workspace}/jobs_u/get_log_file/{path}` - -*/ - pub async fn get_log_file_from_store<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get_log_file/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow debug info - -Sends a `GET` request to `/w/{workspace}/jobs_u/get_flow_debug_info/{id}` - -*/ - pub async fn get_flow_debug_info<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get_flow_debug_info/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get completed job - -Sends a `GET` request to `/w/{workspace}/jobs_u/completed/get/{id}` - -*/ - pub async fn get_completed_job<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/completed/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get completed job result - -Sends a `GET` request to `/w/{workspace}/jobs_u/completed/get_result/{id}` - -*/ - pub async fn get_completed_job_result<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - approver: Option<&'a str>, - resume_id: Option, - secret: Option<&'a str>, - suspended_job: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/completed/get_result/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& id.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - if let Some(v) = &resume_id { - query.push(("resume_id", v.to_string())); - } - if let Some(v) = &secret { - query.push(("secret", v.to_string())); - } - if let Some(v) = &suspended_job { - query.push(("suspended_job", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get completed job result if job is completed - -Sends a `GET` request to `/w/{workspace}/jobs_u/completed/get_result_maybe/{id}` - -*/ - pub async fn get_completed_job_result_maybe<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - get_started: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/completed/get_result_maybe/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& id.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &get_started { - query.push(("get_started", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete completed job (erase content but keep run id) - -Sends a `POST` request to `/w/{workspace}/jobs/completed/delete/{id}` - -*/ - pub async fn delete_completed_job<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/completed/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**cancel queued or running job - -Sends a `POST` request to `/w/{workspace}/jobs_u/queue/cancel/{id}` - -Arguments: -- `workspace` -- `id` -- `body`: reason -*/ - pub async fn cancel_queued_job<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - body: &'a types::CancelQueuedJobBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/queue/cancel/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**cancel all queued jobs for persistent script - -Sends a `POST` request to `/w/{workspace}/jobs_u/queue/cancel_persistent/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: reason -*/ - pub async fn cancel_persistent_queued_jobs<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::CancelPersistentQueuedJobsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/queue/cancel_persistent/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**force cancel queued job - -Sends a `POST` request to `/w/{workspace}/jobs_u/queue/force_cancel/{id}` - -Arguments: -- `workspace` -- `id` -- `body`: reason -*/ - pub async fn force_cancel_queued_job<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - body: &'a types::ForceCancelQueuedJobBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/queue/force_cancel/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create an HMac signature given a job id and a resume id - -Sends a `GET` request to `/w/{workspace}/jobs/job_signature/{id}/{resume_id}` - -*/ - pub async fn create_job_signature<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - approver: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/job_signature/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get resume urls given a job_id, resume_id and a nonce to resume a flow - -Sends a `GET` request to `/w/{workspace}/jobs/resume_urls/{id}/{resume_id}` - -*/ - pub async fn get_resume_urls<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - approver: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/resume_urls/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**generate interactive slack approval for suspended job - -Sends a `GET` request to `/w/{workspace}/jobs/slack_approval/{id}` - -*/ - pub async fn get_slack_approval_payload<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - approver: Option<&'a str>, - channel_id: &'a str, - default_args_json: Option<&'a str>, - dynamic_enums_json: Option<&'a str>, - flow_step_id: &'a str, - message: Option<&'a str>, - slack_resource_path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/slack_approval/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - query.push(("channel_id", channel_id.to_string())); - if let Some(v) = &default_args_json { - query.push(("default_args_json", v.to_string())); - } - if let Some(v) = &dynamic_enums_json { - query.push(("dynamic_enums_json", v.to_string())); - } - query.push(("flow_step_id", flow_step_id.to_string())); - if let Some(v) = &message { - query.push(("message", v.to_string())); - } - query.push(("slack_resource_path", slack_resource_path.to_string())); - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**resume a job for a suspended flow - -Sends a `GET` request to `/w/{workspace}/jobs_u/resume/{id}/{resume_id}/{signature}` - -Arguments: -- `workspace` -- `id` -- `resume_id` -- `signature` -- `approver` -- `payload`: The base64 encoded payload that has been encoded as a JSON. e.g how to encode such payload encodeURIComponent -`encodeURIComponent(btoa(JSON.stringify({a: 2})))` - -*/ - pub async fn resume_suspended_job_get<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - signature: &'a str, - approver: Option<&'a str>, - payload: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/resume/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), encode_path(& signature.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - if let Some(v) = &payload { - query.push(("payload", v.to_string())); - } - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**resume a job for a suspended flow - -Sends a `POST` request to `/w/{workspace}/jobs_u/resume/{id}/{resume_id}/{signature}` - -*/ - pub async fn resume_suspended_job_post<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - signature: &'a str, - approver: Option<&'a str>, - body: &'a std::collections::HashMap, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/resume/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), encode_path(& signature.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow user state at a given key - -Sends a `GET` request to `/w/{workspace}/jobs/flow/user_states/{id}/{key}` - -*/ - pub async fn get_flow_user_state<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - key: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/flow/user_states/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& key.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set flow user state at a given key - -Sends a `POST` request to `/w/{workspace}/jobs/flow/user_states/{id}/{key}` - -Arguments: -- `workspace` -- `id` -- `key` -- `body`: new value -*/ - pub async fn set_flow_user_state<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - key: &'a str, - body: &'a serde_json::Value, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/flow/user_states/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& key.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**resume a job for a suspended flow as an owner - -Sends a `POST` request to `/w/{workspace}/jobs/flow/resume/{id}` - -*/ - pub async fn resume_suspended_flow_as_owner<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - body: &'a std::collections::HashMap, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs/flow/resume/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**cancel a job for a suspended flow - -Sends a `GET` request to `/w/{workspace}/jobs_u/cancel/{id}/{resume_id}/{signature}` - -*/ - pub async fn cancel_suspended_job_get<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - signature: &'a str, - approver: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/cancel/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), encode_path(& signature.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**cancel a job for a suspended flow - -Sends a `POST` request to `/w/{workspace}/jobs_u/cancel/{id}/{resume_id}/{signature}` - -*/ - pub async fn cancel_suspended_job_post<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - signature: &'a str, - approver: Option<&'a str>, - body: &'a std::collections::HashMap, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/cancel/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), encode_path(& signature.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get parent flow job of suspended job - -Sends a `GET` request to `/w/{workspace}/jobs_u/get_flow/{id}/{resume_id}/{signature}` - -*/ - pub async fn get_suspended_job_flow<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - resume_id: i64, - signature: &'a str, - approver: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/jobs_u/get_flow/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), encode_path(& resume_id - .to_string()), encode_path(& signature.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &approver { - query.push(("approver", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**preview schedule - -Sends a `POST` request to `/schedules/preview` - -Arguments: -- `body`: schedule -*/ - pub async fn preview_schedule<'a>( - &'a self, - body: &'a types::PreviewScheduleBody, - ) -> Result>>, Error<()>> { - let url = format!("{}/schedules/preview", self.baseurl,); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create schedule - -Sends a `POST` request to `/w/{workspace}/schedules/create` - -Arguments: -- `workspace` -- `body`: new schedule -*/ - pub async fn create_schedule<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewSchedule, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update schedule - -Sends a `POST` request to `/w/{workspace}/schedules/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated schedule -*/ - pub async fn update_schedule<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditSchedule, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled schedule - -Sends a `POST` request to `/w/{workspace}/schedules/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated schedule enable -*/ - pub async fn set_schedule_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetScheduleEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/setenabled/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete schedule - -Sends a `DELETE` request to `/w/{workspace}/schedules/delete/{path}` - -*/ - pub async fn delete_schedule<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get schedule - -Sends a `GET` request to `/w/{workspace}/schedules/get/{path}` - -*/ - pub async fn get_schedule<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does schedule exists - -Sends a `GET` request to `/w/{workspace}/schedules/exists/{path}` - -*/ - pub async fn exists_schedule<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list schedules - -Sends a `GET` request to `/w/{workspace}/schedules/list` - -Arguments: -- `workspace` -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_schedules<'a>( - &'a self, - workspace: &'a str, - args: Option<&'a str>, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/schedules/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(6usize); - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list schedules with last 20 jobs - -Sends a `GET` request to `/w/{workspace}/schedules/list_with_jobs` - -Arguments: -- `workspace` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_schedules_with_jobs<'a>( - &'a self, - workspace: &'a str, - page: Option, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/schedules/list_with_jobs", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Set default error or recoevery handler - -Sends a `POST` request to `/w/{workspace}/schedules/setdefaulthandler` - -Arguments: -- `workspace` -- `body`: Handler description -*/ - pub async fn set_default_error_or_recovery_handler<'a>( - &'a self, - workspace: &'a str, - body: &'a types::SetDefaultErrorOrRecoveryHandlerBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/setdefaulthandler", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create http trigger - -Sends a `POST` request to `/w/{workspace}/http_triggers/create` - -Arguments: -- `workspace` -- `body`: new http trigger -*/ - pub async fn create_http_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewHttpTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update http trigger - -Sends a `POST` request to `/w/{workspace}/http_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_http_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditHttpTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete http trigger - -Sends a `DELETE` request to `/w/{workspace}/http_triggers/delete/{path}` - -*/ - pub async fn delete_http_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get http trigger - -Sends a `GET` request to `/w/{workspace}/http_triggers/get/{path}` - -*/ - pub async fn get_http_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list http triggers - -Sends a `GET` request to `/w/{workspace}/http_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_http_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does http trigger exists - -Sends a `GET` request to `/w/{workspace}/http_triggers/exists/{path}` - -*/ - pub async fn exists_http_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does route exists - -Sends a `POST` request to `/w/{workspace}/http_triggers/route_exists` - -Arguments: -- `workspace` -- `body`: route exists request -*/ - pub async fn exists_route<'a>( - &'a self, - workspace: &'a str, - body: &'a types::ExistsRouteBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/http_triggers/route_exists", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create websocket trigger - -Sends a `POST` request to `/w/{workspace}/websocket_triggers/create` - -Arguments: -- `workspace` -- `body`: new websocket trigger -*/ - pub async fn create_websocket_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewWebsocketTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update websocket trigger - -Sends a `POST` request to `/w/{workspace}/websocket_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_websocket_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditWebsocketTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete websocket trigger - -Sends a `DELETE` request to `/w/{workspace}/websocket_triggers/delete/{path}` - -*/ - pub async fn delete_websocket_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get websocket trigger - -Sends a `GET` request to `/w/{workspace}/websocket_triggers/get/{path}` - -*/ - pub async fn get_websocket_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list websocket triggers - -Sends a `GET` request to `/w/{workspace}/websocket_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_websocket_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does websocket trigger exists - -Sends a `GET` request to `/w/{workspace}/websocket_triggers/exists/{path}` - -*/ - pub async fn exists_websocket_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled websocket trigger - -Sends a `POST` request to `/w/{workspace}/websocket_triggers/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated websocket trigger enable -*/ - pub async fn set_websocket_trigger_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetWebsocketTriggerEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/setenabled/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test websocket connection - -Sends a `POST` request to `/w/{workspace}/websocket_triggers/test` - -Arguments: -- `workspace` -- `body`: test websocket connection -*/ - pub async fn test_websocket_connection<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TestWebsocketConnectionBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/websocket_triggers/test", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create kafka trigger - -Sends a `POST` request to `/w/{workspace}/kafka_triggers/create` - -Arguments: -- `workspace` -- `body`: new kafka trigger -*/ - pub async fn create_kafka_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewKafkaTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update kafka trigger - -Sends a `POST` request to `/w/{workspace}/kafka_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_kafka_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditKafkaTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete kafka trigger - -Sends a `DELETE` request to `/w/{workspace}/kafka_triggers/delete/{path}` - -*/ - pub async fn delete_kafka_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get kafka trigger - -Sends a `GET` request to `/w/{workspace}/kafka_triggers/get/{path}` - -*/ - pub async fn get_kafka_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list kafka triggers - -Sends a `GET` request to `/w/{workspace}/kafka_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_kafka_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does kafka trigger exists - -Sends a `GET` request to `/w/{workspace}/kafka_triggers/exists/{path}` - -*/ - pub async fn exists_kafka_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled kafka trigger - -Sends a `POST` request to `/w/{workspace}/kafka_triggers/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated kafka trigger enable -*/ - pub async fn set_kafka_trigger_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetKafkaTriggerEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/setenabled/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test kafka connection - -Sends a `POST` request to `/w/{workspace}/kafka_triggers/test` - -Arguments: -- `workspace` -- `body`: test kafka connection -*/ - pub async fn test_kafka_connection<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TestKafkaConnectionBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/kafka_triggers/test", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create nats trigger - -Sends a `POST` request to `/w/{workspace}/nats_triggers/create` - -Arguments: -- `workspace` -- `body`: new nats trigger -*/ - pub async fn create_nats_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewNatsTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update nats trigger - -Sends a `POST` request to `/w/{workspace}/nats_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_nats_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditNatsTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete nats trigger - -Sends a `DELETE` request to `/w/{workspace}/nats_triggers/delete/{path}` - -*/ - pub async fn delete_nats_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get nats trigger - -Sends a `GET` request to `/w/{workspace}/nats_triggers/get/{path}` - -*/ - pub async fn get_nats_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list nats triggers - -Sends a `GET` request to `/w/{workspace}/nats_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_nats_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does nats trigger exists - -Sends a `GET` request to `/w/{workspace}/nats_triggers/exists/{path}` - -*/ - pub async fn exists_nats_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled nats trigger - -Sends a `POST` request to `/w/{workspace}/nats_triggers/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated nats trigger enable -*/ - pub async fn set_nats_trigger_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetNatsTriggerEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/setenabled/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test NATS connection - -Sends a `POST` request to `/w/{workspace}/nats_triggers/test` - -Arguments: -- `workspace` -- `body`: test nats connection -*/ - pub async fn test_nats_connection<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TestNatsConnectionBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/nats_triggers/test", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create sqs trigger - -Sends a `POST` request to `/w/{workspace}/sqs_triggers/create` - -Arguments: -- `workspace` -- `body`: new sqs trigger -*/ - pub async fn create_sqs_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewSqsTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update sqs trigger - -Sends a `POST` request to `/w/{workspace}/sqs_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_sqs_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditSqsTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete sqs trigger - -Sends a `DELETE` request to `/w/{workspace}/sqs_triggers/delete/{path}` - -*/ - pub async fn delete_sqs_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get sqs trigger - -Sends a `GET` request to `/w/{workspace}/sqs_triggers/get/{path}` - -*/ - pub async fn get_sqs_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list sqs triggers - -Sends a `GET` request to `/w/{workspace}/sqs_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_sqs_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does sqs trigger exists - -Sends a `GET` request to `/w/{workspace}/sqs_triggers/exists/{path}` - -*/ - pub async fn exists_sqs_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled sqs trigger - -Sends a `POST` request to `/w/{workspace}/sqs_triggers/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated sqs trigger enable -*/ - pub async fn set_sqs_trigger_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetSqsTriggerEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/setenabled/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test sqs connection - -Sends a `POST` request to `/w/{workspace}/sqs_triggers/test` - -Arguments: -- `workspace` -- `body`: test sqs connection -*/ - pub async fn test_sqs_connection<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TestSqsConnectionBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/sqs_triggers/test", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create mqtt trigger - -Sends a `POST` request to `/w/{workspace}/mqtt_triggers/create` - -Arguments: -- `workspace` -- `body`: new mqtt trigger -*/ - pub async fn create_mqtt_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewMqttTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update mqtt trigger - -Sends a `POST` request to `/w/{workspace}/mqtt_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_mqtt_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditMqttTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete mqtt trigger - -Sends a `DELETE` request to `/w/{workspace}/mqtt_triggers/delete/{path}` - -*/ - pub async fn delete_mqtt_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get mqtt trigger - -Sends a `GET` request to `/w/{workspace}/mqtt_triggers/get/{path}` - -*/ - pub async fn get_mqtt_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list mqtt triggers - -Sends a `GET` request to `/w/{workspace}/mqtt_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_mqtt_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does mqtt trigger exists - -Sends a `GET` request to `/w/{workspace}/mqtt_triggers/exists/{path}` - -*/ - pub async fn exists_mqtt_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled mqtt trigger - -Sends a `POST` request to `/w/{workspace}/mqtt_triggers/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated mqtt trigger enable -*/ - pub async fn set_mqtt_trigger_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetMqttTriggerEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/setenabled/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test mqtt connection - -Sends a `POST` request to `/w/{workspace}/mqtt_triggers/test` - -Arguments: -- `workspace` -- `body`: test mqtt connection -*/ - pub async fn test_mqtt_connection<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TestMqttConnectionBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/mqtt_triggers/test", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**check if postgres configuration is set to logical - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/is_valid_postgres_configuration/{path}` - -*/ - pub async fn is_valid_postgres_configuration<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/is_valid_postgres_configuration/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create template script - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/create_template_script` - -Arguments: -- `workspace` -- `body`: template script -*/ - pub async fn create_template_script<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TemplateScript, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/create_template_script", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get template script - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/get_template_script/{id}` - -*/ - pub async fn get_template_script<'a>( - &'a self, - workspace: &'a str, - id: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/get_template_script/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& id.to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list postgres replication slot - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/slot/list/{path}` - -*/ - pub async fn list_postgres_replication_slot<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/slot/list/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create replication slot for postgres - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/slot/create/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: new slot for postgres -*/ - pub async fn create_postgres_replication_slot<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::Slot, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/slot/create/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete postgres replication slot - -Sends a `DELETE` request to `/w/{workspace}/postgres_triggers/slot/delete/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: replication slot of postgres -*/ - pub async fn delete_postgres_replication_slot<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::Slot, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/slot/delete/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list postgres publication - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/publication/list/{path}` - -*/ - pub async fn list_postgres_publication<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/publication/list/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get postgres publication - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/publication/get/{publication}/{path}` - -*/ - pub async fn get_postgres_publication<'a>( - &'a self, - workspace: &'a str, - publication: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/publication/get/{}/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& publication.to_string()), - encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create publication for postgres - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/publication/create/{publication}/{path}` - -Arguments: -- `workspace` -- `publication` -- `path` -- `body`: new publication for postgres -*/ - pub async fn create_postgres_publication<'a>( - &'a self, - workspace: &'a str, - publication: &'a str, - path: &'a str, - body: &'a types::PublicationData, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/publication/create/{}/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& publication.to_string()), - encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update publication for postgres - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/publication/update/{publication}/{path}` - -Arguments: -- `workspace` -- `publication` -- `path` -- `body`: update publication for postgres -*/ - pub async fn update_postgres_publication<'a>( - &'a self, - workspace: &'a str, - publication: &'a str, - path: &'a str, - body: &'a types::PublicationData, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/publication/update/{}/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& publication.to_string()), - encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete postgres publication - -Sends a `DELETE` request to `/w/{workspace}/postgres_triggers/publication/delete/{publication}/{path}` - -*/ - pub async fn delete_postgres_publication<'a>( - &'a self, - workspace: &'a str, - publication: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/publication/delete/{}/{}", self.baseurl, - encode_path(& workspace.to_string()), encode_path(& publication.to_string()), - encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create postgres trigger - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/create` - -Arguments: -- `workspace` -- `body`: new postgres trigger -*/ - pub async fn create_postgres_trigger<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewPostgresTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update postgres trigger - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated trigger -*/ - pub async fn update_postgres_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditPostgresTrigger, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete postgres trigger - -Sends a `DELETE` request to `/w/{workspace}/postgres_triggers/delete/{path}` - -*/ - pub async fn delete_postgres_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get postgres trigger - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/get/{path}` - -*/ - pub async fn get_postgres_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list postgres triggers - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/list` - -Arguments: -- `workspace` -- `is_flow` -- `page`: which page to return (start at 1, default 1) -- `path`: filter by path -- `path_start` -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_postgres_triggers<'a>( - &'a self, - workspace: &'a str, - is_flow: Option, - page: Option, - path: Option<&'a str>, - path_start: Option<&'a str>, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/list", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(5usize); - if let Some(v) = &is_flow { - query.push(("is_flow", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &path { - query.push(("path", v.to_string())); - } - if let Some(v) = &path_start { - query.push(("path_start", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**does postgres trigger exists - -Sends a `GET` request to `/w/{workspace}/postgres_triggers/exists/{path}` - -*/ - pub async fn exists_postgres_trigger<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set enabled postgres trigger - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/setenabled/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated postgres trigger enable -*/ - pub async fn set_postgres_trigger_enabled<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::SetPostgresTriggerEnabledBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/setenabled/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**test postgres connection - -Sends a `POST` request to `/w/{workspace}/postgres_triggers/test` - -Arguments: -- `workspace` -- `body`: test postgres connection -*/ - pub async fn test_postgres_connection<'a>( - &'a self, - workspace: &'a str, - body: &'a types::TestPostgresConnectionBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/postgres_triggers/test", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list instance groups - -Sends a `GET` request to `/groups/list` - -*/ - pub async fn list_instance_groups<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/groups/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get instance group - -Sends a `GET` request to `/groups/get/{name}` - -*/ - pub async fn get_instance_group<'a>( - &'a self, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/groups/get/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create instance group - -Sends a `POST` request to `/groups/create` - -Arguments: -- `body`: create instance group -*/ - pub async fn create_instance_group<'a>( - &'a self, - body: &'a types::CreateInstanceGroupBody, - ) -> Result, Error<()>> { - let url = format!("{}/groups/create", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update instance group - -Sends a `POST` request to `/groups/update/{name}` - -Arguments: -- `name` -- `body`: update instance group -*/ - pub async fn update_instance_group<'a>( - &'a self, - name: &'a str, - body: &'a types::UpdateInstanceGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/groups/update/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete instance group - -Sends a `DELETE` request to `/groups/delete/{name}` - -*/ - pub async fn delete_instance_group<'a>( - &'a self, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/groups/delete/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**add user to instance group - -Sends a `POST` request to `/groups/adduser/{name}` - -Arguments: -- `name` -- `body`: user to add to instance group -*/ - pub async fn add_user_to_instance_group<'a>( - &'a self, - name: &'a str, - body: &'a types::AddUserToInstanceGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/groups/adduser/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**remove user from instance group - -Sends a `POST` request to `/groups/removeuser/{name}` - -Arguments: -- `name` -- `body`: user to remove from instance group -*/ - pub async fn remove_user_from_instance_group<'a>( - &'a self, - name: &'a str, - body: &'a types::RemoveUserFromInstanceGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/groups/removeuser/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**export instance groups - -Sends a `GET` request to `/groups/export` - -*/ - pub async fn export_instance_groups<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/groups/export", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**overwrite instance groups - -Sends a `POST` request to `/groups/overwrite` - -Arguments: -- `body`: overwrite instance groups -*/ - pub async fn overwrite_instance_groups<'a>( - &'a self, - body: &'a Vec, - ) -> Result, Error<()>> { - let url = format!("{}/groups/overwrite", self.baseurl,); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list groups - -Sends a `GET` request to `/w/{workspace}/groups/list` - -Arguments: -- `workspace` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_groups<'a>( - &'a self, - workspace: &'a str, - page: Option, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/groups/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list group names - -Sends a `GET` request to `/w/{workspace}/groups/listnames` - -Arguments: -- `workspace` -- `only_member_of`: only list the groups the user is member of (default false) -*/ - pub async fn list_group_names<'a>( - &'a self, - workspace: &'a str, - only_member_of: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/groups/listnames", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &only_member_of { - query.push(("only_member_of", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create group - -Sends a `POST` request to `/w/{workspace}/groups/create` - -Arguments: -- `workspace` -- `body`: create group -*/ - pub async fn create_group<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/groups/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update group - -Sends a `POST` request to `/w/{workspace}/groups/update/{name}` - -Arguments: -- `workspace` -- `name` -- `body`: updated group -*/ - pub async fn update_group<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - body: &'a types::UpdateGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/groups/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete group - -Sends a `DELETE` request to `/w/{workspace}/groups/delete/{name}` - -*/ - pub async fn delete_group<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/groups/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get group - -Sends a `GET` request to `/w/{workspace}/groups/get/{name}` - -*/ - pub async fn get_group<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/groups/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**add user to group - -Sends a `POST` request to `/w/{workspace}/groups/adduser/{name}` - -Arguments: -- `workspace` -- `name` -- `body`: added user to group -*/ - pub async fn add_user_to_group<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - body: &'a types::AddUserToGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/groups/adduser/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**remove user to group - -Sends a `POST` request to `/w/{workspace}/groups/removeuser/{name}` - -Arguments: -- `workspace` -- `name` -- `body`: added user to group -*/ - pub async fn remove_user_to_group<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - body: &'a types::RemoveUserToGroupBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/groups/removeuser/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list folders - -Sends a `GET` request to `/w/{workspace}/folders/list` - -Arguments: -- `workspace` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -*/ - pub async fn list_folders<'a>( - &'a self, - workspace: &'a str, - page: Option, - per_page: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/folders/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list folder names - -Sends a `GET` request to `/w/{workspace}/folders/listnames` - -Arguments: -- `workspace` -- `only_member_of`: only list the folders the user is member of (default false) -*/ - pub async fn list_folder_names<'a>( - &'a self, - workspace: &'a str, - only_member_of: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/folders/listnames", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &only_member_of { - query.push(("only_member_of", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create folder - -Sends a `POST` request to `/w/{workspace}/folders/create` - -Arguments: -- `workspace` -- `body`: create folder -*/ - pub async fn create_folder<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateFolderBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update folder - -Sends a `POST` request to `/w/{workspace}/folders/update/{name}` - -Arguments: -- `workspace` -- `name` -- `body`: update folder -*/ - pub async fn update_folder<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - body: &'a types::UpdateFolderBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete folder - -Sends a `DELETE` request to `/w/{workspace}/folders/delete/{name}` - -*/ - pub async fn delete_folder<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get folder - -Sends a `GET` request to `/w/{workspace}/folders/get/{name}` - -*/ - pub async fn get_folder<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists folder - -Sends a `GET` request to `/w/{workspace}/folders/exists/{name}` - -*/ - pub async fn exists_folder<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/exists/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get folder usage - -Sends a `GET` request to `/w/{workspace}/folders/getusage/{name}` - -*/ - pub async fn get_folder_usage<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/getusage/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**add owner to folder - -Sends a `POST` request to `/w/{workspace}/folders/addowner/{name}` - -Arguments: -- `workspace` -- `name` -- `body`: owner user to folder -*/ - pub async fn add_owner_to_folder<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - body: &'a types::AddOwnerToFolderBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/addowner/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**remove owner to folder - -Sends a `POST` request to `/w/{workspace}/folders/removeowner/{name}` - -Arguments: -- `workspace` -- `name` -- `body`: added owner to folder -*/ - pub async fn remove_owner_to_folder<'a>( - &'a self, - workspace: &'a str, - name: &'a str, - body: &'a types::RemoveOwnerToFolderBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/folders/removeowner/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list workers - -Sends a `GET` request to `/workers/list` - -Arguments: -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -- `ping_since`: number of seconds the worker must have had a last ping more recent of (default to 300) -*/ - pub async fn list_workers<'a>( - &'a self, - page: Option, - per_page: Option, - ping_since: Option, - ) -> Result>, Error<()>> { - let url = format!("{}/workers/list", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &ping_since { - query.push(("ping_since", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**exists worker with tag - -Sends a `GET` request to `/workers/exists_worker_with_tag` - -*/ - pub async fn exists_worker_with_tag<'a>( - &'a self, - tag: &'a str, - ) -> Result, Error<()>> { - let url = format!("{}/workers/exists_worker_with_tag", self.baseurl,); - let mut query = Vec::with_capacity(1usize); - query.push(("tag", tag.to_string())); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get queue metrics - -Sends a `GET` request to `/workers/queue_metrics` - -*/ - pub async fn get_queue_metrics<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/workers/queue_metrics", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get counts of jobs waiting for an executor per tag - -Sends a `GET` request to `/workers/queue_counts` - -*/ - pub async fn get_counts_of_jobs_waiting_per_tag<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/workers/queue_counts", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list worker groups - -Sends a `GET` request to `/configs/list_worker_groups` - -*/ - pub async fn list_worker_groups<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/configs/list_worker_groups", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get config - -Sends a `GET` request to `/configs/get/{name}` - -*/ - pub async fn get_config<'a>( - &'a self, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/configs/get/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Update config - -Sends a `POST` request to `/configs/update/{name}` - -Arguments: -- `name` -- `body`: worker group -*/ - pub async fn update_config<'a>( - &'a self, - name: &'a str, - body: &'a serde_json::Value, - ) -> Result, Error<()>> { - let url = format!( - "{}/configs/update/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Delete Config - -Sends a `DELETE` request to `/configs/update/{name}` - -*/ - pub async fn delete_config<'a>( - &'a self, - name: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/configs/update/{}", self.baseurl, encode_path(& name.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list configs - -Sends a `GET` request to `/configs/list` - -*/ - pub async fn list_configs<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/configs/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**List autoscaling events - -Sends a `GET` request to `/configs/list_autoscaling_events/{worker_group}` - -*/ - pub async fn list_autoscaling_events<'a>( - &'a self, - worker_group: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/configs/list_autoscaling_events/{}", self.baseurl, encode_path(& - worker_group.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get granular acls - -Sends a `GET` request to `/w/{workspace}/acls/get/{kind}/{path}` - -*/ - pub async fn get_granular_acls<'a>( - &'a self, - workspace: &'a str, - kind: types::GetGranularAclsKind, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/acls/get/{}/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& kind.to_string()), encode_path(& path.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**add granular acls - -Sends a `POST` request to `/w/{workspace}/acls/add/{kind}/{path}` - -Arguments: -- `workspace` -- `kind` -- `path` -- `body`: acl to add -*/ - pub async fn add_granular_acls<'a>( - &'a self, - workspace: &'a str, - kind: types::AddGranularAclsKind, - path: &'a str, - body: &'a types::AddGranularAclsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/acls/add/{}/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& kind.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**remove granular acls - -Sends a `POST` request to `/w/{workspace}/acls/remove/{kind}/{path}` - -Arguments: -- `workspace` -- `kind` -- `path` -- `body`: acl to add -*/ - pub async fn remove_granular_acls<'a>( - &'a self, - workspace: &'a str, - kind: types::RemoveGranularAclsKind, - path: &'a str, - body: &'a types::RemoveGranularAclsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/acls/remove/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& kind.to_string()), encode_path(& path - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set capture config - -Sends a `POST` request to `/w/{workspace}/capture/set_config` - -Arguments: -- `workspace` -- `body`: capture config -*/ - pub async fn set_capture_config<'a>( - &'a self, - workspace: &'a str, - body: &'a types::SetCaptureConfigBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/capture/set_config", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**ping capture config - -Sends a `POST` request to `/w/{workspace}/capture/ping_config/{trigger_kind}/{runnable_kind}/{path}` - -*/ - pub async fn ping_capture_config<'a>( - &'a self, - workspace: &'a str, - trigger_kind: types::CaptureTriggerKind, - runnable_kind: types::PingCaptureConfigRunnableKind, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/capture/ping_config/{}/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& trigger_kind.to_string()), encode_path(& - runnable_kind.to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get capture configs for a script or flow - -Sends a `GET` request to `/w/{workspace}/capture/get_configs/{runnable_kind}/{path}` - -*/ - pub async fn get_capture_configs<'a>( - &'a self, - workspace: &'a str, - runnable_kind: types::GetCaptureConfigsRunnableKind, - path: &'a str, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/capture/get_configs/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& runnable_kind.to_string()), encode_path(& path - .to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list captures for a script or flow - -Sends a `GET` request to `/w/{workspace}/capture/list/{runnable_kind}/{path}` - -Arguments: -- `workspace` -- `runnable_kind` -- `path` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -- `trigger_kind` -*/ - pub async fn list_captures<'a>( - &'a self, - workspace: &'a str, - runnable_kind: types::ListCapturesRunnableKind, - path: &'a str, - page: Option, - per_page: Option, - trigger_kind: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/capture/list/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& runnable_kind.to_string()), encode_path(& path - .to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &trigger_kind { - query.push(("trigger_kind", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**move captures and configs for a script or flow - -Sends a `POST` request to `/w/{workspace}/capture/move/{runnable_kind}/{path}` - -Arguments: -- `workspace` -- `runnable_kind` -- `path` -- `body`: move captures and configs to a new path -*/ - pub async fn move_captures_and_configs<'a>( - &'a self, - workspace: &'a str, - runnable_kind: types::MoveCapturesAndConfigsRunnableKind, - path: &'a str, - body: &'a types::MoveCapturesAndConfigsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/capture/move/{}/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& runnable_kind.to_string()), encode_path(& path - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get a capture - -Sends a `GET` request to `/w/{workspace}/capture/{id}` - -*/ - pub async fn get_capture<'a>( - &'a self, - workspace: &'a str, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/capture/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**delete a capture - -Sends a `DELETE` request to `/w/{workspace}/capture/{id}` - -*/ - pub async fn delete_capture<'a>( - &'a self, - workspace: &'a str, - id: i64, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/capture/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& id.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**star item - -Sends a `POST` request to `/w/{workspace}/favorites/star` - -*/ - pub async fn star<'a>( - &'a self, - workspace: &'a str, - body: &'a types::StarBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/favorites/star", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**unstar item - -Sends a `POST` request to `/w/{workspace}/favorites/unstar` - -*/ - pub async fn unstar<'a>( - &'a self, - workspace: &'a str, - body: &'a types::UnstarBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/favorites/unstar", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::empty(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**List Inputs used in previously completed jobs - -Sends a `GET` request to `/w/{workspace}/inputs/history` - -Arguments: -- `workspace` -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `include_preview` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -- `runnable_id` -- `runnable_type` -*/ - pub async fn get_input_history<'a>( - &'a self, - workspace: &'a str, - args: Option<&'a str>, - include_preview: Option, - page: Option, - per_page: Option, - runnable_id: Option<&'a str>, - runnable_type: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/inputs/history", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(6usize); - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &include_preview { - query.push(("include_preview", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &runnable_id { - query.push(("runnable_id", v.to_string())); - } - if let Some(v) = &runnable_type { - query.push(("runnable_type", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Get args from history or saved input - -Sends a `GET` request to `/w/{workspace}/inputs/{jobOrInputId}/args` - -*/ - pub async fn get_args_from_history_or_saved_input<'a>( - &'a self, - workspace: &'a str, - job_or_input_id: &'a str, - allow_large: Option, - input: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/inputs/{}/args", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& job_or_input_id.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &allow_large { - query.push(("allow_large", v.to_string())); - } - if let Some(v) = &input { - query.push(("input", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**List saved Inputs for a Runnable - -Sends a `GET` request to `/w/{workspace}/inputs/list` - -Arguments: -- `workspace` -- `page`: which page to return (start at 1, default 1) -- `per_page`: number of items to return for a given page (default 30, max 100) -- `runnable_id` -- `runnable_type` -*/ - pub async fn list_inputs<'a>( - &'a self, - workspace: &'a str, - page: Option, - per_page: Option, - runnable_id: Option<&'a str>, - runnable_type: Option, - ) -> Result>, Error<()>> { - let url = format!( - "{}/w/{}/inputs/list", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &runnable_id { - query.push(("runnable_id", v.to_string())); - } - if let Some(v) = &runnable_type { - query.push(("runnable_type", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Create an Input for future use in a script or flow - -Sends a `POST` request to `/w/{workspace}/inputs/create` - -Arguments: -- `workspace` -- `runnable_id` -- `runnable_type` -- `body`: Input -*/ - pub async fn create_input<'a>( - &'a self, - workspace: &'a str, - runnable_id: Option<&'a str>, - runnable_type: Option, - body: &'a types::CreateInput, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/inputs/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - if let Some(v) = &runnable_id { - query.push(("runnable_id", v.to_string())); - } - if let Some(v) = &runnable_type { - query.push(("runnable_type", v.to_string())); - } - let request = self.client.post(url).json(&body).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Update an Input - -Sends a `POST` request to `/w/{workspace}/inputs/update` - -Arguments: -- `workspace` -- `body`: UpdateInput -*/ - pub async fn update_input<'a>( - &'a self, - workspace: &'a str, - body: &'a types::UpdateInput, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/inputs/update", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Delete a Saved Input - -Sends a `POST` request to `/w/{workspace}/inputs/delete/{input}` - -*/ - pub async fn delete_input<'a>( - &'a self, - workspace: &'a str, - input: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/inputs/delete/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& input.to_string()), - ); - let request = self.client.post(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Converts an S3 resource to the set of instructions necessary to connect DuckDB to an S3 bucket - -Sends a `POST` request to `/w/{workspace}/job_helpers/duckdb_connection_settings` - -Arguments: -- `workspace` -- `body`: S3 resource to connect to -*/ - pub async fn duckdb_connection_settings<'a>( - &'a self, - workspace: &'a str, - body: &'a types::DuckdbConnectionSettingsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/duckdb_connection_settings", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Converts an S3 resource to the set of instructions necessary to connect DuckDB to an S3 bucket - -Sends a `POST` request to `/w/{workspace}/job_helpers/v2/duckdb_connection_settings` - -Arguments: -- `workspace` -- `body`: S3 resource path to use to generate the connection settings. If empty, the S3 resource defined in the workspace settings will be used -*/ - pub async fn duckdb_connection_settings_v2<'a>( - &'a self, - workspace: &'a str, - body: &'a types::DuckdbConnectionSettingsV2Body, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/v2/duckdb_connection_settings", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Converts an S3 resource to the set of arguments necessary to connect Polars to an S3 bucket - -Sends a `POST` request to `/w/{workspace}/job_helpers/polars_connection_settings` - -Arguments: -- `workspace` -- `body`: S3 resource to connect to -*/ - pub async fn polars_connection_settings<'a>( - &'a self, - workspace: &'a str, - body: &'a types::PolarsConnectionSettingsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/polars_connection_settings", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Converts an S3 resource to the set of arguments necessary to connect Polars to an S3 bucket - -Sends a `POST` request to `/w/{workspace}/job_helpers/v2/polars_connection_settings` - -Arguments: -- `workspace` -- `body`: S3 resource path to use to generate the connection settings. If empty, the S3 resource defined in the workspace settings will be used -*/ - pub async fn polars_connection_settings_v2<'a>( - &'a self, - workspace: &'a str, - body: &'a types::PolarsConnectionSettingsV2Body, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/v2/polars_connection_settings", self.baseurl, - encode_path(& workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Returns the s3 resource associated to the provided path, or the workspace default S3 resource - -Sends a `POST` request to `/w/{workspace}/job_helpers/v2/s3_resource_info` - -Arguments: -- `workspace` -- `body`: S3 resource path to use. If empty, the S3 resource defined in the workspace settings will be used -*/ - pub async fn s3_resource_info<'a>( - &'a self, - workspace: &'a str, - body: &'a types::S3ResourceInfoBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/v2/s3_resource_info", self.baseurl, encode_path(& - workspace.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Test connection to the workspace object storage - -Sends a `GET` request to `/w/{workspace}/job_helpers/test_connection` - -*/ - pub async fn dataset_storage_test_connection<'a>( - &'a self, - workspace: &'a str, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/test_connection", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**List the file keys available in a workspace object storage - -Sends a `GET` request to `/w/{workspace}/job_helpers/list_stored_files` - -*/ - pub async fn list_stored_files<'a>( - &'a self, - workspace: &'a str, - marker: Option<&'a str>, - max_keys: i64, - prefix: Option<&'a str>, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/list_stored_files", self.baseurl, encode_path(& - workspace.to_string()), - ); - let mut query = Vec::with_capacity(4usize); - if let Some(v) = &marker { - query.push(("marker", v.to_string())); - } - query.push(("max_keys", max_keys.to_string())); - if let Some(v) = &prefix { - query.push(("prefix", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Load metadata of the file - -Sends a `GET` request to `/w/{workspace}/job_helpers/load_file_metadata` - -*/ - pub async fn load_file_metadata<'a>( - &'a self, - workspace: &'a str, - file_key: &'a str, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/load_file_metadata", self.baseurl, encode_path(& - workspace.to_string()), - ); - let mut query = Vec::with_capacity(2usize); - query.push(("file_key", file_key.to_string())); - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Load a preview of the file - -Sends a `GET` request to `/w/{workspace}/job_helpers/load_file_preview` - -*/ - pub async fn load_file_preview<'a>( - &'a self, - workspace: &'a str, - csv_has_header: Option, - csv_separator: Option<&'a str>, - file_key: &'a str, - file_mime_type: Option<&'a str>, - file_size_in_bytes: Option, - read_bytes_from: Option, - read_bytes_length: Option, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/load_file_preview", self.baseurl, encode_path(& - workspace.to_string()), - ); - let mut query = Vec::with_capacity(8usize); - if let Some(v) = &csv_has_header { - query.push(("csv_has_header", v.to_string())); - } - if let Some(v) = &csv_separator { - query.push(("csv_separator", v.to_string())); - } - query.push(("file_key", file_key.to_string())); - if let Some(v) = &file_mime_type { - query.push(("file_mime_type", v.to_string())); - } - if let Some(v) = &file_size_in_bytes { - query.push(("file_size_in_bytes", v.to_string())); - } - if let Some(v) = &read_bytes_from { - query.push(("read_bytes_from", v.to_string())); - } - if let Some(v) = &read_bytes_length { - query.push(("read_bytes_length", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Load a preview of a parquet file - -Sends a `GET` request to `/w/{workspace}/job_helpers/load_parquet_preview/{path}` - -*/ - pub async fn load_parquet_preview<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - limit: Option, - offset: Option, - search_col: Option<&'a str>, - search_term: Option<&'a str>, - sort_col: Option<&'a str>, - sort_desc: Option, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/load_parquet_preview/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &offset { - query.push(("offset", v.to_string())); - } - if let Some(v) = &search_col { - query.push(("search_col", v.to_string())); - } - if let Some(v) = &search_term { - query.push(("search_term", v.to_string())); - } - if let Some(v) = &sort_col { - query.push(("sort_col", v.to_string())); - } - if let Some(v) = &sort_desc { - query.push(("sort_desc", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Load the table row count - -Sends a `GET` request to `/w/{workspace}/job_helpers/load_table_count/{path}` - -*/ - pub async fn load_table_row_count<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - search_col: Option<&'a str>, - search_term: Option<&'a str>, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/load_table_count/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &search_col { - query.push(("search_col", v.to_string())); - } - if let Some(v) = &search_term { - query.push(("search_term", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Load a preview of a csv file - -Sends a `GET` request to `/w/{workspace}/job_helpers/load_csv_preview/{path}` - -*/ - pub async fn load_csv_preview<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - csv_separator: Option<&'a str>, - limit: Option, - offset: Option, - search_col: Option<&'a str>, - search_term: Option<&'a str>, - sort_col: Option<&'a str>, - sort_desc: Option, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/load_csv_preview/{}", self.baseurl, encode_path(& - workspace.to_string()), encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(8usize); - if let Some(v) = &csv_separator { - query.push(("csv_separator", v.to_string())); - } - if let Some(v) = &limit { - query.push(("limit", v.to_string())); - } - if let Some(v) = &offset { - query.push(("offset", v.to_string())); - } - if let Some(v) = &search_col { - query.push(("search_col", v.to_string())); - } - if let Some(v) = &search_term { - query.push(("search_term", v.to_string())); - } - if let Some(v) = &sort_col { - query.push(("sort_col", v.to_string())); - } - if let Some(v) = &sort_desc { - query.push(("sort_desc", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Permanently delete file from S3 - -Sends a `DELETE` request to `/w/{workspace}/job_helpers/delete_s3_file` - -*/ - pub async fn delete_s3_file<'a>( - &'a self, - workspace: &'a str, - file_key: &'a str, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/delete_s3_file", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(2usize); - query.push(("file_key", file_key.to_string())); - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Move a S3 file from one path to the other within the same bucket - -Sends a `GET` request to `/w/{workspace}/job_helpers/move_s3_file` - -*/ - pub async fn move_s3_file<'a>( - &'a self, - workspace: &'a str, - dest_file_key: &'a str, - src_file_key: &'a str, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/move_s3_file", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(3usize); - query.push(("dest_file_key", dest_file_key.to_string())); - query.push(("src_file_key", src_file_key.to_string())); - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Upload file to S3 bucket - -Sends a `POST` request to `/w/{workspace}/job_helpers/upload_s3_file` - -Arguments: -- `workspace` -- `content_disposition` -- `content_type` -- `file_extension` -- `file_key` -- `resource_type` -- `s3_resource_path` -- `storage` -- `body`: File content -*/ - pub async fn file_upload<'a, B: Into>( - &'a self, - workspace: &'a str, - content_disposition: Option<&'a str>, - content_type: Option<&'a str>, - file_extension: Option<&'a str>, - file_key: Option<&'a str>, - resource_type: Option<&'a str>, - s3_resource_path: Option<&'a str>, - storage: Option<&'a str>, - body: B, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/upload_s3_file", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(7usize); - if let Some(v) = &content_disposition { - query.push(("content_disposition", v.to_string())); - } - if let Some(v) = &content_type { - query.push(("content_type", v.to_string())); - } - if let Some(v) = &file_extension { - query.push(("file_extension", v.to_string())); - } - if let Some(v) = &file_key { - query.push(("file_key", v.to_string())); - } - if let Some(v) = &resource_type { - query.push(("resource_type", v.to_string())); - } - if let Some(v) = &s3_resource_path { - query.push(("s3_resource_path", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .header( - reqwest::header::CONTENT_TYPE, - reqwest::header::HeaderValue::from_static("application/octet-stream"), - ) - .body(body) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Download file from S3 bucket - -Sends a `GET` request to `/w/{workspace}/job_helpers/download_s3_file` - -*/ - pub async fn file_download<'a>( - &'a self, - workspace: &'a str, - file_key: &'a str, - resource_type: Option<&'a str>, - s3_resource_path: Option<&'a str>, - storage: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/download_s3_file", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(4usize); - query.push(("file_key", file_key.to_string())); - if let Some(v) = &resource_type { - query.push(("resource_type", v.to_string())); - } - if let Some(v) = &s3_resource_path { - query.push(("s3_resource_path", v.to_string())); - } - if let Some(v) = &storage { - query.push(("storage", v.to_string())); - } - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Download file to S3 bucket - -Sends a `GET` request to `/w/{workspace}/job_helpers/download_s3_parquet_file_as_csv` - -*/ - pub async fn file_download_parquet_as_csv<'a>( - &'a self, - workspace: &'a str, - file_key: &'a str, - resource_type: Option<&'a str>, - s3_resource_path: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_helpers/download_s3_parquet_file_as_csv", self.baseurl, - encode_path(& workspace.to_string()), - ); - let mut query = Vec::with_capacity(3usize); - query.push(("file_key", file_key.to_string())); - if let Some(v) = &resource_type { - query.push(("resource_type", v.to_string())); - } - if let Some(v) = &s3_resource_path { - query.push(("s3_resource_path", v.to_string())); - } - let request = self.client.get(url).query(&query).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job metrics - -Sends a `POST` request to `/w/{workspace}/job_metrics/get/{id}` - -Arguments: -- `workspace` -- `id` -- `body`: parameters for statistics retrieval -*/ - pub async fn get_job_metrics<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - body: &'a types::GetJobMetricsBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_metrics/get/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**set job metrics - -Sends a `POST` request to `/w/{workspace}/job_metrics/set_progress/{id}` - -Arguments: -- `workspace` -- `id` -- `body`: parameters for statistics retrieval -*/ - pub async fn set_job_progress<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - body: &'a types::SetJobProgressBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_metrics/set_progress/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .post(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .json(&body) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get job progress - -Sends a `GET` request to `/w/{workspace}/job_metrics/get_progress/{id}` - -*/ - pub async fn get_job_progress<'a>( - &'a self, - workspace: &'a str, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/job_metrics/get_progress/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**list log files ordered by timestamp - -Sends a `GET` request to `/service_logs/list_files` - -Arguments: -- `after`: filter on created after (exclusive) timestamp -- `before`: filter on started before (inclusive) timestamp -- `with_error` -*/ - pub async fn list_log_files<'a>( - &'a self, - after: Option<&'a chrono::DateTime>, - before: Option<&'a chrono::DateTime>, - with_error: Option, - ) -> Result>, Error<()>> { - let url = format!("{}/service_logs/list_files", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &after { - query.push(("after", v.to_string())); - } - if let Some(v) = &before { - query.push(("before", v.to_string())); - } - if let Some(v) = &with_error { - query.push(("with_error", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get log file by path - -Sends a `GET` request to `/service_logs/get_log_file/{path}` - -*/ - pub async fn get_log_file<'a>( - &'a self, - path: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/service_logs/get_log_file/{}", self.baseurl, encode_path(& path - .to_string()), - ); - let request = self.client.get(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**List all concurrency groups - -Sends a `GET` request to `/concurrency_groups/list` - -*/ - pub async fn list_concurrency_groups<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/concurrency_groups/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Delete concurrency group - -Sends a `DELETE` request to `/concurrency_groups/prune/{concurrency_id}` - -*/ - pub async fn delete_concurrency_group<'a>( - &'a self, - concurrency_id: &'a str, - ) -> Result< - ResponseValue>, - Error<()>, - > { - let url = format!( - "{}/concurrency_groups/prune/{}", self.baseurl, encode_path(& concurrency_id - .to_string()), - ); - let request = self - .client - .delete(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Get the concurrency key for a job that has concurrency limits enabled - -Sends a `GET` request to `/concurrency_groups/{id}/key` - -*/ - pub async fn get_concurrency_key<'a>( - &'a self, - id: &'a uuid::Uuid, - ) -> Result, Error<()>> { - let url = format!( - "{}/concurrency_groups/{}/key", self.baseurl, encode_path(& id.to_string()), - ); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Get intervals of job runtime concurrency - -Sends a `GET` request to `/w/{workspace}/concurrency_groups/list_jobs` - -Arguments: -- `workspace` -- `all_workspaces`: get jobs from all workspaces (only valid if request come from the `admins` workspace) -- `args`: filter on jobs containing those args as a json subset (@> in postgres) -- `concurrency_key` -- `created_by`: mask to filter exact matching user creator -- `created_or_started_after`: filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp -- `created_or_started_after_completed_jobs`: filter on created_at for non non started job and started_at otherwise after (exclusive) timestamp but only for the completed jobs -- `created_or_started_before`: filter on created_at for non non started job and started_at otherwise before (inclusive) timestamp -- `has_null_parent`: has null parent -- `is_flow_step`: is the job a flow step -- `is_not_schedule`: is not a scheduled job -- `is_skipped`: is the job skipped -- `job_kinds`: filter on job kind (values 'preview', 'script', 'dependencies', 'flow') separated by, -- `label`: mask to filter exact matching job's label (job labels are completed jobs with as a result an object containing a string in the array at key 'wm_labels') -- `page`: which page to return (start at 1, default 1) -- `parent_job`: The parent job that is at the origin and responsible for the execution of this script if any -- `per_page`: number of items to return for a given page (default 30, max 100) -- `result`: filter on jobs containing those result as a json subset (@> in postgres) -- `row_limit` -- `running`: filter on running jobs -- `schedule_path`: mask to filter by schedule path -- `scheduled_for_before_now`: filter on jobs scheduled_for before now (hence waitinf for a worker) -- `script_hash`: mask to filter exact matching path -- `script_path_exact`: mask to filter exact matching path -- `script_path_start`: mask to filter matching starting path -- `started_after`: filter on started after (exclusive) timestamp -- `started_before`: filter on started before (inclusive) timestamp -- `success`: filter on successful jobs -- `tag`: filter on jobs with a given tag/worker group -*/ - pub async fn list_extended_jobs<'a>( - &'a self, - workspace: &'a str, - all_workspaces: Option, - args: Option<&'a str>, - concurrency_key: Option<&'a str>, - created_by: Option<&'a str>, - created_or_started_after: Option<&'a chrono::DateTime>, - created_or_started_after_completed_jobs: Option< - &'a chrono::DateTime, - >, - created_or_started_before: Option<&'a chrono::DateTime>, - has_null_parent: Option, - is_flow_step: Option, - is_not_schedule: Option, - is_skipped: Option, - job_kinds: Option<&'a str>, - label: Option<&'a str>, - page: Option, - parent_job: Option<&'a uuid::Uuid>, - per_page: Option, - result: Option<&'a str>, - row_limit: Option, - running: Option, - schedule_path: Option<&'a str>, - scheduled_for_before_now: Option, - script_hash: Option<&'a str>, - script_path_exact: Option<&'a str>, - script_path_start: Option<&'a str>, - started_after: Option<&'a chrono::DateTime>, - started_before: Option<&'a chrono::DateTime>, - success: Option, - tag: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/concurrency_groups/list_jobs", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(28usize); - if let Some(v) = &all_workspaces { - query.push(("all_workspaces", v.to_string())); - } - if let Some(v) = &args { - query.push(("args", v.to_string())); - } - if let Some(v) = &concurrency_key { - query.push(("concurrency_key", v.to_string())); - } - if let Some(v) = &created_by { - query.push(("created_by", v.to_string())); - } - if let Some(v) = &created_or_started_after { - query.push(("created_or_started_after", v.to_string())); - } - if let Some(v) = &created_or_started_after_completed_jobs { - query.push(("created_or_started_after_completed_jobs", v.to_string())); - } - if let Some(v) = &created_or_started_before { - query.push(("created_or_started_before", v.to_string())); - } - if let Some(v) = &has_null_parent { - query.push(("has_null_parent", v.to_string())); - } - if let Some(v) = &is_flow_step { - query.push(("is_flow_step", v.to_string())); - } - if let Some(v) = &is_not_schedule { - query.push(("is_not_schedule", v.to_string())); - } - if let Some(v) = &is_skipped { - query.push(("is_skipped", v.to_string())); - } - if let Some(v) = &job_kinds { - query.push(("job_kinds", v.to_string())); - } - if let Some(v) = &label { - query.push(("label", v.to_string())); - } - if let Some(v) = &page { - query.push(("page", v.to_string())); - } - if let Some(v) = &parent_job { - query.push(("parent_job", v.to_string())); - } - if let Some(v) = &per_page { - query.push(("per_page", v.to_string())); - } - if let Some(v) = &result { - query.push(("result", v.to_string())); - } - if let Some(v) = &row_limit { - query.push(("row_limit", v.to_string())); - } - if let Some(v) = &running { - query.push(("running", v.to_string())); - } - if let Some(v) = &schedule_path { - query.push(("schedule_path", v.to_string())); - } - if let Some(v) = &scheduled_for_before_now { - query.push(("scheduled_for_before_now", v.to_string())); - } - if let Some(v) = &script_hash { - query.push(("script_hash", v.to_string())); - } - if let Some(v) = &script_path_exact { - query.push(("script_path_exact", v.to_string())); - } - if let Some(v) = &script_path_start { - query.push(("script_path_start", v.to_string())); - } - if let Some(v) = &started_after { - query.push(("started_after", v.to_string())); - } - if let Some(v) = &started_before { - query.push(("started_before", v.to_string())); - } - if let Some(v) = &success { - query.push(("success", v.to_string())); - } - if let Some(v) = &tag { - query.push(("tag", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Search through jobs with a string query - -Sends a `GET` request to `/srch/w/{workspace}/index/search/job` - -*/ - pub async fn search_jobs_index<'a>( - &'a self, - workspace: &'a str, - search_query: &'a str, - ) -> Result, Error<()>> { - let url = format!( - "{}/srch/w/{}/index/search/job", self.baseurl, encode_path(& workspace - .to_string()), - ); - let mut query = Vec::with_capacity(1usize); - query.push(("search_query", search_query.to_string())); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Search through service logs with a string query - -Sends a `GET` request to `/srch/index/search/service_logs` - -*/ - pub async fn search_logs_index<'a>( - &'a self, - hostname: &'a str, - max_ts: Option<&'a chrono::DateTime>, - min_ts: Option<&'a chrono::DateTime>, - mode: &'a str, - search_query: &'a str, - worker_group: Option<&'a str>, - ) -> Result, Error<()>> { - let url = format!("{}/srch/index/search/service_logs", self.baseurl,); - let mut query = Vec::with_capacity(6usize); - query.push(("hostname", hostname.to_string())); - if let Some(v) = &max_ts { - query.push(("max_ts", v.to_string())); - } - if let Some(v) = &min_ts { - query.push(("min_ts", v.to_string())); - } - query.push(("mode", mode.to_string())); - query.push(("search_query", search_query.to_string())); - if let Some(v) = &worker_group { - query.push(("worker_group", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Search and count the log line hits on every provided host - -Sends a `GET` request to `/srch/index/search/count_service_logs` - -*/ - pub async fn count_search_logs_index<'a>( - &'a self, - max_ts: Option<&'a chrono::DateTime>, - min_ts: Option<&'a chrono::DateTime>, - search_query: &'a str, - ) -> Result, Error<()>> { - let url = format!("{}/srch/index/search/count_service_logs", self.baseurl,); - let mut query = Vec::with_capacity(3usize); - if let Some(v) = &max_ts { - query.push(("max_ts", v.to_string())); - } - if let Some(v) = &min_ts { - query.push(("min_ts", v.to_string())); - } - query.push(("search_query", search_query.to_string())); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**Restart container and delete the index to recreate it - -Sends a `DELETE` request to `/srch/index/delete/{idx_name}` - -*/ - pub async fn clear_index<'a>( - &'a self, - idx_name: types::ClearIndexIdxName, - ) -> Result, Error<()>> { - let url = format!( - "{}/srch/index/delete/{}", self.baseurl, encode_path(& idx_name.to_string()), - ); - let request = self.client.delete(url).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } -} -pub mod prelude { - pub use super::Client; -} diff --git a/backend/windmill-api-client/src/codegen.rs b/backend/windmill-api-client/src/codegen.rs deleted file mode 100644 index a295d9df8f..0000000000 --- a/backend/windmill-api-client/src/codegen.rs +++ /dev/null @@ -1,8984 +0,0 @@ -pub use progenitor_client::{ByteStream, Error, ResponseValue}; -#[allow(unused_imports)] -use progenitor_client::{encode_path, RequestBuilderExt}; -#[allow(unused_imports)] -use reqwest::header::{HeaderMap, HeaderValue}; -pub mod types { - use serde::{Deserialize, Serialize}; - #[allow(unused_imports)] - use std::convert::TryFrom; - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AiAgent { - pub input_transforms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - pub tools: Vec, - #[serde(rename = "type")] - pub type_: AiAgentType, - } - impl From<&AiAgent> for AiAgent { - fn from(value: &AiAgent) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AiAgentType { - #[serde(rename = "aiagent")] - Aiagent, - } - impl From<&AiAgentType> for AiAgentType { - fn from(value: &AiAgentType) -> Self { - value.clone() - } - } - impl ToString for AiAgentType { - fn to_string(&self) -> String { - match *self { - Self::Aiagent => "aiagent".to_string(), - } - } - } - impl std::str::FromStr for AiAgentType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "aiagent" => Ok(Self::Aiagent), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AiAgentType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AiAgentType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AiAgentType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AiConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub code_completion_model: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub custom_prompts: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default_model: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub providers: std::collections::HashMap, - } - impl From<&AiConfig> for AiConfig { - fn from(value: &AiConfig) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AiProvider { - #[serde(rename = "openai")] - Openai, - #[serde(rename = "azure_openai")] - AzureOpenai, - #[serde(rename = "anthropic")] - Anthropic, - #[serde(rename = "mistral")] - Mistral, - #[serde(rename = "deepseek")] - Deepseek, - #[serde(rename = "googleai")] - Googleai, - #[serde(rename = "groq")] - Groq, - #[serde(rename = "openrouter")] - Openrouter, - #[serde(rename = "togetherai")] - Togetherai, - #[serde(rename = "customai")] - Customai, - } - impl From<&AiProvider> for AiProvider { - fn from(value: &AiProvider) -> Self { - value.clone() - } - } - impl ToString for AiProvider { - fn to_string(&self) -> String { - match *self { - Self::Openai => "openai".to_string(), - Self::AzureOpenai => "azure_openai".to_string(), - Self::Anthropic => "anthropic".to_string(), - Self::Mistral => "mistral".to_string(), - Self::Deepseek => "deepseek".to_string(), - Self::Googleai => "googleai".to_string(), - Self::Groq => "groq".to_string(), - Self::Openrouter => "openrouter".to_string(), - Self::Togetherai => "togetherai".to_string(), - Self::Customai => "customai".to_string(), - } - } - } - impl std::str::FromStr for AiProvider { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "openai" => Ok(Self::Openai), - "azure_openai" => Ok(Self::AzureOpenai), - "anthropic" => Ok(Self::Anthropic), - "mistral" => Ok(Self::Mistral), - "deepseek" => Ok(Self::Deepseek), - "googleai" => Ok(Self::Googleai), - "groq" => Ok(Self::Groq), - "openrouter" => Ok(Self::Openrouter), - "togetherai" => Ok(Self::Togetherai), - "customai" => Ok(Self::Customai), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AiProvider { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AiProvider { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AiProvider { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AiProviderConfig { - pub models: Vec, - pub resource_path: String, - } - impl From<&AiProviderConfig> for AiProviderConfig { - fn from(value: &AiProviderConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AiProviderModel { - pub model: String, - pub provider: AiProvider, - } - impl From<&AiProviderModel> for AiProviderModel { - fn from(value: &AiProviderModel) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Alert { - pub alert_cooldown_seconds: i64, - pub alert_time_threshold_seconds: i64, - pub jobs_num_threshold: i64, - pub name: String, - pub tags_to_monitor: Vec, - } - impl From<&Alert> for Alert { - fn from(value: &Alert) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AppHistory { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - pub version: i64, - } - impl From<&AppHistory> for AppHistory { - fn from(value: &AppHistory) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AppWithLastVersion { - pub created_at: chrono::DateTime, - pub created_by: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub custom_path: Option, - pub execution_mode: AppWithLastVersionExecutionMode, - pub extra_perms: std::collections::HashMap, - pub id: i64, - pub path: String, - pub policy: Policy, - pub summary: String, - pub value: std::collections::HashMap, - pub versions: Vec, - pub workspace_id: String, - } - impl From<&AppWithLastVersion> for AppWithLastVersion { - fn from(value: &AppWithLastVersion) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AppWithLastVersionExecutionMode { - #[serde(rename = "viewer")] - Viewer, - #[serde(rename = "publisher")] - Publisher, - #[serde(rename = "anonymous")] - Anonymous, - } - impl From<&AppWithLastVersionExecutionMode> for AppWithLastVersionExecutionMode { - fn from(value: &AppWithLastVersionExecutionMode) -> Self { - value.clone() - } - } - impl ToString for AppWithLastVersionExecutionMode { - fn to_string(&self) -> String { - match *self { - Self::Viewer => "viewer".to_string(), - Self::Publisher => "publisher".to_string(), - Self::Anonymous => "anonymous".to_string(), - } - } - } - impl std::str::FromStr for AppWithLastVersionExecutionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "viewer" => Ok(Self::Viewer), - "publisher" => Ok(Self::Publisher), - "anonymous" => Ok(Self::Anonymous), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AppWithLastVersionExecutionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AppWithLastVersionExecutionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AppWithLastVersionExecutionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AppWithLastVersionWDraft { - #[serde(flatten)] - pub app_with_last_version: AppWithLastVersion, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - } - impl From<&AppWithLastVersionWDraft> for AppWithLastVersionWDraft { - fn from(value: &AppWithLastVersionWDraft) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Asset { - pub kind: AssetKind, - pub path: String, - } - impl From<&Asset> for Asset { - fn from(value: &Asset) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AssetKind { - #[serde(rename = "s3object")] - S3object, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "ducklake")] - Ducklake, - } - impl From<&AssetKind> for AssetKind { - fn from(value: &AssetKind) -> Self { - value.clone() - } - } - impl ToString for AssetKind { - fn to_string(&self) -> String { - match *self { - Self::S3object => "s3object".to_string(), - Self::Resource => "resource".to_string(), - Self::Ducklake => "ducklake".to_string(), - } - } - } - impl std::str::FromStr for AssetKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "s3object" => Ok(Self::S3object), - "resource" => Ok(Self::Resource), - "ducklake" => Ok(Self::Ducklake), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AssetKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AssetKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AssetKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AssetUsageAccessType { - #[serde(rename = "r")] - R, - #[serde(rename = "w")] - W, - #[serde(rename = "rw")] - Rw, - } - impl From<&AssetUsageAccessType> for AssetUsageAccessType { - fn from(value: &AssetUsageAccessType) -> Self { - value.clone() - } - } - impl ToString for AssetUsageAccessType { - fn to_string(&self) -> String { - match *self { - Self::R => "r".to_string(), - Self::W => "w".to_string(), - Self::Rw => "rw".to_string(), - } - } - } - impl std::str::FromStr for AssetUsageAccessType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "r" => Ok(Self::R), - "w" => Ok(Self::W), - "rw" => Ok(Self::Rw), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AssetUsageAccessType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AssetUsageAccessType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AssetUsageAccessType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AssetUsageKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&AssetUsageKind> for AssetUsageKind { - fn from(value: &AssetUsageKind) -> Self { - value.clone() - } - } - impl ToString for AssetUsageKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for AssetUsageKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AssetUsageKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AssetUsageKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AssetUsageKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AuditLog { - pub action_kind: AuditLogActionKind, - pub id: i64, - pub operation: AuditLogOperation, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub parameters: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub span: Option, - pub timestamp: chrono::DateTime, - pub username: String, - } - impl From<&AuditLog> for AuditLog { - fn from(value: &AuditLog) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AuditLogActionKind { - Created, - Updated, - Delete, - Execute, - } - impl From<&AuditLogActionKind> for AuditLogActionKind { - fn from(value: &AuditLogActionKind) -> Self { - value.clone() - } - } - impl ToString for AuditLogActionKind { - fn to_string(&self) -> String { - match *self { - Self::Created => "Created".to_string(), - Self::Updated => "Updated".to_string(), - Self::Delete => "Delete".to_string(), - Self::Execute => "Execute".to_string(), - } - } - } - impl std::str::FromStr for AuditLogActionKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Created" => Ok(Self::Created), - "Updated" => Ok(Self::Updated), - "Delete" => Ok(Self::Delete), - "Execute" => Ok(Self::Execute), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AuditLogActionKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AuditLogActionKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AuditLogActionKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AuditLogOperation { - #[serde(rename = "jobs.run")] - JobsRun, - #[serde(rename = "jobs.run.script")] - JobsRunScript, - #[serde(rename = "jobs.run.preview")] - JobsRunPreview, - #[serde(rename = "jobs.run.flow")] - JobsRunFlow, - #[serde(rename = "jobs.run.flow_preview")] - JobsRunFlowPreview, - #[serde(rename = "jobs.run.script_hub")] - JobsRunScriptHub, - #[serde(rename = "jobs.run.dependencies")] - JobsRunDependencies, - #[serde(rename = "jobs.run.identity")] - JobsRunIdentity, - #[serde(rename = "jobs.run.noop")] - JobsRunNoop, - #[serde(rename = "jobs.flow_dependencies")] - JobsFlowDependencies, - #[serde(rename = "jobs")] - Jobs, - #[serde(rename = "jobs.cancel")] - JobsCancel, - #[serde(rename = "jobs.force_cancel")] - JobsForceCancel, - #[serde(rename = "jobs.disapproval")] - JobsDisapproval, - #[serde(rename = "jobs.delete")] - JobsDelete, - #[serde(rename = "account.delete")] - AccountDelete, - #[serde(rename = "ai.request")] - AiRequest, - #[serde(rename = "resources.create")] - ResourcesCreate, - #[serde(rename = "resources.update")] - ResourcesUpdate, - #[serde(rename = "resources.delete")] - ResourcesDelete, - #[serde(rename = "resource_types.create")] - ResourceTypesCreate, - #[serde(rename = "resource_types.update")] - ResourceTypesUpdate, - #[serde(rename = "resource_types.delete")] - ResourceTypesDelete, - #[serde(rename = "schedule.create")] - ScheduleCreate, - #[serde(rename = "schedule.setenabled")] - ScheduleSetenabled, - #[serde(rename = "schedule.edit")] - ScheduleEdit, - #[serde(rename = "schedule.delete")] - ScheduleDelete, - #[serde(rename = "scripts.create")] - ScriptsCreate, - #[serde(rename = "scripts.update")] - ScriptsUpdate, - #[serde(rename = "scripts.archive")] - ScriptsArchive, - #[serde(rename = "scripts.delete")] - ScriptsDelete, - #[serde(rename = "users.create")] - UsersCreate, - #[serde(rename = "users.delete")] - UsersDelete, - #[serde(rename = "users.update")] - UsersUpdate, - #[serde(rename = "users.login")] - UsersLogin, - #[serde(rename = "users.login_failure")] - UsersLoginFailure, - #[serde(rename = "users.logout")] - UsersLogout, - #[serde(rename = "users.accept_invite")] - UsersAcceptInvite, - #[serde(rename = "users.decline_invite")] - UsersDeclineInvite, - #[serde(rename = "users.token.create")] - UsersTokenCreate, - #[serde(rename = "users.token.delete")] - UsersTokenDelete, - #[serde(rename = "users.add_to_workspace")] - UsersAddToWorkspace, - #[serde(rename = "users.add_global")] - UsersAddGlobal, - #[serde(rename = "users.setpassword")] - UsersSetpassword, - #[serde(rename = "users.impersonate")] - UsersImpersonate, - #[serde(rename = "users.leave_workspace")] - UsersLeaveWorkspace, - #[serde(rename = "oauth.login")] - OauthLogin, - #[serde(rename = "oauth.login_failure")] - OauthLoginFailure, - #[serde(rename = "oauth.signup")] - OauthSignup, - #[serde(rename = "variables.create")] - VariablesCreate, - #[serde(rename = "variables.delete")] - VariablesDelete, - #[serde(rename = "variables.update")] - VariablesUpdate, - #[serde(rename = "flows.create")] - FlowsCreate, - #[serde(rename = "flows.update")] - FlowsUpdate, - #[serde(rename = "flows.delete")] - FlowsDelete, - #[serde(rename = "flows.archive")] - FlowsArchive, - #[serde(rename = "apps.create")] - AppsCreate, - #[serde(rename = "apps.update")] - AppsUpdate, - #[serde(rename = "apps.delete")] - AppsDelete, - #[serde(rename = "folder.create")] - FolderCreate, - #[serde(rename = "folder.update")] - FolderUpdate, - #[serde(rename = "folder.delete")] - FolderDelete, - #[serde(rename = "folder.add_owner")] - FolderAddOwner, - #[serde(rename = "folder.remove_owner")] - FolderRemoveOwner, - #[serde(rename = "group.create")] - GroupCreate, - #[serde(rename = "group.delete")] - GroupDelete, - #[serde(rename = "group.edit")] - GroupEdit, - #[serde(rename = "group.adduser")] - GroupAdduser, - #[serde(rename = "group.removeuser")] - GroupRemoveuser, - #[serde(rename = "igroup.create")] - IgroupCreate, - #[serde(rename = "igroup.delete")] - IgroupDelete, - #[serde(rename = "igroup.adduser")] - IgroupAdduser, - #[serde(rename = "igroup.removeuser")] - IgroupRemoveuser, - #[serde(rename = "variables.decrypt_secret")] - VariablesDecryptSecret, - #[serde(rename = "workspaces.edit_command_script")] - WorkspacesEditCommandScript, - #[serde(rename = "workspaces.edit_deploy_to")] - WorkspacesEditDeployTo, - #[serde(rename = "workspaces.edit_auto_invite_domain")] - WorkspacesEditAutoInviteDomain, - #[serde(rename = "workspaces.edit_webhook")] - WorkspacesEditWebhook, - #[serde(rename = "workspaces.edit_copilot_config")] - WorkspacesEditCopilotConfig, - #[serde(rename = "workspaces.edit_error_handler")] - WorkspacesEditErrorHandler, - #[serde(rename = "workspaces.create")] - WorkspacesCreate, - #[serde(rename = "workspaces.update")] - WorkspacesUpdate, - #[serde(rename = "workspaces.archive")] - WorkspacesArchive, - #[serde(rename = "workspaces.unarchive")] - WorkspacesUnarchive, - #[serde(rename = "workspaces.delete")] - WorkspacesDelete, - } - impl From<&AuditLogOperation> for AuditLogOperation { - fn from(value: &AuditLogOperation) -> Self { - value.clone() - } - } - impl ToString for AuditLogOperation { - fn to_string(&self) -> String { - match *self { - Self::JobsRun => "jobs.run".to_string(), - Self::JobsRunScript => "jobs.run.script".to_string(), - Self::JobsRunPreview => "jobs.run.preview".to_string(), - Self::JobsRunFlow => "jobs.run.flow".to_string(), - Self::JobsRunFlowPreview => "jobs.run.flow_preview".to_string(), - Self::JobsRunScriptHub => "jobs.run.script_hub".to_string(), - Self::JobsRunDependencies => "jobs.run.dependencies".to_string(), - Self::JobsRunIdentity => "jobs.run.identity".to_string(), - Self::JobsRunNoop => "jobs.run.noop".to_string(), - Self::JobsFlowDependencies => "jobs.flow_dependencies".to_string(), - Self::Jobs => "jobs".to_string(), - Self::JobsCancel => "jobs.cancel".to_string(), - Self::JobsForceCancel => "jobs.force_cancel".to_string(), - Self::JobsDisapproval => "jobs.disapproval".to_string(), - Self::JobsDelete => "jobs.delete".to_string(), - Self::AccountDelete => "account.delete".to_string(), - Self::AiRequest => "ai.request".to_string(), - Self::ResourcesCreate => "resources.create".to_string(), - Self::ResourcesUpdate => "resources.update".to_string(), - Self::ResourcesDelete => "resources.delete".to_string(), - Self::ResourceTypesCreate => "resource_types.create".to_string(), - Self::ResourceTypesUpdate => "resource_types.update".to_string(), - Self::ResourceTypesDelete => "resource_types.delete".to_string(), - Self::ScheduleCreate => "schedule.create".to_string(), - Self::ScheduleSetenabled => "schedule.setenabled".to_string(), - Self::ScheduleEdit => "schedule.edit".to_string(), - Self::ScheduleDelete => "schedule.delete".to_string(), - Self::ScriptsCreate => "scripts.create".to_string(), - Self::ScriptsUpdate => "scripts.update".to_string(), - Self::ScriptsArchive => "scripts.archive".to_string(), - Self::ScriptsDelete => "scripts.delete".to_string(), - Self::UsersCreate => "users.create".to_string(), - Self::UsersDelete => "users.delete".to_string(), - Self::UsersUpdate => "users.update".to_string(), - Self::UsersLogin => "users.login".to_string(), - Self::UsersLoginFailure => "users.login_failure".to_string(), - Self::UsersLogout => "users.logout".to_string(), - Self::UsersAcceptInvite => "users.accept_invite".to_string(), - Self::UsersDeclineInvite => "users.decline_invite".to_string(), - Self::UsersTokenCreate => "users.token.create".to_string(), - Self::UsersTokenDelete => "users.token.delete".to_string(), - Self::UsersAddToWorkspace => "users.add_to_workspace".to_string(), - Self::UsersAddGlobal => "users.add_global".to_string(), - Self::UsersSetpassword => "users.setpassword".to_string(), - Self::UsersImpersonate => "users.impersonate".to_string(), - Self::UsersLeaveWorkspace => "users.leave_workspace".to_string(), - Self::OauthLogin => "oauth.login".to_string(), - Self::OauthLoginFailure => "oauth.login_failure".to_string(), - Self::OauthSignup => "oauth.signup".to_string(), - Self::VariablesCreate => "variables.create".to_string(), - Self::VariablesDelete => "variables.delete".to_string(), - Self::VariablesUpdate => "variables.update".to_string(), - Self::FlowsCreate => "flows.create".to_string(), - Self::FlowsUpdate => "flows.update".to_string(), - Self::FlowsDelete => "flows.delete".to_string(), - Self::FlowsArchive => "flows.archive".to_string(), - Self::AppsCreate => "apps.create".to_string(), - Self::AppsUpdate => "apps.update".to_string(), - Self::AppsDelete => "apps.delete".to_string(), - Self::FolderCreate => "folder.create".to_string(), - Self::FolderUpdate => "folder.update".to_string(), - Self::FolderDelete => "folder.delete".to_string(), - Self::FolderAddOwner => "folder.add_owner".to_string(), - Self::FolderRemoveOwner => "folder.remove_owner".to_string(), - Self::GroupCreate => "group.create".to_string(), - Self::GroupDelete => "group.delete".to_string(), - Self::GroupEdit => "group.edit".to_string(), - Self::GroupAdduser => "group.adduser".to_string(), - Self::GroupRemoveuser => "group.removeuser".to_string(), - Self::IgroupCreate => "igroup.create".to_string(), - Self::IgroupDelete => "igroup.delete".to_string(), - Self::IgroupAdduser => "igroup.adduser".to_string(), - Self::IgroupRemoveuser => "igroup.removeuser".to_string(), - Self::VariablesDecryptSecret => "variables.decrypt_secret".to_string(), - Self::WorkspacesEditCommandScript => { - "workspaces.edit_command_script".to_string() - } - Self::WorkspacesEditDeployTo => "workspaces.edit_deploy_to".to_string(), - Self::WorkspacesEditAutoInviteDomain => { - "workspaces.edit_auto_invite_domain".to_string() - } - Self::WorkspacesEditWebhook => "workspaces.edit_webhook".to_string(), - Self::WorkspacesEditCopilotConfig => { - "workspaces.edit_copilot_config".to_string() - } - Self::WorkspacesEditErrorHandler => { - "workspaces.edit_error_handler".to_string() - } - Self::WorkspacesCreate => "workspaces.create".to_string(), - Self::WorkspacesUpdate => "workspaces.update".to_string(), - Self::WorkspacesArchive => "workspaces.archive".to_string(), - Self::WorkspacesUnarchive => "workspaces.unarchive".to_string(), - Self::WorkspacesDelete => "workspaces.delete".to_string(), - } - } - } - impl std::str::FromStr for AuditLogOperation { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "jobs.run" => Ok(Self::JobsRun), - "jobs.run.script" => Ok(Self::JobsRunScript), - "jobs.run.preview" => Ok(Self::JobsRunPreview), - "jobs.run.flow" => Ok(Self::JobsRunFlow), - "jobs.run.flow_preview" => Ok(Self::JobsRunFlowPreview), - "jobs.run.script_hub" => Ok(Self::JobsRunScriptHub), - "jobs.run.dependencies" => Ok(Self::JobsRunDependencies), - "jobs.run.identity" => Ok(Self::JobsRunIdentity), - "jobs.run.noop" => Ok(Self::JobsRunNoop), - "jobs.flow_dependencies" => Ok(Self::JobsFlowDependencies), - "jobs" => Ok(Self::Jobs), - "jobs.cancel" => Ok(Self::JobsCancel), - "jobs.force_cancel" => Ok(Self::JobsForceCancel), - "jobs.disapproval" => Ok(Self::JobsDisapproval), - "jobs.delete" => Ok(Self::JobsDelete), - "account.delete" => Ok(Self::AccountDelete), - "ai.request" => Ok(Self::AiRequest), - "resources.create" => Ok(Self::ResourcesCreate), - "resources.update" => Ok(Self::ResourcesUpdate), - "resources.delete" => Ok(Self::ResourcesDelete), - "resource_types.create" => Ok(Self::ResourceTypesCreate), - "resource_types.update" => Ok(Self::ResourceTypesUpdate), - "resource_types.delete" => Ok(Self::ResourceTypesDelete), - "schedule.create" => Ok(Self::ScheduleCreate), - "schedule.setenabled" => Ok(Self::ScheduleSetenabled), - "schedule.edit" => Ok(Self::ScheduleEdit), - "schedule.delete" => Ok(Self::ScheduleDelete), - "scripts.create" => Ok(Self::ScriptsCreate), - "scripts.update" => Ok(Self::ScriptsUpdate), - "scripts.archive" => Ok(Self::ScriptsArchive), - "scripts.delete" => Ok(Self::ScriptsDelete), - "users.create" => Ok(Self::UsersCreate), - "users.delete" => Ok(Self::UsersDelete), - "users.update" => Ok(Self::UsersUpdate), - "users.login" => Ok(Self::UsersLogin), - "users.login_failure" => Ok(Self::UsersLoginFailure), - "users.logout" => Ok(Self::UsersLogout), - "users.accept_invite" => Ok(Self::UsersAcceptInvite), - "users.decline_invite" => Ok(Self::UsersDeclineInvite), - "users.token.create" => Ok(Self::UsersTokenCreate), - "users.token.delete" => Ok(Self::UsersTokenDelete), - "users.add_to_workspace" => Ok(Self::UsersAddToWorkspace), - "users.add_global" => Ok(Self::UsersAddGlobal), - "users.setpassword" => Ok(Self::UsersSetpassword), - "users.impersonate" => Ok(Self::UsersImpersonate), - "users.leave_workspace" => Ok(Self::UsersLeaveWorkspace), - "oauth.login" => Ok(Self::OauthLogin), - "oauth.login_failure" => Ok(Self::OauthLoginFailure), - "oauth.signup" => Ok(Self::OauthSignup), - "variables.create" => Ok(Self::VariablesCreate), - "variables.delete" => Ok(Self::VariablesDelete), - "variables.update" => Ok(Self::VariablesUpdate), - "flows.create" => Ok(Self::FlowsCreate), - "flows.update" => Ok(Self::FlowsUpdate), - "flows.delete" => Ok(Self::FlowsDelete), - "flows.archive" => Ok(Self::FlowsArchive), - "apps.create" => Ok(Self::AppsCreate), - "apps.update" => Ok(Self::AppsUpdate), - "apps.delete" => Ok(Self::AppsDelete), - "folder.create" => Ok(Self::FolderCreate), - "folder.update" => Ok(Self::FolderUpdate), - "folder.delete" => Ok(Self::FolderDelete), - "folder.add_owner" => Ok(Self::FolderAddOwner), - "folder.remove_owner" => Ok(Self::FolderRemoveOwner), - "group.create" => Ok(Self::GroupCreate), - "group.delete" => Ok(Self::GroupDelete), - "group.edit" => Ok(Self::GroupEdit), - "group.adduser" => Ok(Self::GroupAdduser), - "group.removeuser" => Ok(Self::GroupRemoveuser), - "igroup.create" => Ok(Self::IgroupCreate), - "igroup.delete" => Ok(Self::IgroupDelete), - "igroup.adduser" => Ok(Self::IgroupAdduser), - "igroup.removeuser" => Ok(Self::IgroupRemoveuser), - "variables.decrypt_secret" => Ok(Self::VariablesDecryptSecret), - "workspaces.edit_command_script" => Ok(Self::WorkspacesEditCommandScript), - "workspaces.edit_deploy_to" => Ok(Self::WorkspacesEditDeployTo), - "workspaces.edit_auto_invite_domain" => { - Ok(Self::WorkspacesEditAutoInviteDomain) - } - "workspaces.edit_webhook" => Ok(Self::WorkspacesEditWebhook), - "workspaces.edit_copilot_config" => Ok(Self::WorkspacesEditCopilotConfig), - "workspaces.edit_error_handler" => Ok(Self::WorkspacesEditErrorHandler), - "workspaces.create" => Ok(Self::WorkspacesCreate), - "workspaces.update" => Ok(Self::WorkspacesUpdate), - "workspaces.archive" => Ok(Self::WorkspacesArchive), - "workspaces.unarchive" => Ok(Self::WorkspacesUnarchive), - "workspaces.delete" => Ok(Self::WorkspacesDelete), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AuditLogOperation { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AuditLogOperation { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AuditLogOperation { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AuthenticationMethod { - #[serde(rename = "none")] - None, - #[serde(rename = "windmill")] - Windmill, - #[serde(rename = "api_key")] - ApiKey, - #[serde(rename = "basic_http")] - BasicHttp, - #[serde(rename = "custom_script")] - CustomScript, - #[serde(rename = "signature")] - Signature, - } - impl From<&AuthenticationMethod> for AuthenticationMethod { - fn from(value: &AuthenticationMethod) -> Self { - value.clone() - } - } - impl ToString for AuthenticationMethod { - fn to_string(&self) -> String { - match *self { - Self::None => "none".to_string(), - Self::Windmill => "windmill".to_string(), - Self::ApiKey => "api_key".to_string(), - Self::BasicHttp => "basic_http".to_string(), - Self::CustomScript => "custom_script".to_string(), - Self::Signature => "signature".to_string(), - } - } - } - impl std::str::FromStr for AuthenticationMethod { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "none" => Ok(Self::None), - "windmill" => Ok(Self::Windmill), - "api_key" => Ok(Self::ApiKey), - "basic_http" => Ok(Self::BasicHttp), - "custom_script" => Ok(Self::CustomScript), - "signature" => Ok(Self::Signature), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AuthenticationMethod { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AuthenticationMethod { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AuthenticationMethod { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct AutoscalingEvent { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub applied_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub desired_workers: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub event_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub reason: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker_group: Option, - } - impl From<&AutoscalingEvent> for AutoscalingEvent { - fn from(value: &AutoscalingEvent) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum AwsAuthResourceType { - #[serde(rename = "oidc")] - Oidc, - #[serde(rename = "credentials")] - Credentials, - } - impl From<&AwsAuthResourceType> for AwsAuthResourceType { - fn from(value: &AwsAuthResourceType) -> Self { - value.clone() - } - } - impl ToString for AwsAuthResourceType { - fn to_string(&self) -> String { - match *self { - Self::Oidc => "oidc".to_string(), - Self::Credentials => "credentials".to_string(), - } - } - } - impl std::str::FromStr for AwsAuthResourceType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "oidc" => Ok(Self::Oidc), - "credentials" => Ok(Self::Credentials), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for AwsAuthResourceType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for AwsAuthResourceType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for AwsAuthResourceType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchAll { - pub branches: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - #[serde(rename = "type")] - pub type_: BranchAllType, - } - impl From<&BranchAll> for BranchAll { - fn from(value: &BranchAll) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchAllBranchesItem { - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_failure: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&BranchAllBranchesItem> for BranchAllBranchesItem { - fn from(value: &BranchAllBranchesItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum BranchAllType { - #[serde(rename = "branchall")] - Branchall, - } - impl From<&BranchAllType> for BranchAllType { - fn from(value: &BranchAllType) -> Self { - value.clone() - } - } - impl ToString for BranchAllType { - fn to_string(&self) -> String { - match *self { - Self::Branchall => "branchall".to_string(), - } - } - } - impl std::str::FromStr for BranchAllType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "branchall" => Ok(Self::Branchall), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for BranchAllType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for BranchAllType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for BranchAllType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchOne { - pub branches: Vec, - pub default: Vec, - #[serde(rename = "type")] - pub type_: BranchOneType, - } - impl From<&BranchOne> for BranchOne { - fn from(value: &BranchOne) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct BranchOneBranchesItem { - pub expr: String, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&BranchOneBranchesItem> for BranchOneBranchesItem { - fn from(value: &BranchOneBranchesItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum BranchOneType { - #[serde(rename = "branchone")] - Branchone, - } - impl From<&BranchOneType> for BranchOneType { - fn from(value: &BranchOneType) -> Self { - value.clone() - } - } - impl ToString for BranchOneType { - fn to_string(&self) -> String { - match *self { - Self::Branchone => "branchone".to_string(), - } - } - } - impl std::str::FromStr for BranchOneType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "branchone" => Ok(Self::Branchone), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for BranchOneType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for BranchOneType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for BranchOneType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Capture { - pub created_at: chrono::DateTime, - pub id: i64, - pub main_args: serde_json::Value, - pub preprocessor_args: serde_json::Value, - pub trigger_kind: CaptureTriggerKind, - } - impl From<&Capture> for Capture { - fn from(value: &Capture) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CaptureConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub trigger_config: Option, - pub trigger_kind: CaptureTriggerKind, - } - impl From<&CaptureConfig> for CaptureConfig { - fn from(value: &CaptureConfig) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum CaptureTriggerKind { - #[serde(rename = "webhook")] - Webhook, - #[serde(rename = "http")] - Http, - #[serde(rename = "websocket")] - Websocket, - #[serde(rename = "kafka")] - Kafka, - #[serde(rename = "default_email")] - DefaultEmail, - #[serde(rename = "nats")] - Nats, - #[serde(rename = "postgres")] - Postgres, - #[serde(rename = "sqs")] - Sqs, - #[serde(rename = "mqtt")] - Mqtt, - #[serde(rename = "gcp")] - Gcp, - #[serde(rename = "email")] - Email, - } - impl From<&CaptureTriggerKind> for CaptureTriggerKind { - fn from(value: &CaptureTriggerKind) -> Self { - value.clone() - } - } - impl ToString for CaptureTriggerKind { - fn to_string(&self) -> String { - match *self { - Self::Webhook => "webhook".to_string(), - Self::Http => "http".to_string(), - Self::Websocket => "websocket".to_string(), - Self::Kafka => "kafka".to_string(), - Self::DefaultEmail => "default_email".to_string(), - Self::Nats => "nats".to_string(), - Self::Postgres => "postgres".to_string(), - Self::Sqs => "sqs".to_string(), - Self::Mqtt => "mqtt".to_string(), - Self::Gcp => "gcp".to_string(), - Self::Email => "email".to_string(), - } - } - } - impl std::str::FromStr for CaptureTriggerKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "webhook" => Ok(Self::Webhook), - "http" => Ok(Self::Http), - "websocket" => Ok(Self::Websocket), - "kafka" => Ok(Self::Kafka), - "default_email" => Ok(Self::DefaultEmail), - "nats" => Ok(Self::Nats), - "postgres" => Ok(Self::Postgres), - "sqs" => Ok(Self::Sqs), - "mqtt" => Ok(Self::Mqtt), - "gcp" => Ok(Self::Gcp), - "email" => Ok(Self::Email), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for CaptureTriggerKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for CaptureTriggerKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for CaptureTriggerKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ChannelInfo { - ///The unique identifier of the channel - pub channel_id: String, - ///The display name of the channel - pub channel_name: String, - ///The service URL for the channel - pub service_url: String, - ///The Microsoft Teams tenant identifier - pub tenant_id: String, - } - impl From<&ChannelInfo> for ChannelInfo { - fn from(value: &ChannelInfo) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CompletedJob { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub aggregate_wait_time_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - pub canceled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_reason: Option, - pub created_at: chrono::DateTime, - pub created_by: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deleted: Option, - pub duration_ms: i64, - pub email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_status: Option, - pub id: uuid::Uuid, - pub is_flow_step: bool, - pub is_skipped: bool, - pub job_kind: CompletedJobJobKind, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub labels: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub language: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub logs: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mem_peak: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_job: Option, - /**The user (u/userfoo) or group (g/groupfoo) whom -the execution of this script will be permissioned_as and by extension its DT_TOKEN. -*/ - pub permissioned_as: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessed: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_flow: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub result: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_hash: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub self_wait_time_ms: Option, - pub started_at: chrono::DateTime, - pub success: bool, - pub tag: String, - pub visible_to_owner: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workflow_as_code_status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&CompletedJob> for CompletedJob { - fn from(value: &CompletedJob) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum CompletedJobJobKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "preview")] - Preview, - #[serde(rename = "dependencies")] - Dependencies, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "flowdependencies")] - Flowdependencies, - #[serde(rename = "appdependencies")] - Appdependencies, - #[serde(rename = "flowpreview")] - Flowpreview, - #[serde(rename = "script_hub")] - ScriptHub, - #[serde(rename = "identity")] - Identity, - #[serde(rename = "deploymentcallback")] - Deploymentcallback, - #[serde(rename = "singlescriptflow")] - Singlescriptflow, - #[serde(rename = "flowscript")] - Flowscript, - #[serde(rename = "flownode")] - Flownode, - #[serde(rename = "appscript")] - Appscript, - #[serde(rename = "aiagent")] - Aiagent, - } - impl From<&CompletedJobJobKind> for CompletedJobJobKind { - fn from(value: &CompletedJobJobKind) -> Self { - value.clone() - } - } - impl ToString for CompletedJobJobKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Preview => "preview".to_string(), - Self::Dependencies => "dependencies".to_string(), - Self::Flow => "flow".to_string(), - Self::Flowdependencies => "flowdependencies".to_string(), - Self::Appdependencies => "appdependencies".to_string(), - Self::Flowpreview => "flowpreview".to_string(), - Self::ScriptHub => "script_hub".to_string(), - Self::Identity => "identity".to_string(), - Self::Deploymentcallback => "deploymentcallback".to_string(), - Self::Singlescriptflow => "singlescriptflow".to_string(), - Self::Flowscript => "flowscript".to_string(), - Self::Flownode => "flownode".to_string(), - Self::Appscript => "appscript".to_string(), - Self::Aiagent => "aiagent".to_string(), - } - } - } - impl std::str::FromStr for CompletedJobJobKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "preview" => Ok(Self::Preview), - "dependencies" => Ok(Self::Dependencies), - "flow" => Ok(Self::Flow), - "flowdependencies" => Ok(Self::Flowdependencies), - "appdependencies" => Ok(Self::Appdependencies), - "flowpreview" => Ok(Self::Flowpreview), - "script_hub" => Ok(Self::ScriptHub), - "identity" => Ok(Self::Identity), - "deploymentcallback" => Ok(Self::Deploymentcallback), - "singlescriptflow" => Ok(Self::Singlescriptflow), - "flowscript" => Ok(Self::Flowscript), - "flownode" => Ok(Self::Flownode), - "appscript" => Ok(Self::Appscript), - "aiagent" => Ok(Self::Aiagent), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for CompletedJobJobKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for CompletedJobJobKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for CompletedJobJobKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConcurrencyGroup { - pub concurrency_key: String, - pub total_running: f64, - } - impl From<&ConcurrencyGroup> for ConcurrencyGroup { - fn from(value: &ConcurrencyGroup) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Config { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub config: std::collections::HashMap, - pub name: String, - } - impl From<&Config> for Config { - fn from(value: &Config) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Configs(pub Option); - impl std::ops::Deref for Configs { - type Target = Option; - fn deref(&self) -> &Option { - &self.0 - } - } - impl From for Option { - fn from(value: Configs) -> Self { - value.0 - } - } - impl From<&Configs> for Configs { - fn from(value: &Configs) -> Self { - value.clone() - } - } - impl From> for Configs { - fn from(value: Option) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ConfigsInner { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub alerts: Vec, - } - impl From<&ConfigsInner> for ConfigsInner { - fn from(value: &ConfigsInner) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ContextualVariable { - pub description: String, - pub is_custom: bool, - pub name: String, - pub value: String, - } - impl From<&ContextualVariable> for ContextualVariable { - fn from(value: &ContextualVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateFlowBody { - #[serde(flatten)] - pub open_flow_w_path: OpenFlowWPath, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - } - impl From<&CreateFlowBody> for CreateFlowBody { - fn from(value: &CreateFlowBody) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateInput { - pub args: std::collections::HashMap, - pub name: String, - } - impl From<&CreateInput> for CreateInput { - fn from(value: &CreateInput) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateResource { - ///The description of the resource - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - ///The path to the resource - pub path: String, - ///The resource_type associated with the resource - pub resource_type: String, - pub value: serde_json::Value, - } - impl From<&CreateResource> for CreateResource { - fn from(value: &CreateResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateVariable { - ///The account identifier - #[serde(default, skip_serializing_if = "Option::is_none")] - pub account: Option, - ///The description of the variable - pub description: String, - ///The expiration date of the variable - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires_at: Option>, - ///Whether the variable is an OAuth variable - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_oauth: Option, - ///Whether the variable is a secret - pub is_secret: bool, - ///The path to the variable - pub path: String, - ///The value of the variable - pub value: String, - } - impl From<&CreateVariable> for CreateVariable { - fn from(value: &CreateVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateWorkspace { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - pub id: String, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - } - impl From<&CreateWorkspace> for CreateWorkspace { - fn from(value: &CreateWorkspace) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CreateWorkspaceFork { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - pub id: String, - pub name: String, - pub parent_workspace_id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - } - impl From<&CreateWorkspaceFork> for CreateWorkspaceFork { - fn from(value: &CreateWorkspaceFork) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct CriticalAlert { - ///Acknowledgment status of the alert, can be true, false, or null if not set - #[serde(default, skip_serializing_if = "Option::is_none")] - pub acknowledged: Option, - ///Type of alert (e.g., critical_error) - #[serde(default, skip_serializing_if = "Option::is_none")] - pub alert_type: Option, - ///Time when the alert was created - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_at: Option>, - ///Unique identifier for the alert - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - ///The message content of the alert - #[serde(default, skip_serializing_if = "Option::is_none")] - pub message: Option, - ///Workspace id if the alert is in the scope of a workspace - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&CriticalAlert> for CriticalAlert { - fn from(value: &CriticalAlert) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DeleteGcpSubscription { - pub subscription_id: String, - } - impl From<&DeleteGcpSubscription> for DeleteGcpSubscription { - fn from(value: &DeleteGcpSubscription) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum DeliveryType { - #[serde(rename = "push")] - Push, - #[serde(rename = "pull")] - Pull, - } - impl From<&DeliveryType> for DeliveryType { - fn from(value: &DeliveryType) -> Self { - value.clone() - } - } - impl ToString for DeliveryType { - fn to_string(&self) -> String { - match *self { - Self::Push => "push".to_string(), - Self::Pull => "pull".to_string(), - } - } - } - impl std::str::FromStr for DeliveryType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "push" => Ok(Self::Push), - "pull" => Ok(Self::Pull), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for DeliveryType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for DeliveryType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for DeliveryType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DependencyMap { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub imported_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub importer_kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub importer_node_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub importer_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&DependencyMap> for DependencyMap { - fn from(value: &DependencyMap) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DucklakeSettings { - pub ducklakes: std::collections::HashMap, - } - impl From<&DucklakeSettings> for DucklakeSettings { - fn from(value: &DucklakeSettings) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DucklakeSettingsDucklakesValue { - pub catalog: DucklakeSettingsDucklakesValueCatalog, - pub storage: DucklakeSettingsDucklakesValueStorage, - } - impl From<&DucklakeSettingsDucklakesValue> for DucklakeSettingsDucklakesValue { - fn from(value: &DucklakeSettingsDucklakesValue) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DucklakeSettingsDucklakesValueCatalog { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource_path: Option, - pub resource_type: DucklakeSettingsDucklakesValueCatalogResourceType, - } - impl From<&DucklakeSettingsDucklakesValueCatalog> - for DucklakeSettingsDucklakesValueCatalog { - fn from(value: &DucklakeSettingsDucklakesValueCatalog) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum DucklakeSettingsDucklakesValueCatalogResourceType { - #[serde(rename = "postgresql")] - Postgresql, - #[serde(rename = "mysql")] - Mysql, - #[serde(rename = "instance")] - Instance, - } - impl From<&DucklakeSettingsDucklakesValueCatalogResourceType> - for DucklakeSettingsDucklakesValueCatalogResourceType { - fn from(value: &DucklakeSettingsDucklakesValueCatalogResourceType) -> Self { - value.clone() - } - } - impl ToString for DucklakeSettingsDucklakesValueCatalogResourceType { - fn to_string(&self) -> String { - match *self { - Self::Postgresql => "postgresql".to_string(), - Self::Mysql => "mysql".to_string(), - Self::Instance => "instance".to_string(), - } - } - } - impl std::str::FromStr for DucklakeSettingsDucklakesValueCatalogResourceType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "postgresql" => Ok(Self::Postgresql), - "mysql" => Ok(Self::Mysql), - "instance" => Ok(Self::Instance), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> - for DucklakeSettingsDucklakesValueCatalogResourceType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> - for DucklakeSettingsDucklakesValueCatalogResourceType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom - for DucklakeSettingsDucklakesValueCatalogResourceType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct DucklakeSettingsDucklakesValueStorage { - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&DucklakeSettingsDucklakesValueStorage> - for DucklakeSettingsDucklakesValueStorage { - fn from(value: &DucklakeSettingsDucklakesValueStorage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditEmailTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub local_part: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_local_part: Option, - } - impl From<&EditEmailTrigger> for EditEmailTrigger { - fn from(value: &EditEmailTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditHttpTrigger { - pub authentication_method: AuthenticationMethod, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authentication_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub http_method: HttpMethod, - pub is_async: bool, - pub is_flow: bool, - pub is_static_website: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_string: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub route_path: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub static_asset_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_route: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub wrap_body: Option, - } - impl From<&EditHttpTrigger> for EditHttpTrigger { - fn from(value: &EditHttpTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditHttpTriggerStaticAssetConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&EditHttpTriggerStaticAssetConfig> for EditHttpTriggerStaticAssetConfig { - fn from(value: &EditHttpTriggerStaticAssetConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditKafkaTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub group_id: String, - pub is_flow: bool, - pub kafka_resource_path: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - pub topics: Vec, - } - impl From<&EditKafkaTrigger> for EditKafkaTrigger { - fn from(value: &EditKafkaTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditMqttTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_version: Option, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub mqtt_resource_path: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - pub subscribe_topics: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v3_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v5_config: Option, - } - impl From<&EditMqttTrigger> for EditMqttTrigger { - fn from(value: &EditMqttTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditNatsTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub consumer_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub nats_resource_path: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stream_name: Option, - pub subjects: Vec, - pub use_jetstream: bool, - } - impl From<&EditNatsTrigger> for EditNatsTrigger { - fn from(value: &EditNatsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditPostgresTrigger { - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub path: String, - pub postgres_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub publication: Option, - pub publication_name: String, - pub replication_slot_name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - } - impl From<&EditPostgresTrigger> for EditPostgresTrigger { - fn from(value: &EditPostgresTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditResource { - ///The new description of the resource - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - ///The path to the resource - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - ///The new resource_type to be associated with the resource - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&EditResource> for EditResource { - fn from(value: &EditResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditResourceType { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schema: Option, - } - impl From<&EditResourceType> for EditResourceType { - fn from(value: &EditResourceType) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditSchedule { - pub args: ScriptArgs, - ///The version of the cron schedule to use (last is v2) - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - ///The description of the schedule - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - ///Whether the schedule should not run if a flow is already running - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_flow_overlap: Option, - ///The path to the script or flow to trigger on failure - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure: Option, - ///Whether the schedule should only run on the exact time - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_exact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_times: Option, - ///The path to the script or flow to trigger on recovery - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_times: Option, - ///The path to the script or flow to trigger on success - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success_extra_args: Option, - ///The date and time the schedule will be paused until - #[serde(default, skip_serializing_if = "Option::is_none")] - pub paused_until: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - ///The cron schedule to trigger the script or flow. Should include seconds. - pub schedule: String, - ///The summary of the schedule - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - ///The tag of the schedule - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - ///The timezone to use for the cron schedule - pub timezone: String, - ///Whether the WebSocket error handler is muted - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&EditSchedule> for EditSchedule { - fn from(value: &EditSchedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditSqsTrigger { - pub aws_auth_resource_type: AwsAuthResourceType, - pub aws_resource_path: String, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub message_attributes: Vec, - pub path: String, - pub queue_url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - } - impl From<&EditSqsTrigger> for EditSqsTrigger { - fn from(value: &EditSqsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditVariable { - ///The new description of the variable - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - ///Whether the variable is a secret - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_secret: Option, - ///The path to the variable - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - ///The new value of the variable - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - } - impl From<&EditVariable> for EditVariable { - fn from(value: &EditVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWebsocketTrigger { - pub can_return_message: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub filters: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub initial_messages: Vec, - pub is_flow: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&EditWebsocketTrigger> for EditWebsocketTrigger { - fn from(value: &EditWebsocketTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWebsocketTriggerFiltersItem { - pub key: String, - pub value: serde_json::Value, - } - impl From<&EditWebsocketTriggerFiltersItem> for EditWebsocketTriggerFiltersItem { - fn from(value: &EditWebsocketTriggerFiltersItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EditWorkspaceUser { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub disabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_admin: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator: Option, - } - impl From<&EditWorkspaceUser> for EditWorkspaceUser { - fn from(value: &EditWorkspaceUser) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EmailTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub local_part: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_local_part: Option, - } - impl From<&EmailTrigger> for EmailTrigger { - fn from(value: &EmailTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct EndpointTool { - ///JSON schema for request body - #[serde(default, skip_serializing_if = "Option::is_none")] - pub body_schema: Option>, - ///Short description of the tool - pub description: String, - ///Detailed instructions for using the tool - pub instructions: String, - ///HTTP method (GET, POST, etc.) - pub method: String, - ///The tool name/operation ID - pub name: String, - ///API endpoint path - pub path: String, - ///JSON schema for path parameters - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path_params_schema: Option< - std::collections::HashMap, - >, - ///JSON schema for query parameters - #[serde(default, skip_serializing_if = "Option::is_none")] - pub query_params_schema: Option< - std::collections::HashMap, - >, - } - impl From<&EndpointTool> for EndpointTool { - fn from(value: &EndpointTool) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ErrorHandler { - #[serde(rename = "custom")] - Custom, - #[serde(rename = "slack")] - Slack, - #[serde(rename = "teams")] - Teams, - #[serde(rename = "email")] - Email, - } - impl From<&ErrorHandler> for ErrorHandler { - fn from(value: &ErrorHandler) -> Self { - value.clone() - } - } - impl ToString for ErrorHandler { - fn to_string(&self) -> String { - match *self { - Self::Custom => "custom".to_string(), - Self::Slack => "slack".to_string(), - Self::Teams => "teams".to_string(), - Self::Email => "email".to_string(), - } - } - } - impl std::str::FromStr for ErrorHandler { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "custom" => Ok(Self::Custom), - "slack" => Ok(Self::Slack), - "teams" => Ok(Self::Teams), - "email" => Ok(Self::Email), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ErrorHandler { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ErrorHandler { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ErrorHandler { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExportedInstanceGroup { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub emails: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub external_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scim_display_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&ExportedInstanceGroup> for ExportedInstanceGroup { - fn from(value: &ExportedInstanceGroup) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExportedUser { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub company: Option, - pub email: String, - pub first_time_user: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub password_hash: Option, - pub super_admin: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - pub verified: bool, - } - impl From<&ExportedUser> for ExportedUser { - fn from(value: &ExportedUser) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExtendedJobs { - pub jobs: Vec, - pub obscured_jobs: Vec, - ///Obscured jobs omitted for security because of too specific filtering - #[serde(default, skip_serializing_if = "Option::is_none")] - pub omitted_obscured_jobs: Option, - } - impl From<&ExtendedJobs> for ExtendedJobs { - fn from(value: &ExtendedJobs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ExtraPerms(pub std::collections::HashMap); - impl std::ops::Deref for ExtraPerms { - type Target = std::collections::HashMap; - fn deref(&self) -> &std::collections::HashMap { - &self.0 - } - } - impl From for std::collections::HashMap { - fn from(value: ExtraPerms) -> Self { - value.0 - } - } - impl From<&ExtraPerms> for ExtraPerms { - fn from(value: &ExtraPerms) -> Self { - value.clone() - } - } - impl From> for ExtraPerms { - fn from(value: std::collections::HashMap) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Flow { - #[serde(flatten)] - pub open_flow: OpenFlow, - #[serde(flatten)] - pub flow_metadata: FlowMetadata, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock_error_logs: Option, - } - impl From<&Flow> for Flow { - fn from(value: &Flow) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowMetadata { - pub archived: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - pub edited_at: chrono::DateTime, - pub edited_by: String, - pub extra_perms: ExtraPerms, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub starred: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&FlowMetadata> for FlowMetadata { - fn from(value: &FlowMetadata) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModule { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub continue_on_error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delete_after_use: Option, - pub id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_if: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sleep: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stop_after_all_iters_if: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stop_after_if: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub suspend: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - pub value: FlowModuleValue, - } - impl From<&FlowModule> for FlowModule { - fn from(value: &FlowModule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleMock { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub return_value: Option, - } - impl From<&FlowModuleMock> for FlowModuleMock { - fn from(value: &FlowModuleMock) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleSkipIf { - pub expr: String, - } - impl From<&FlowModuleSkipIf> for FlowModuleSkipIf { - fn from(value: &FlowModuleSkipIf) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleSuspend { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub continue_on_disapprove_timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub hide_cancel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub required_events: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resume_form: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub self_approval_disabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub user_auth_required: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub user_groups_required: Option, - } - impl From<&FlowModuleSuspend> for FlowModuleSuspend { - fn from(value: &FlowModuleSuspend) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowModuleSuspendResumeForm { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - } - impl From<&FlowModuleSuspendResumeForm> for FlowModuleSuspendResumeForm { - fn from(value: &FlowModuleSuspendResumeForm) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(untagged)] - pub enum FlowModuleValue { - RawScript(RawScript), - PathScript(PathScript), - PathFlow(PathFlow), - ForloopFlow(ForloopFlow), - WhileloopFlow(WhileloopFlow), - BranchOne(BranchOne), - BranchAll(BranchAll), - Identity(Identity), - AiAgent(AiAgent), - } - impl From<&FlowModuleValue> for FlowModuleValue { - fn from(value: &FlowModuleValue) -> Self { - value.clone() - } - } - impl From for FlowModuleValue { - fn from(value: RawScript) -> Self { - Self::RawScript(value) - } - } - impl From for FlowModuleValue { - fn from(value: PathScript) -> Self { - Self::PathScript(value) - } - } - impl From for FlowModuleValue { - fn from(value: PathFlow) -> Self { - Self::PathFlow(value) - } - } - impl From for FlowModuleValue { - fn from(value: ForloopFlow) -> Self { - Self::ForloopFlow(value) - } - } - impl From for FlowModuleValue { - fn from(value: WhileloopFlow) -> Self { - Self::WhileloopFlow(value) - } - } - impl From for FlowModuleValue { - fn from(value: BranchOne) -> Self { - Self::BranchOne(value) - } - } - impl From for FlowModuleValue { - fn from(value: BranchAll) -> Self { - Self::BranchAll(value) - } - } - impl From for FlowModuleValue { - fn from(value: Identity) -> Self { - Self::Identity(value) - } - } - impl From for FlowModuleValue { - fn from(value: AiAgent) -> Self { - Self::AiAgent(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowPreview { - pub args: ScriptArgs, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restarted_from: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - pub value: FlowValue, - } - impl From<&FlowPreview> for FlowPreview { - fn from(value: &FlowPreview) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatus { - pub failure_module: FlowStatusFailureModule, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessor_module: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub step: i64, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub user_states: std::collections::HashMap, - } - impl From<&FlowStatus> for FlowStatus { - fn from(value: &FlowStatus) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusFailureModule { - #[serde(flatten)] - pub flow_status_module: FlowStatusModule, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_module: Option, - } - impl From<&FlowStatusFailureModule> for FlowStatusFailureModule { - fn from(value: &FlowStatusFailureModule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModule { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub agent_actions: Vec>, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub agent_actions_success: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub approvers: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branch_chosen: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branchall: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub count: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub failed_retries: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub flow_jobs: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub flow_jobs_success: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub iterator: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub job: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub progress: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skipped: Option, - #[serde(rename = "type")] - pub type_: FlowStatusModuleType, - } - impl From<&FlowStatusModule> for FlowStatusModule { - fn from(value: &FlowStatusModule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleApproversItem { - pub approver: String, - pub resume_id: i64, - } - impl From<&FlowStatusModuleApproversItem> for FlowStatusModuleApproversItem { - fn from(value: &FlowStatusModuleApproversItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleBranchChosen { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branch: Option, - #[serde(rename = "type")] - pub type_: FlowStatusModuleBranchChosenType, - } - impl From<&FlowStatusModuleBranchChosen> for FlowStatusModuleBranchChosen { - fn from(value: &FlowStatusModuleBranchChosen) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum FlowStatusModuleBranchChosenType { - #[serde(rename = "branch")] - Branch, - #[serde(rename = "default")] - Default, - } - impl From<&FlowStatusModuleBranchChosenType> for FlowStatusModuleBranchChosenType { - fn from(value: &FlowStatusModuleBranchChosenType) -> Self { - value.clone() - } - } - impl ToString for FlowStatusModuleBranchChosenType { - fn to_string(&self) -> String { - match *self { - Self::Branch => "branch".to_string(), - Self::Default => "default".to_string(), - } - } - } - impl std::str::FromStr for FlowStatusModuleBranchChosenType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "branch" => Ok(Self::Branch), - "default" => Ok(Self::Default), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for FlowStatusModuleBranchChosenType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for FlowStatusModuleBranchChosenType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for FlowStatusModuleBranchChosenType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleBranchall { - pub branch: i64, - pub len: i64, - } - impl From<&FlowStatusModuleBranchall> for FlowStatusModuleBranchall { - fn from(value: &FlowStatusModuleBranchall) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusModuleIterator { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub index: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub itered: Vec, - } - impl From<&FlowStatusModuleIterator> for FlowStatusModuleIterator { - fn from(value: &FlowStatusModuleIterator) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum FlowStatusModuleType { - WaitingForPriorSteps, - WaitingForEvents, - WaitingForExecutor, - InProgress, - Success, - Failure, - } - impl From<&FlowStatusModuleType> for FlowStatusModuleType { - fn from(value: &FlowStatusModuleType) -> Self { - value.clone() - } - } - impl ToString for FlowStatusModuleType { - fn to_string(&self) -> String { - match *self { - Self::WaitingForPriorSteps => "WaitingForPriorSteps".to_string(), - Self::WaitingForEvents => "WaitingForEvents".to_string(), - Self::WaitingForExecutor => "WaitingForExecutor".to_string(), - Self::InProgress => "InProgress".to_string(), - Self::Success => "Success".to_string(), - Self::Failure => "Failure".to_string(), - } - } - } - impl std::str::FromStr for FlowStatusModuleType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "WaitingForPriorSteps" => Ok(Self::WaitingForPriorSteps), - "WaitingForEvents" => Ok(Self::WaitingForEvents), - "WaitingForExecutor" => Ok(Self::WaitingForExecutor), - "InProgress" => Ok(Self::InProgress), - "Success" => Ok(Self::Success), - "Failure" => Ok(Self::Failure), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for FlowStatusModuleType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for FlowStatusModuleType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for FlowStatusModuleType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowStatusRetry { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub fail_count: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub failed_jobs: Vec, - } - impl From<&FlowStatusRetry> for FlowStatusRetry { - fn from(value: &FlowStatusRetry) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowValue { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub early_return: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub failure_module: Option, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessor_module: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub same_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_expr: Option, - } - impl From<&FlowValue> for FlowValue { - fn from(value: &FlowValue) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct FlowVersion { - pub created_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - pub id: i64, - } - impl From<&FlowVersion> for FlowVersion { - fn from(value: &FlowVersion) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Folder { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - pub extra_perms: std::collections::HashMap, - pub name: String, - pub owners: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&Folder> for Folder { - fn from(value: &Folder) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ForloopFlow { - pub iterator: InputTransform, - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallelism: Option, - pub skip_failures: bool, - #[serde(rename = "type")] - pub type_: ForloopFlowType, - } - impl From<&ForloopFlow> for ForloopFlow { - fn from(value: &ForloopFlow) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ForloopFlowType { - #[serde(rename = "forloopflow")] - Forloopflow, - } - impl From<&ForloopFlowType> for ForloopFlowType { - fn from(value: &ForloopFlowType) -> Self { - value.clone() - } - } - impl ToString for ForloopFlowType { - fn to_string(&self) -> String { - match *self { - Self::Forloopflow => "forloopflow".to_string(), - } - } - } - impl std::str::FromStr for ForloopFlowType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "forloopflow" => Ok(Self::Forloopflow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ForloopFlowType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ForloopFlowType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ForloopFlowType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GcpTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delivery_config: Option, - pub delivery_type: DeliveryType, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub gcp_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub subscription_id: String, - pub subscription_mode: SubscriptionMode, - pub topic_id: String, - } - impl From<&GcpTrigger> for GcpTrigger { - fn from(value: &GcpTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GcpTriggerData { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub auto_acknowledge_msg: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub base_endpoint: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delivery_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delivery_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub gcp_resource_path: String, - pub is_flow: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subscription_id: Option, - pub subscription_mode: SubscriptionMode, - pub topic_id: String, - } - impl From<&GcpTriggerData> for GcpTriggerData { - fn from(value: &GcpTriggerData) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GenerateOpenapiSpec { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub http_route_filters: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub info: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub openapi_spec_format: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub webhook_filters: Vec, - } - impl From<&GenerateOpenapiSpec> for GenerateOpenapiSpec { - fn from(value: &GenerateOpenapiSpec) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GetAllTopicSubscription { - pub topic_id: String, - } - impl From<&GetAllTopicSubscription> for GetAllTopicSubscription { - fn from(value: &GetAllTopicSubscription) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GitRepositorySettings { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub collapsed: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub exclude_types_override: Vec, - pub git_repo_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub group_by_folder: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub settings: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub use_individual_branch: Option, - } - impl From<&GitRepositorySettings> for GitRepositorySettings { - fn from(value: &GitRepositorySettings) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GitRepositorySettingsSettings { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub exclude_path: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub extra_include_path: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_path: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_type: Vec, - } - impl From<&GitRepositorySettingsSettings> for GitRepositorySettingsSettings { - fn from(value: &GitRepositorySettingsSettings) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum GitSyncObjectType { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "app")] - App, - #[serde(rename = "folder")] - Folder, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "variable")] - Variable, - #[serde(rename = "secret")] - Secret, - #[serde(rename = "resourcetype")] - Resourcetype, - #[serde(rename = "schedule")] - Schedule, - #[serde(rename = "user")] - User, - #[serde(rename = "group")] - Group, - #[serde(rename = "trigger")] - Trigger, - #[serde(rename = "settings")] - Settings, - #[serde(rename = "key")] - Key, - } - impl From<&GitSyncObjectType> for GitSyncObjectType { - fn from(value: &GitSyncObjectType) -> Self { - value.clone() - } - } - impl ToString for GitSyncObjectType { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - Self::App => "app".to_string(), - Self::Folder => "folder".to_string(), - Self::Resource => "resource".to_string(), - Self::Variable => "variable".to_string(), - Self::Secret => "secret".to_string(), - Self::Resourcetype => "resourcetype".to_string(), - Self::Schedule => "schedule".to_string(), - Self::User => "user".to_string(), - Self::Group => "group".to_string(), - Self::Trigger => "trigger".to_string(), - Self::Settings => "settings".to_string(), - Self::Key => "key".to_string(), - } - } - } - impl std::str::FromStr for GitSyncObjectType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - "app" => Ok(Self::App), - "folder" => Ok(Self::Folder), - "resource" => Ok(Self::Resource), - "variable" => Ok(Self::Variable), - "secret" => Ok(Self::Secret), - "resourcetype" => Ok(Self::Resourcetype), - "schedule" => Ok(Self::Schedule), - "user" => Ok(Self::User), - "group" => Ok(Self::Group), - "trigger" => Ok(Self::Trigger), - "settings" => Ok(Self::Settings), - "key" => Ok(Self::Key), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for GitSyncObjectType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for GitSyncObjectType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for GitSyncObjectType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GithubInstallations(pub Vec); - impl std::ops::Deref for GithubInstallations { - type Target = Vec; - fn deref(&self) -> &Vec { - &self.0 - } - } - impl From for Vec { - fn from(value: GithubInstallations) -> Self { - value.0 - } - } - impl From<&GithubInstallations> for GithubInstallations { - fn from(value: &GithubInstallations) -> Self { - value.clone() - } - } - impl From> for GithubInstallations { - fn from(value: Vec) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GithubInstallationsItem { - pub account_id: String, - pub installation_id: f64, - pub repositories: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&GithubInstallationsItem> for GithubInstallationsItem { - fn from(value: &GithubInstallationsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GithubInstallationsItemRepositoriesItem { - pub name: String, - pub url: String, - } - impl From<&GithubInstallationsItemRepositoriesItem> - for GithubInstallationsItemRepositoriesItem { - fn from(value: &GithubInstallationsItemRepositoriesItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalSetting { - pub name: String, - pub value: std::collections::HashMap, - } - impl From<&GlobalSetting> for GlobalSetting { - fn from(value: &GlobalSetting) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct GlobalUserInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub company: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub devops: Option, - pub email: String, - pub login_type: GlobalUserInfoLoginType, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator_only: Option, - pub super_admin: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub username: Option, - pub verified: bool, - } - impl From<&GlobalUserInfo> for GlobalUserInfo { - fn from(value: &GlobalUserInfo) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum GlobalUserInfoLoginType { - #[serde(rename = "password")] - Password, - #[serde(rename = "github")] - Github, - } - impl From<&GlobalUserInfoLoginType> for GlobalUserInfoLoginType { - fn from(value: &GlobalUserInfoLoginType) -> Self { - value.clone() - } - } - impl ToString for GlobalUserInfoLoginType { - fn to_string(&self) -> String { - match *self { - Self::Password => "password".to_string(), - Self::Github => "github".to_string(), - } - } - } - impl std::str::FromStr for GlobalUserInfoLoginType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "password" => Ok(Self::Password), - "github" => Ok(Self::Github), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for GlobalUserInfoLoginType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for GlobalUserInfoLoginType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for GlobalUserInfoLoginType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Group { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub members: Vec, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&Group> for Group { - fn from(value: &Group) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum HttpMethod { - #[serde(rename = "get")] - Get, - #[serde(rename = "post")] - Post, - #[serde(rename = "put")] - Put, - #[serde(rename = "delete")] - Delete, - #[serde(rename = "patch")] - Patch, - } - impl From<&HttpMethod> for HttpMethod { - fn from(value: &HttpMethod) -> Self { - value.clone() - } - } - impl ToString for HttpMethod { - fn to_string(&self) -> String { - match *self { - Self::Get => "get".to_string(), - Self::Post => "post".to_string(), - Self::Put => "put".to_string(), - Self::Delete => "delete".to_string(), - Self::Patch => "patch".to_string(), - } - } - } - impl std::str::FromStr for HttpMethod { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "get" => Ok(Self::Get), - "post" => Ok(Self::Post), - "put" => Ok(Self::Put), - "delete" => Ok(Self::Delete), - "patch" => Ok(Self::Patch), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for HttpMethod { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for HttpMethod { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for HttpMethod { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct HttpTrigger { - pub authentication_method: AuthenticationMethod, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authentication_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub http_method: HttpMethod, - pub is_async: bool, - pub is_static_website: bool, - pub raw_string: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub route_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub static_asset_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - pub workspaced_route: bool, - pub wrap_body: bool, - } - impl From<&HttpTrigger> for HttpTrigger { - fn from(value: &HttpTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct HttpTriggerStaticAssetConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&HttpTriggerStaticAssetConfig> for HttpTriggerStaticAssetConfig { - fn from(value: &HttpTriggerStaticAssetConfig) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum HubScriptKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "failure")] - Failure, - #[serde(rename = "trigger")] - Trigger, - #[serde(rename = "approval")] - Approval, - } - impl From<&HubScriptKind> for HubScriptKind { - fn from(value: &HubScriptKind) -> Self { - value.clone() - } - } - impl ToString for HubScriptKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Failure => "failure".to_string(), - Self::Trigger => "trigger".to_string(), - Self::Approval => "approval".to_string(), - } - } - } - impl std::str::FromStr for HubScriptKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "failure" => Ok(Self::Failure), - "trigger" => Ok(Self::Trigger), - "approval" => Ok(Self::Approval), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for HubScriptKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for HubScriptKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for HubScriptKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Identity { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow: Option, - #[serde(rename = "type")] - pub type_: IdentityType, - } - impl From<&Identity> for Identity { - fn from(value: &Identity) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum IdentityType { - #[serde(rename = "identity")] - Identity, - } - impl From<&IdentityType> for IdentityType { - fn from(value: &IdentityType) -> Self { - value.clone() - } - } - impl ToString for IdentityType { - fn to_string(&self) -> String { - match *self { - Self::Identity => "identity".to_string(), - } - } - } - impl std::str::FromStr for IdentityType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "identity" => Ok(Self::Identity), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for IdentityType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for IdentityType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for IdentityType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Input { - pub created_at: chrono::DateTime, - pub created_by: String, - pub id: String, - pub is_public: bool, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub success: Option, - } - impl From<&Input> for Input { - fn from(value: &Input) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(untagged)] - pub enum InputTransform { - StaticTransform(StaticTransform), - JavascriptTransform(JavascriptTransform), - } - impl From<&InputTransform> for InputTransform { - fn from(value: &InputTransform) -> Self { - value.clone() - } - } - impl From for InputTransform { - fn from(value: StaticTransform) -> Self { - Self::StaticTransform(value) - } - } - impl From for InputTransform { - fn from(value: JavascriptTransform) -> Self { - Self::JavascriptTransform(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct InstanceGroup { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub emails: Vec, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - } - impl From<&InstanceGroup> for InstanceGroup { - fn from(value: &InstanceGroup) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct InstanceGroupWithWorkspaces { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub emails: Vec, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub workspaces: Vec, - } - impl From<&InstanceGroupWithWorkspaces> for InstanceGroupWithWorkspaces { - fn from(value: &InstanceGroupWithWorkspaces) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JavascriptTransform { - pub expr: String, - #[serde(rename = "type")] - pub type_: JavascriptTransformType, - } - impl From<&JavascriptTransform> for JavascriptTransform { - fn from(value: &JavascriptTransform) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum JavascriptTransformType { - #[serde(rename = "javascript")] - Javascript, - } - impl From<&JavascriptTransformType> for JavascriptTransformType { - fn from(value: &JavascriptTransformType) -> Self { - value.clone() - } - } - impl ToString for JavascriptTransformType { - fn to_string(&self) -> String { - match *self { - Self::Javascript => "javascript".to_string(), - } - } - } - impl std::str::FromStr for JavascriptTransformType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "javascript" => Ok(Self::Javascript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for JavascriptTransformType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for JavascriptTransformType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for JavascriptTransformType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - #[serde(untagged)] - pub enum Job { - Variant0(JobVariant0), - Variant1(JobVariant1), - } - impl From<&Job> for Job { - fn from(value: &Job) -> Self { - value.clone() - } - } - impl From for Job { - fn from(value: JobVariant0) -> Self { - Self::Variant0(value) - } - } - impl From for Job { - fn from(value: JobVariant1) -> Self { - Self::Variant1(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JobSearchHit { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dancer: Option, - } - impl From<&JobSearchHit> for JobSearchHit { - fn from(value: &JobSearchHit) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JobVariant0 { - #[serde(flatten)] - pub completed_job: CompletedJob, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&JobVariant0> for JobVariant0 { - fn from(value: &JobVariant0) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum JobVariant0Type { - CompletedJob, - } - impl From<&JobVariant0Type> for JobVariant0Type { - fn from(value: &JobVariant0Type) -> Self { - value.clone() - } - } - impl ToString for JobVariant0Type { - fn to_string(&self) -> String { - match *self { - Self::CompletedJob => "CompletedJob".to_string(), - } - } - } - impl std::str::FromStr for JobVariant0Type { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "CompletedJob" => Ok(Self::CompletedJob), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for JobVariant0Type { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for JobVariant0Type { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for JobVariant0Type { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct JobVariant1 { - #[serde(flatten)] - pub queued_job: QueuedJob, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&JobVariant1> for JobVariant1 { - fn from(value: &JobVariant1) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum JobVariant1Type { - QueuedJob, - } - impl From<&JobVariant1Type> for JobVariant1Type { - fn from(value: &JobVariant1Type) -> Self { - value.clone() - } - } - impl ToString for JobVariant1Type { - fn to_string(&self) -> String { - match *self { - Self::QueuedJob => "QueuedJob".to_string(), - } - } - } - impl std::str::FromStr for JobVariant1Type { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "QueuedJob" => Ok(Self::QueuedJob), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for JobVariant1Type { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for JobVariant1Type { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for JobVariant1Type { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct KafkaTrigger { - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub group_id: String, - pub kafka_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub topics: Vec, - } - impl From<&KafkaTrigger> for KafkaTrigger { - fn from(value: &KafkaTrigger) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum Language { - Typescript, - } - impl From<&Language> for Language { - fn from(value: &Language) -> Self { - value.clone() - } - } - impl ToString for Language { - fn to_string(&self) -> String { - match *self { - Self::Typescript => "Typescript".to_string(), - } - } - } - impl std::str::FromStr for Language { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Typescript" => Ok(Self::Typescript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for Language { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for Language { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for Language { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LargeFileStorage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub azure_blob_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub gcs_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub public_resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub secondary_storage: std::collections::HashMap< - String, - LargeFileStorageSecondaryStorageValue, - >, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&LargeFileStorage> for LargeFileStorage { - fn from(value: &LargeFileStorage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LargeFileStorageSecondaryStorageValue { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub azure_blob_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub gcs_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub public_resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_resource_path: Option, - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - } - impl From<&LargeFileStorageSecondaryStorageValue> - for LargeFileStorageSecondaryStorageValue { - fn from(value: &LargeFileStorageSecondaryStorageValue) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum LargeFileStorageSecondaryStorageValueType { - S3Storage, - AzureBlobStorage, - AzureWorkloadIdentity, - S3AwsOidc, - GoogleCloudStorage, - } - impl From<&LargeFileStorageSecondaryStorageValueType> - for LargeFileStorageSecondaryStorageValueType { - fn from(value: &LargeFileStorageSecondaryStorageValueType) -> Self { - value.clone() - } - } - impl ToString for LargeFileStorageSecondaryStorageValueType { - fn to_string(&self) -> String { - match *self { - Self::S3Storage => "S3Storage".to_string(), - Self::AzureBlobStorage => "AzureBlobStorage".to_string(), - Self::AzureWorkloadIdentity => "AzureWorkloadIdentity".to_string(), - Self::S3AwsOidc => "S3AwsOidc".to_string(), - Self::GoogleCloudStorage => "GoogleCloudStorage".to_string(), - } - } - } - impl std::str::FromStr for LargeFileStorageSecondaryStorageValueType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "S3Storage" => Ok(Self::S3Storage), - "AzureBlobStorage" => Ok(Self::AzureBlobStorage), - "AzureWorkloadIdentity" => Ok(Self::AzureWorkloadIdentity), - "S3AwsOidc" => Ok(Self::S3AwsOidc), - "GoogleCloudStorage" => Ok(Self::GoogleCloudStorage), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for LargeFileStorageSecondaryStorageValueType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for LargeFileStorageSecondaryStorageValueType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for LargeFileStorageSecondaryStorageValueType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum LargeFileStorageType { - S3Storage, - AzureBlobStorage, - AzureWorkloadIdentity, - S3AwsOidc, - GoogleCloudStorage, - } - impl From<&LargeFileStorageType> for LargeFileStorageType { - fn from(value: &LargeFileStorageType) -> Self { - value.clone() - } - } - impl ToString for LargeFileStorageType { - fn to_string(&self) -> String { - match *self { - Self::S3Storage => "S3Storage".to_string(), - Self::AzureBlobStorage => "AzureBlobStorage".to_string(), - Self::AzureWorkloadIdentity => "AzureWorkloadIdentity".to_string(), - Self::S3AwsOidc => "S3AwsOidc".to_string(), - Self::GoogleCloudStorage => "GoogleCloudStorage".to_string(), - } - } - } - impl std::str::FromStr for LargeFileStorageType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "S3Storage" => Ok(Self::S3Storage), - "AzureBlobStorage" => Ok(Self::AzureBlobStorage), - "AzureWorkloadIdentity" => Ok(Self::AzureWorkloadIdentity), - "S3AwsOidc" => Ok(Self::S3AwsOidc), - "GoogleCloudStorage" => Ok(Self::GoogleCloudStorage), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for LargeFileStorageType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for LargeFileStorageType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for LargeFileStorageType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableApp { - pub edited_at: chrono::DateTime, - pub execution_mode: ListableAppExecutionMode, - pub extra_perms: std::collections::HashMap, - pub id: i64, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_app: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub starred: Option, - pub summary: String, - pub version: i64, - pub workspace_id: String, - } - impl From<&ListableApp> for ListableApp { - fn from(value: &ListableApp) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ListableAppExecutionMode { - #[serde(rename = "viewer")] - Viewer, - #[serde(rename = "publisher")] - Publisher, - #[serde(rename = "anonymous")] - Anonymous, - } - impl From<&ListableAppExecutionMode> for ListableAppExecutionMode { - fn from(value: &ListableAppExecutionMode) -> Self { - value.clone() - } - } - impl ToString for ListableAppExecutionMode { - fn to_string(&self) -> String { - match *self { - Self::Viewer => "viewer".to_string(), - Self::Publisher => "publisher".to_string(), - Self::Anonymous => "anonymous".to_string(), - } - } - } - impl std::str::FromStr for ListableAppExecutionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "viewer" => Ok(Self::Viewer), - "publisher" => Ok(Self::Publisher), - "anonymous" => Ok(Self::Anonymous), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ListableAppExecutionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ListableAppExecutionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ListableAppExecutionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableRawApp { - pub edited_at: chrono::DateTime, - pub extra_perms: std::collections::HashMap, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub starred: Option, - pub summary: String, - pub version: f64, - pub workspace_id: String, - } - impl From<&ListableRawApp> for ListableRawApp { - fn from(value: &ListableRawApp) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub account: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_expired: Option, - pub is_linked: bool, - pub is_oauth: bool, - pub is_refreshed: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_error: Option, - pub resource_type: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&ListableResource> for ListableResource { - fn from(value: &ListableResource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ListableVariable { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub account: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires_at: Option>, - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_expired: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_linked: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_oauth: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_refreshed: Option, - pub is_secret: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - pub workspace_id: String, - } - impl From<&ListableVariable> for ListableVariable { - fn from(value: &ListableVariable) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct LogSearchHit { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dancer: Option, - } - impl From<&LogSearchHit> for LogSearchHit { - fn from(value: &LogSearchHit) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Login { - pub email: String, - pub password: String, - } - impl From<&Login> for Login { - fn from(value: &Login) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MainArgSignature { - pub args: Vec, - pub error: String, - pub has_preprocessor: Option, - pub no_main_func: Option, - pub star_args: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub star_kwargs: Option, - #[serde(rename = "type")] - pub type_: MainArgSignatureType, - } - impl From<&MainArgSignature> for MainArgSignature { - fn from(value: &MainArgSignature) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MainArgSignatureArgsItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_default: Option, - pub name: String, - pub typ: MainArgSignatureArgsItemTyp, - } - impl From<&MainArgSignatureArgsItem> for MainArgSignatureArgsItem { - fn from(value: &MainArgSignatureArgsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum MainArgSignatureArgsItemTyp { - #[serde(rename = "float")] - Float, - #[serde(rename = "int")] - Int, - #[serde(rename = "bool")] - Bool, - #[serde(rename = "email")] - Email, - #[serde(rename = "unknown")] - Unknown, - #[serde(rename = "bytes")] - Bytes, - #[serde(rename = "dict")] - Dict, - #[serde(rename = "datetime")] - Datetime, - #[serde(rename = "sql")] - Sql, - #[serde(rename = "resource")] - Resource(Option), - #[serde(rename = "str")] - Str(Option>), - #[serde(rename = "object")] - Object { - #[serde(default, skip_serializing_if = "Option::is_none")] - name: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - props: Vec, - }, - #[serde(rename = "list")] - List(MainArgSignatureArgsItemTypList), - } - impl From<&MainArgSignatureArgsItemTyp> for MainArgSignatureArgsItemTyp { - fn from(value: &MainArgSignatureArgsItemTyp) -> Self { - value.clone() - } - } - impl From> for MainArgSignatureArgsItemTyp { - fn from(value: Option) -> Self { - Self::Resource(value) - } - } - impl From>> for MainArgSignatureArgsItemTyp { - fn from(value: Option>) -> Self { - Self::Str(value) - } - } - impl From for MainArgSignatureArgsItemTyp { - fn from(value: MainArgSignatureArgsItemTypList) -> Self { - Self::List(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum MainArgSignatureArgsItemTypList { - #[serde(rename = "float")] - Float, - #[serde(rename = "int")] - Int, - #[serde(rename = "bool")] - Bool, - #[serde(rename = "email")] - Email, - #[serde(rename = "unknown")] - Unknown, - #[serde(rename = "bytes")] - Bytes, - #[serde(rename = "dict")] - Dict, - #[serde(rename = "datetime")] - Datetime, - #[serde(rename = "sql")] - Sql, - #[serde(rename = "str")] - Str(serde_json::Value), - } - impl From<&MainArgSignatureArgsItemTypList> for MainArgSignatureArgsItemTypList { - fn from(value: &MainArgSignatureArgsItemTypList) -> Self { - value.clone() - } - } - impl From for MainArgSignatureArgsItemTypList { - fn from(value: serde_json::Value) -> Self { - Self::Str(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MainArgSignatureArgsItemTypObjectPropsItem { - pub key: String, - pub typ: MainArgSignatureArgsItemTypObjectPropsItemTyp, - } - impl From<&MainArgSignatureArgsItemTypObjectPropsItem> - for MainArgSignatureArgsItemTypObjectPropsItem { - fn from(value: &MainArgSignatureArgsItemTypObjectPropsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum MainArgSignatureArgsItemTypObjectPropsItemTyp { - #[serde(rename = "float")] - Float, - #[serde(rename = "int")] - Int, - #[serde(rename = "bool")] - Bool, - #[serde(rename = "email")] - Email, - #[serde(rename = "unknown")] - Unknown, - #[serde(rename = "bytes")] - Bytes, - #[serde(rename = "dict")] - Dict, - #[serde(rename = "datetime")] - Datetime, - #[serde(rename = "sql")] - Sql, - #[serde(rename = "str")] - Str(serde_json::Value), - } - impl From<&MainArgSignatureArgsItemTypObjectPropsItemTyp> - for MainArgSignatureArgsItemTypObjectPropsItemTyp { - fn from(value: &MainArgSignatureArgsItemTypObjectPropsItemTyp) -> Self { - value.clone() - } - } - impl From for MainArgSignatureArgsItemTypObjectPropsItemTyp { - fn from(value: serde_json::Value) -> Self { - Self::Str(value) - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MainArgSignatureType { - Valid, - Invalid, - } - impl From<&MainArgSignatureType> for MainArgSignatureType { - fn from(value: &MainArgSignatureType) -> Self { - value.clone() - } - } - impl ToString for MainArgSignatureType { - fn to_string(&self) -> String { - match *self { - Self::Valid => "Valid".to_string(), - Self::Invalid => "Invalid".to_string(), - } - } - } - impl std::str::FromStr for MainArgSignatureType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "Valid" => Ok(Self::Valid), - "Invalid" => Ok(Self::Invalid), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MainArgSignatureType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MainArgSignatureType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MainArgSignatureType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MetricDataPoint { - pub timestamp: chrono::DateTime, - pub value: f64, - } - impl From<&MetricDataPoint> for MetricDataPoint { - fn from(value: &MetricDataPoint) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MetricMetadata { - pub id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - } - impl From<&MetricMetadata> for MetricMetadata { - fn from(value: &MetricMetadata) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MqttClientVersion { - #[serde(rename = "v3")] - V3, - #[serde(rename = "v5")] - V5, - } - impl From<&MqttClientVersion> for MqttClientVersion { - fn from(value: &MqttClientVersion) -> Self { - value.clone() - } - } - impl ToString for MqttClientVersion { - fn to_string(&self) -> String { - match *self { - Self::V3 => "v3".to_string(), - Self::V5 => "v5".to_string(), - } - } - } - impl std::str::FromStr for MqttClientVersion { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "v3" => Ok(Self::V3), - "v5" => Ok(Self::V5), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MqttClientVersion { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MqttClientVersion { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MqttClientVersion { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum MqttQoS { - #[serde(rename = "qos0")] - Qos0, - #[serde(rename = "qos1")] - Qos1, - #[serde(rename = "qos2")] - Qos2, - } - impl From<&MqttQoS> for MqttQoS { - fn from(value: &MqttQoS) -> Self { - value.clone() - } - } - impl ToString for MqttQoS { - fn to_string(&self) -> String { - match *self { - Self::Qos0 => "qos0".to_string(), - Self::Qos1 => "qos1".to_string(), - Self::Qos2 => "qos2".to_string(), - } - } - } - impl std::str::FromStr for MqttQoS { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "qos0" => Ok(Self::Qos0), - "qos1" => Ok(Self::Qos1), - "qos2" => Ok(Self::Qos2), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for MqttQoS { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for MqttQoS { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for MqttQoS { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttSubscribeTopic { - pub qos: MqttQoS, - pub topic: String, - } - impl From<&MqttSubscribeTopic> for MqttSubscribeTopic { - fn from(value: &MqttSubscribeTopic) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_version: Option, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - pub mqtt_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub subscribe_topics: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v3_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v5_config: Option, - } - impl From<&MqttTrigger> for MqttTrigger { - fn from(value: &MqttTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttV3Config { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub clean_session: Option, - } - impl From<&MqttV3Config> for MqttV3Config { - fn from(value: &MqttV3Config) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct MqttV5Config { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub clean_start: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub session_expiry_interval: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub topic_alias_maximum: Option, - } - impl From<&MqttV5Config> for MqttV5Config { - fn from(value: &MqttV5Config) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NatsTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub consumer_name: Option, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - pub nats_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stream_name: Option, - pub subjects: Vec, - pub use_jetstream: bool, - } - impl From<&NatsTrigger> for NatsTrigger { - fn from(value: &NatsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewEmailTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub local_part: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_local_part: Option, - } - impl From<&NewEmailTrigger> for NewEmailTrigger { - fn from(value: &NewEmailTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewHttpTrigger { - pub authentication_method: AuthenticationMethod, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub authentication_resource_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub http_method: HttpMethod, - pub is_async: bool, - pub is_flow: bool, - pub is_static_website: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_string: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub route_path: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub static_asset_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspaced_route: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub wrap_body: Option, - } - impl From<&NewHttpTrigger> for NewHttpTrigger { - fn from(value: &NewHttpTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewHttpTriggerStaticAssetConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&NewHttpTriggerStaticAssetConfig> for NewHttpTriggerStaticAssetConfig { - fn from(value: &NewHttpTriggerStaticAssetConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewKafkaTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub group_id: String, - pub is_flow: bool, - pub kafka_resource_path: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - pub topics: Vec, - } - impl From<&NewKafkaTrigger> for NewKafkaTrigger { - fn from(value: &NewKafkaTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewMqttTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub client_version: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub mqtt_resource_path: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - pub subscribe_topics: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v3_config: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub v5_config: Option, - } - impl From<&NewMqttTrigger> for NewMqttTrigger { - fn from(value: &NewMqttTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewNatsTrigger { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub consumer_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub nats_resource_path: String, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub stream_name: Option, - pub subjects: Vec, - pub use_jetstream: bool, - } - impl From<&NewNatsTrigger> for NewNatsTrigger { - fn from(value: &NewNatsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewPostgresTrigger { - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - pub path: String, - pub postgres_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub publication: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub publication_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub replication_slot_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - } - impl From<&NewPostgresTrigger> for NewPostgresTrigger { - fn from(value: &NewPostgresTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewSchedule { - pub args: ScriptArgs, - ///The version of the cron schedule to use (last is v2) - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - ///The description of the schedule - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - ///Whether the schedule is enabled - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - ///Whether the schedule is for a flow - pub is_flow: bool, - ///Whether the schedule should not run if a flow is already running - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_flow_overlap: Option, - ///The path to the script or flow to trigger on failure - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure: Option, - ///Whether the schedule should only run on the exact time - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_exact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_times: Option, - ///The path to the script or flow to trigger on recovery - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_times: Option, - ///The path to the script or flow to trigger on success - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success_extra_args: Option, - ///The path where the schedule will be created - pub path: String, - ///The date and time the schedule will be paused until - #[serde(default, skip_serializing_if = "Option::is_none")] - pub paused_until: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - ///The cron schedule to trigger the script or flow. Should include seconds. - pub schedule: String, - ///The path to the script or flow to trigger - pub script_path: String, - ///The summary of the schedule - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - ///The tag of the schedule - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - ///The timezone to use for the cron schedule - pub timezone: String, - ///Whether the WebSocket error handler is muted - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&NewSchedule> for NewSchedule { - fn from(value: &NewSchedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewScript { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub assets: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub codebase: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - pub content: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delete_after_use: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_message: Option, - pub description: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub envs: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_preprocessor: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_template: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - pub language: ScriptLang, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_main_func: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_hash: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restart_unless_cancelled: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - pub summary: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&NewScript> for NewScript { - fn from(value: &NewScript) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewScriptAssetsItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub access_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub alt_access_type: Option, - pub kind: AssetKind, - pub path: String, - } - impl From<&NewScriptAssetsItem> for NewScriptAssetsItem { - fn from(value: &NewScriptAssetsItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum NewScriptAssetsItemAccessType { - #[serde(rename = "r")] - R, - #[serde(rename = "w")] - W, - #[serde(rename = "rw")] - Rw, - } - impl From<&NewScriptAssetsItemAccessType> for NewScriptAssetsItemAccessType { - fn from(value: &NewScriptAssetsItemAccessType) -> Self { - value.clone() - } - } - impl ToString for NewScriptAssetsItemAccessType { - fn to_string(&self) -> String { - match *self { - Self::R => "r".to_string(), - Self::W => "w".to_string(), - Self::Rw => "rw".to_string(), - } - } - } - impl std::str::FromStr for NewScriptAssetsItemAccessType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "r" => Ok(Self::R), - "w" => Ok(Self::W), - "rw" => Ok(Self::Rw), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for NewScriptAssetsItemAccessType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for NewScriptAssetsItemAccessType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for NewScriptAssetsItemAccessType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum NewScriptAssetsItemAltAccessType { - #[serde(rename = "r")] - R, - #[serde(rename = "w")] - W, - #[serde(rename = "rw")] - Rw, - } - impl From<&NewScriptAssetsItemAltAccessType> for NewScriptAssetsItemAltAccessType { - fn from(value: &NewScriptAssetsItemAltAccessType) -> Self { - value.clone() - } - } - impl ToString for NewScriptAssetsItemAltAccessType { - fn to_string(&self) -> String { - match *self { - Self::R => "r".to_string(), - Self::W => "w".to_string(), - Self::Rw => "rw".to_string(), - } - } - } - impl std::str::FromStr for NewScriptAssetsItemAltAccessType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "r" => Ok(Self::R), - "w" => Ok(Self::W), - "rw" => Ok(Self::Rw), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for NewScriptAssetsItemAltAccessType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for NewScriptAssetsItemAltAccessType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for NewScriptAssetsItemAltAccessType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum NewScriptKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "failure")] - Failure, - #[serde(rename = "trigger")] - Trigger, - #[serde(rename = "command")] - Command, - #[serde(rename = "approval")] - Approval, - #[serde(rename = "preprocessor")] - Preprocessor, - } - impl From<&NewScriptKind> for NewScriptKind { - fn from(value: &NewScriptKind) -> Self { - value.clone() - } - } - impl ToString for NewScriptKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Failure => "failure".to_string(), - Self::Trigger => "trigger".to_string(), - Self::Command => "command".to_string(), - Self::Approval => "approval".to_string(), - Self::Preprocessor => "preprocessor".to_string(), - } - } - } - impl std::str::FromStr for NewScriptKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "failure" => Ok(Self::Failure), - "trigger" => Ok(Self::Trigger), - "command" => Ok(Self::Command), - "approval" => Ok(Self::Approval), - "preprocessor" => Ok(Self::Preprocessor), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for NewScriptKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for NewScriptKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for NewScriptKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewScriptWithDraft { - #[serde(flatten)] - pub new_script: NewScript, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft: Option, - pub hash: String, - } - impl From<&NewScriptWithDraft> for NewScriptWithDraft { - fn from(value: &NewScriptWithDraft) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewSqsTrigger { - pub aws_auth_resource_type: AwsAuthResourceType, - pub aws_resource_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub message_attributes: Vec, - pub path: String, - pub queue_url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - } - impl From<&NewSqsTrigger> for NewSqsTrigger { - fn from(value: &NewSqsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewToken { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expiration: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub label: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scopes: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&NewToken> for NewToken { - fn from(value: &NewToken) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewTokenImpersonate { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expiration: Option>, - pub impersonate_email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub label: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&NewTokenImpersonate> for NewTokenImpersonate { - fn from(value: &NewTokenImpersonate) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewWebsocketTrigger { - pub can_return_message: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub enabled: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub filters: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub initial_messages: Vec, - pub is_flow: bool, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub script_path: String, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&NewWebsocketTrigger> for NewWebsocketTrigger { - fn from(value: &NewWebsocketTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct NewWebsocketTriggerFiltersItem { - pub key: String, - pub value: serde_json::Value, - } - impl From<&NewWebsocketTriggerFiltersItem> for NewWebsocketTriggerFiltersItem { - fn from(value: &NewWebsocketTriggerFiltersItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ObscuredJob { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub typ: Option, - } - impl From<&ObscuredJob> for ObscuredJob { - fn from(value: &ObscuredJob) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenFlow { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - pub summary: String, - pub value: FlowValue, - } - impl From<&OpenFlow> for OpenFlow { - fn from(value: &OpenFlow) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenFlowWPath { - #[serde(flatten)] - pub open_flow: OpenFlow, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&OpenFlowWPath> for OpenFlowWPath { - fn from(value: &OpenFlowWPath) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenapiHttpRouteFilters { - pub folder_regex: String, - pub path_regex: String, - pub route_path_regex: String, - } - impl From<&OpenapiHttpRouteFilters> for OpenapiHttpRouteFilters { - fn from(value: &OpenapiHttpRouteFilters) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum OpenapiSpecFormat { - #[serde(rename = "yaml")] - Yaml, - #[serde(rename = "json")] - Json, - } - impl From<&OpenapiSpecFormat> for OpenapiSpecFormat { - fn from(value: &OpenapiSpecFormat) -> Self { - value.clone() - } - } - impl ToString for OpenapiSpecFormat { - fn to_string(&self) -> String { - match *self { - Self::Yaml => "yaml".to_string(), - Self::Json => "json".to_string(), - } - } - } - impl std::str::FromStr for OpenapiSpecFormat { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "yaml" => Ok(Self::Yaml), - "json" => Ok(Self::Json), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for OpenapiSpecFormat { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for OpenapiSpecFormat { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for OpenapiSpecFormat { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenapiV3Info { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub contact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub license: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub terms_of_service: Option, - pub title: String, - pub version: String, - } - impl From<&OpenapiV3Info> for OpenapiV3Info { - fn from(value: &OpenapiV3Info) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenapiV3InfoContact { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - } - impl From<&OpenapiV3InfoContact> for OpenapiV3InfoContact { - fn from(value: &OpenapiV3InfoContact) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OpenapiV3InfoLicense { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub identifier: Option, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - } - impl From<&OpenapiV3InfoLicense> for OpenapiV3InfoLicense { - fn from(value: &OpenapiV3InfoLicense) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OperatorSettings(pub Option); - impl std::ops::Deref for OperatorSettings { - type Target = Option; - fn deref(&self) -> &Option { - &self.0 - } - } - impl From for Option { - fn from(value: OperatorSettings) -> Self { - value.0 - } - } - impl From<&OperatorSettings> for OperatorSettings { - fn from(value: &OperatorSettings) -> Self { - value.clone() - } - } - impl From> for OperatorSettings { - fn from(value: Option) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct OperatorSettingsInner { - ///Whether operators can view assets - pub assets: bool, - ///Whether operators can view audit logs - pub audit_logs: bool, - ///Whether operators can view folders page - pub folders: bool, - ///Whether operators can view groups page - pub groups: bool, - ///Whether operators can view resources - pub resources: bool, - ///Whether operators can view runs - pub runs: bool, - ///Whether operators can view schedules - pub schedules: bool, - ///Whether operators can view triggers - pub triggers: bool, - ///Whether operators can view variables - pub variables: bool, - ///Whether operators can view workers page - pub workers: bool, - } - impl From<&OperatorSettingsInner> for OperatorSettingsInner { - fn from(value: &OperatorSettingsInner) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PathFlow { - pub input_transforms: std::collections::HashMap, - pub path: String, - #[serde(rename = "type")] - pub type_: PathFlowType, - } - impl From<&PathFlow> for PathFlow { - fn from(value: &PathFlow) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PathFlowType { - #[serde(rename = "flow")] - Flow, - } - impl From<&PathFlowType> for PathFlowType { - fn from(value: &PathFlowType) -> Self { - value.clone() - } - } - impl ToString for PathFlowType { - fn to_string(&self) -> String { - match *self { - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for PathFlowType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PathFlowType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PathFlowType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PathFlowType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PathScript { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub hash: Option, - pub input_transforms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_trigger: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag_override: Option, - #[serde(rename = "type")] - pub type_: PathScriptType, - } - impl From<&PathScript> for PathScript { - fn from(value: &PathScript) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PathScriptType { - #[serde(rename = "script")] - Script, - } - impl From<&PathScriptType> for PathScriptType { - fn from(value: &PathScriptType) -> Self { - value.clone() - } - } - impl ToString for PathScriptType { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - } - } - } - impl std::str::FromStr for PathScriptType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PathScriptType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PathScriptType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PathScriptType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolarsClientKwargs { - pub region_name: String, - } - impl From<&PolarsClientKwargs> for PolarsClientKwargs { - fn from(value: &PolarsClientKwargs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Policy { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub allowed_s3_keys: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub execution_mode: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub s3_inputs: Vec>, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub triggerables: std::collections::HashMap< - String, - std::collections::HashMap, - >, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub triggerables_v2: std::collections::HashMap< - String, - std::collections::HashMap, - >, - } - impl From<&Policy> for Policy { - fn from(value: &Policy) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PolicyAllowedS3KeysItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub resource: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub s3_path: Option, - } - impl From<&PolicyAllowedS3KeysItem> for PolicyAllowedS3KeysItem { - fn from(value: &PolicyAllowedS3KeysItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PolicyExecutionMode { - #[serde(rename = "viewer")] - Viewer, - #[serde(rename = "publisher")] - Publisher, - #[serde(rename = "anonymous")] - Anonymous, - } - impl From<&PolicyExecutionMode> for PolicyExecutionMode { - fn from(value: &PolicyExecutionMode) -> Self { - value.clone() - } - } - impl ToString for PolicyExecutionMode { - fn to_string(&self) -> String { - match *self { - Self::Viewer => "viewer".to_string(), - Self::Publisher => "publisher".to_string(), - Self::Anonymous => "anonymous".to_string(), - } - } - } - impl std::str::FromStr for PolicyExecutionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "viewer" => Ok(Self::Viewer), - "publisher" => Ok(Self::Publisher), - "anonymous" => Ok(Self::Anonymous), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PolicyExecutionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PolicyExecutionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PolicyExecutionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PostgresTrigger { - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - pub postgres_resource_path: String, - pub publication_name: String, - pub replication_slot_name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - } - impl From<&PostgresTrigger> for PostgresTrigger { - fn from(value: &PostgresTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Preview { - pub args: ScriptArgs, - ///The code to run - #[serde(default, skip_serializing_if = "Option::is_none")] - pub content: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub language: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - ///The path to the script - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - ///The hash of the script - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_hash: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - } - impl From<&Preview> for Preview { - fn from(value: &Preview) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum PreviewKind { - #[serde(rename = "code")] - Code, - #[serde(rename = "identity")] - Identity, - #[serde(rename = "http")] - Http, - } - impl From<&PreviewKind> for PreviewKind { - fn from(value: &PreviewKind) -> Self { - value.clone() - } - } - impl ToString for PreviewKind { - fn to_string(&self) -> String { - match *self { - Self::Code => "code".to_string(), - Self::Identity => "identity".to_string(), - Self::Http => "http".to_string(), - } - } - } - impl std::str::FromStr for PreviewKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "code" => Ok(Self::Code), - "identity" => Ok(Self::Identity), - "http" => Ok(Self::Http), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for PreviewKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for PreviewKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for PreviewKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PublicationData { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub table_to_track: Vec, - pub transaction_to_track: Vec, - } - impl From<&PublicationData> for PublicationData { - fn from(value: &PublicationData) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct PushConfig { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub audience: Option, - pub authenticate: bool, - } - impl From<&PushConfig> for PushConfig { - fn from(value: &PushConfig) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct QueuedJob { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub aggregate_wait_time_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - pub canceled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canceled_reason: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - pub email: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_status: Option, - pub id: uuid::Uuid, - pub is_flow_step: bool, - pub job_kind: QueuedJobJobKind, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub language: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub logs: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mem_peak: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_job: Option, - /**The user (u/userfoo) or group (g/groupfoo) whom -the execution of this script will be permissioned_as and by extension its DT_TOKEN. -*/ - pub permissioned_as: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub preprocessed: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_code: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub raw_flow: Option, - pub running: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scheduled_for: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_hash: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub script_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub self_wait_time_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub suspend: Option, - pub tag: String, - pub visible_to_owner: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workflow_as_code_status: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&QueuedJob> for QueuedJob { - fn from(value: &QueuedJob) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum QueuedJobJobKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "preview")] - Preview, - #[serde(rename = "dependencies")] - Dependencies, - #[serde(rename = "flowdependencies")] - Flowdependencies, - #[serde(rename = "appdependencies")] - Appdependencies, - #[serde(rename = "flow")] - Flow, - #[serde(rename = "flowpreview")] - Flowpreview, - #[serde(rename = "script_hub")] - ScriptHub, - #[serde(rename = "identity")] - Identity, - #[serde(rename = "deploymentcallback")] - Deploymentcallback, - #[serde(rename = "singlescriptflow")] - Singlescriptflow, - #[serde(rename = "flowscript")] - Flowscript, - #[serde(rename = "flownode")] - Flownode, - #[serde(rename = "appscript")] - Appscript, - #[serde(rename = "aiagent")] - Aiagent, - } - impl From<&QueuedJobJobKind> for QueuedJobJobKind { - fn from(value: &QueuedJobJobKind) -> Self { - value.clone() - } - } - impl ToString for QueuedJobJobKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Preview => "preview".to_string(), - Self::Dependencies => "dependencies".to_string(), - Self::Flowdependencies => "flowdependencies".to_string(), - Self::Appdependencies => "appdependencies".to_string(), - Self::Flow => "flow".to_string(), - Self::Flowpreview => "flowpreview".to_string(), - Self::ScriptHub => "script_hub".to_string(), - Self::Identity => "identity".to_string(), - Self::Deploymentcallback => "deploymentcallback".to_string(), - Self::Singlescriptflow => "singlescriptflow".to_string(), - Self::Flowscript => "flowscript".to_string(), - Self::Flownode => "flownode".to_string(), - Self::Appscript => "appscript".to_string(), - Self::Aiagent => "aiagent".to_string(), - } - } - } - impl std::str::FromStr for QueuedJobJobKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "preview" => Ok(Self::Preview), - "dependencies" => Ok(Self::Dependencies), - "flowdependencies" => Ok(Self::Flowdependencies), - "appdependencies" => Ok(Self::Appdependencies), - "flow" => Ok(Self::Flow), - "flowpreview" => Ok(Self::Flowpreview), - "script_hub" => Ok(Self::ScriptHub), - "identity" => Ok(Self::Identity), - "deploymentcallback" => Ok(Self::Deploymentcallback), - "singlescriptflow" => Ok(Self::Singlescriptflow), - "flowscript" => Ok(Self::Flowscript), - "flownode" => Ok(Self::Flownode), - "appscript" => Ok(Self::Appscript), - "aiagent" => Ok(Self::Aiagent), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for QueuedJobJobKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for QueuedJobJobKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for QueuedJobJobKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RawScript { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub assets: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - pub content: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub custom_concurrency_key: Option, - pub input_transforms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_trigger: Option, - pub language: RawScriptLanguage, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(rename = "type")] - pub type_: RawScriptType, - } - impl From<&RawScript> for RawScript { - fn from(value: &RawScript) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RawScriptAssetsItem { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub access_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub alt_access_type: Option, - pub kind: RawScriptAssetsItemKind, - pub path: String, - } - impl From<&RawScriptAssetsItem> for RawScriptAssetsItem { - fn from(value: &RawScriptAssetsItem) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptAssetsItemAccessType { - #[serde(rename = "r")] - R, - #[serde(rename = "w")] - W, - #[serde(rename = "rw")] - Rw, - } - impl From<&RawScriptAssetsItemAccessType> for RawScriptAssetsItemAccessType { - fn from(value: &RawScriptAssetsItemAccessType) -> Self { - value.clone() - } - } - impl ToString for RawScriptAssetsItemAccessType { - fn to_string(&self) -> String { - match *self { - Self::R => "r".to_string(), - Self::W => "w".to_string(), - Self::Rw => "rw".to_string(), - } - } - } - impl std::str::FromStr for RawScriptAssetsItemAccessType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "r" => Ok(Self::R), - "w" => Ok(Self::W), - "rw" => Ok(Self::Rw), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptAssetsItemAccessType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptAssetsItemAccessType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptAssetsItemAccessType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptAssetsItemAltAccessType { - #[serde(rename = "r")] - R, - #[serde(rename = "w")] - W, - #[serde(rename = "rw")] - Rw, - } - impl From<&RawScriptAssetsItemAltAccessType> for RawScriptAssetsItemAltAccessType { - fn from(value: &RawScriptAssetsItemAltAccessType) -> Self { - value.clone() - } - } - impl ToString for RawScriptAssetsItemAltAccessType { - fn to_string(&self) -> String { - match *self { - Self::R => "r".to_string(), - Self::W => "w".to_string(), - Self::Rw => "rw".to_string(), - } - } - } - impl std::str::FromStr for RawScriptAssetsItemAltAccessType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "r" => Ok(Self::R), - "w" => Ok(Self::W), - "rw" => Ok(Self::Rw), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptAssetsItemAltAccessType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptAssetsItemAltAccessType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptAssetsItemAltAccessType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptAssetsItemKind { - #[serde(rename = "s3object")] - S3object, - #[serde(rename = "resource")] - Resource, - #[serde(rename = "ducklake")] - Ducklake, - } - impl From<&RawScriptAssetsItemKind> for RawScriptAssetsItemKind { - fn from(value: &RawScriptAssetsItemKind) -> Self { - value.clone() - } - } - impl ToString for RawScriptAssetsItemKind { - fn to_string(&self) -> String { - match *self { - Self::S3object => "s3object".to_string(), - Self::Resource => "resource".to_string(), - Self::Ducklake => "ducklake".to_string(), - } - } - } - impl std::str::FromStr for RawScriptAssetsItemKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "s3object" => Ok(Self::S3object), - "resource" => Ok(Self::Resource), - "ducklake" => Ok(Self::Ducklake), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptAssetsItemKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptAssetsItemKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptAssetsItemKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RawScriptForDependencies { - pub language: ScriptLang, - pub path: String, - pub raw_code: String, - } - impl From<&RawScriptForDependencies> for RawScriptForDependencies { - fn from(value: &RawScriptForDependencies) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptLanguage { - #[serde(rename = "deno")] - Deno, - #[serde(rename = "bun")] - Bun, - #[serde(rename = "python3")] - Python3, - #[serde(rename = "go")] - Go, - #[serde(rename = "bash")] - Bash, - #[serde(rename = "powershell")] - Powershell, - #[serde(rename = "postgresql")] - Postgresql, - #[serde(rename = "mysql")] - Mysql, - #[serde(rename = "bigquery")] - Bigquery, - #[serde(rename = "snowflake")] - Snowflake, - #[serde(rename = "mssql")] - Mssql, - #[serde(rename = "oracledb")] - Oracledb, - #[serde(rename = "graphql")] - Graphql, - #[serde(rename = "nativets")] - Nativets, - #[serde(rename = "php")] - Php, - } - impl From<&RawScriptLanguage> for RawScriptLanguage { - fn from(value: &RawScriptLanguage) -> Self { - value.clone() - } - } - impl ToString for RawScriptLanguage { - fn to_string(&self) -> String { - match *self { - Self::Deno => "deno".to_string(), - Self::Bun => "bun".to_string(), - Self::Python3 => "python3".to_string(), - Self::Go => "go".to_string(), - Self::Bash => "bash".to_string(), - Self::Powershell => "powershell".to_string(), - Self::Postgresql => "postgresql".to_string(), - Self::Mysql => "mysql".to_string(), - Self::Bigquery => "bigquery".to_string(), - Self::Snowflake => "snowflake".to_string(), - Self::Mssql => "mssql".to_string(), - Self::Oracledb => "oracledb".to_string(), - Self::Graphql => "graphql".to_string(), - Self::Nativets => "nativets".to_string(), - Self::Php => "php".to_string(), - } - } - } - impl std::str::FromStr for RawScriptLanguage { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "deno" => Ok(Self::Deno), - "bun" => Ok(Self::Bun), - "python3" => Ok(Self::Python3), - "go" => Ok(Self::Go), - "bash" => Ok(Self::Bash), - "powershell" => Ok(Self::Powershell), - "postgresql" => Ok(Self::Postgresql), - "mysql" => Ok(Self::Mysql), - "bigquery" => Ok(Self::Bigquery), - "snowflake" => Ok(Self::Snowflake), - "mssql" => Ok(Self::Mssql), - "oracledb" => Ok(Self::Oracledb), - "graphql" => Ok(Self::Graphql), - "nativets" => Ok(Self::Nativets), - "php" => Ok(Self::Php), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptLanguage { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptLanguage { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptLanguage { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RawScriptType { - #[serde(rename = "rawscript")] - Rawscript, - } - impl From<&RawScriptType> for RawScriptType { - fn from(value: &RawScriptType) -> Self { - value.clone() - } - } - impl ToString for RawScriptType { - fn to_string(&self) -> String { - match *self { - Self::Rawscript => "rawscript".to_string(), - } - } - } - impl std::str::FromStr for RawScriptType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "rawscript" => Ok(Self::Rawscript), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RawScriptType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RawScriptType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RawScriptType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Relations { - pub schema_name: String, - pub table_to_track: TableToTrack, - } - impl From<&Relations> for Relations { - fn from(value: &Relations) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Resource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub extra_perms: std::collections::HashMap, - pub is_oauth: bool, - pub path: String, - pub resource_type: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub value: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&Resource> for Resource { - fn from(value: &Resource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ResourceType { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub edited_at: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub format_extension: Option, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schema: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - } - impl From<&ResourceType> for ResourceType { - fn from(value: &ResourceType) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RestartedFrom { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub branch_or_iteration_n: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub flow_job_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub step_id: Option, - } - impl From<&RestartedFrom> for RestartedFrom { - fn from(value: &RestartedFrom) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Retry { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub constant: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub exponential: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry_if: Option, - } - impl From<&Retry> for Retry { - fn from(value: &Retry) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RetryConstant { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub attempts: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub seconds: Option, - } - impl From<&RetryConstant> for RetryConstant { - fn from(value: &RetryConstant) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RetryExponential { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub attempts: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub multiplier: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub random_factor: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub seconds: Option, - } - impl From<&RetryExponential> for RetryExponential { - fn from(value: &RetryExponential) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct RetryRetryIf { - pub expr: String, - } - impl From<&RetryRetryIf> for RetryRetryIf { - fn from(value: &RetryRetryIf) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RunnableKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "flow")] - Flow, - } - impl From<&RunnableKind> for RunnableKind { - fn from(value: &RunnableKind) -> Self { - value.clone() - } - } - impl ToString for RunnableKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Flow => "flow".to_string(), - } - } - } - impl std::str::FromStr for RunnableKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "flow" => Ok(Self::Flow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RunnableKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RunnableKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RunnableKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum RunnableType { - ScriptHash, - ScriptPath, - FlowPath, - } - impl From<&RunnableType> for RunnableType { - fn from(value: &RunnableType) -> Self { - value.clone() - } - } - impl ToString for RunnableType { - fn to_string(&self) -> String { - match *self { - Self::ScriptHash => "ScriptHash".to_string(), - Self::ScriptPath => "ScriptPath".to_string(), - Self::FlowPath => "FlowPath".to_string(), - } - } - } - impl std::str::FromStr for RunnableType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "ScriptHash" => Ok(Self::ScriptHash), - "ScriptPath" => Ok(Self::ScriptPath), - "FlowPath" => Ok(Self::FlowPath), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for RunnableType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for RunnableType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for RunnableType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct S3Object { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub filename: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub presigned: Option, - pub s3: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub storage: Option, - } - impl From<&S3Object> for S3Object { - fn from(value: &S3Object) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct S3Resource { - #[serde(rename = "accessKey", default, skip_serializing_if = "Option::is_none")] - pub access_key: Option, - pub bucket: String, - #[serde(rename = "endPoint")] - pub end_point: String, - #[serde(rename = "pathStyle")] - pub path_style: bool, - pub region: String, - #[serde(rename = "secretKey", default, skip_serializing_if = "Option::is_none")] - pub secret_key: Option, - #[serde(rename = "useSSL")] - pub use_ssl: bool, - } - impl From<&S3Resource> for S3Resource { - fn from(value: &S3Resource) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScalarMetric { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub metric_id: Option, - pub value: f64, - } - impl From<&ScalarMetric> for ScalarMetric { - fn from(value: &ScalarMetric) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Schedule { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cron_version: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - pub edited_at: chrono::DateTime, - pub edited_by: String, - pub email: String, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - pub extra_perms: std::collections::HashMap, - pub is_flow: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub no_flow_overlap: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_exact: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_failure_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_extra_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_recovery_times: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_success_extra_args: Option, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub paused_until: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - pub schedule: String, - pub script_path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub summary: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - pub timezone: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&Schedule> for Schedule { - fn from(value: &Schedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScheduleWJobs { - #[serde(flatten)] - pub schedule: Schedule, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub jobs: Vec, - } - impl From<&ScheduleWJobs> for ScheduleWJobs { - fn from(value: &ScheduleWJobs) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScheduleWJobsJobsItem { - pub duration_ms: f64, - pub id: String, - pub success: bool, - } - impl From<&ScheduleWJobsJobsItem> for ScheduleWJobsJobsItem { - fn from(value: &ScheduleWJobsJobsItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScopeDefinition { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - pub label: String, - pub requires_resource_path: bool, - pub value: String, - } - impl From<&ScopeDefinition> for ScopeDefinition { - fn from(value: &ScopeDefinition) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScopeDomain { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - pub name: String, - pub scopes: Vec, - } - impl From<&ScopeDomain> for ScopeDomain { - fn from(value: &ScopeDomain) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Script { - pub archived: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub cache_ttl: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub codebase: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_key: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrency_time_window_s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub concurrent_limit: Option, - pub content: String, - pub created_at: chrono::DateTime, - pub created_by: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub dedicated_worker: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delete_after_use: Option, - pub deleted: bool, - pub description: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub draft_only: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub envs: Vec, - pub extra_perms: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub has_draft: Option, - pub has_preprocessor: bool, - pub hash: String, - pub is_template: bool, - pub kind: ScriptKind, - pub language: ScriptLang, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub lock_error_logs: Option, - pub no_main_func: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub on_behalf_of_email: Option, - /**The first element is the direct parent of the script, the second is the parent of the first, etc -*/ - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub parent_hashes: Vec, - pub path: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub restart_unless_cancelled: Option, - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub schema: std::collections::HashMap, - pub starred: bool, - pub summary: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tag: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub visible_to_runner_only: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ws_error_handler_muted: Option, - } - impl From<&Script> for Script { - fn from(value: &Script) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScriptArgs(pub std::collections::HashMap); - impl std::ops::Deref for ScriptArgs { - type Target = std::collections::HashMap; - fn deref(&self) -> &std::collections::HashMap { - &self.0 - } - } - impl From for std::collections::HashMap { - fn from(value: ScriptArgs) -> Self { - value.0 - } - } - impl From<&ScriptArgs> for ScriptArgs { - fn from(value: &ScriptArgs) -> Self { - value.clone() - } - } - impl From> for ScriptArgs { - fn from(value: std::collections::HashMap) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct ScriptHistory { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub deployment_msg: Option, - pub script_hash: String, - } - impl From<&ScriptHistory> for ScriptHistory { - fn from(value: &ScriptHistory) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ScriptKind { - #[serde(rename = "script")] - Script, - #[serde(rename = "failure")] - Failure, - #[serde(rename = "trigger")] - Trigger, - #[serde(rename = "command")] - Command, - #[serde(rename = "approval")] - Approval, - #[serde(rename = "preprocessor")] - Preprocessor, - } - impl From<&ScriptKind> for ScriptKind { - fn from(value: &ScriptKind) -> Self { - value.clone() - } - } - impl ToString for ScriptKind { - fn to_string(&self) -> String { - match *self { - Self::Script => "script".to_string(), - Self::Failure => "failure".to_string(), - Self::Trigger => "trigger".to_string(), - Self::Command => "command".to_string(), - Self::Approval => "approval".to_string(), - Self::Preprocessor => "preprocessor".to_string(), - } - } - } - impl std::str::FromStr for ScriptKind { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "script" => Ok(Self::Script), - "failure" => Ok(Self::Failure), - "trigger" => Ok(Self::Trigger), - "command" => Ok(Self::Command), - "approval" => Ok(Self::Approval), - "preprocessor" => Ok(Self::Preprocessor), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ScriptKind { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ScriptKind { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ScriptKind { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum ScriptLang { - #[serde(rename = "python3")] - Python3, - #[serde(rename = "deno")] - Deno, - #[serde(rename = "go")] - Go, - #[serde(rename = "bash")] - Bash, - #[serde(rename = "powershell")] - Powershell, - #[serde(rename = "postgresql")] - Postgresql, - #[serde(rename = "mysql")] - Mysql, - #[serde(rename = "bigquery")] - Bigquery, - #[serde(rename = "snowflake")] - Snowflake, - #[serde(rename = "mssql")] - Mssql, - #[serde(rename = "oracledb")] - Oracledb, - #[serde(rename = "graphql")] - Graphql, - #[serde(rename = "nativets")] - Nativets, - #[serde(rename = "bun")] - Bun, - #[serde(rename = "php")] - Php, - #[serde(rename = "rust")] - Rust, - #[serde(rename = "ansible")] - Ansible, - #[serde(rename = "csharp")] - Csharp, - #[serde(rename = "nu")] - Nu, - #[serde(rename = "java")] - Java, - #[serde(rename = "ruby")] - Ruby, - #[serde(rename = "duckdb")] - Duckdb, - } - impl From<&ScriptLang> for ScriptLang { - fn from(value: &ScriptLang) -> Self { - value.clone() - } - } - impl ToString for ScriptLang { - fn to_string(&self) -> String { - match *self { - Self::Python3 => "python3".to_string(), - Self::Deno => "deno".to_string(), - Self::Go => "go".to_string(), - Self::Bash => "bash".to_string(), - Self::Powershell => "powershell".to_string(), - Self::Postgresql => "postgresql".to_string(), - Self::Mysql => "mysql".to_string(), - Self::Bigquery => "bigquery".to_string(), - Self::Snowflake => "snowflake".to_string(), - Self::Mssql => "mssql".to_string(), - Self::Oracledb => "oracledb".to_string(), - Self::Graphql => "graphql".to_string(), - Self::Nativets => "nativets".to_string(), - Self::Bun => "bun".to_string(), - Self::Php => "php".to_string(), - Self::Rust => "rust".to_string(), - Self::Ansible => "ansible".to_string(), - Self::Csharp => "csharp".to_string(), - Self::Nu => "nu".to_string(), - Self::Java => "java".to_string(), - Self::Ruby => "ruby".to_string(), - Self::Duckdb => "duckdb".to_string(), - } - } - } - impl std::str::FromStr for ScriptLang { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "python3" => Ok(Self::Python3), - "deno" => Ok(Self::Deno), - "go" => Ok(Self::Go), - "bash" => Ok(Self::Bash), - "powershell" => Ok(Self::Powershell), - "postgresql" => Ok(Self::Postgresql), - "mysql" => Ok(Self::Mysql), - "bigquery" => Ok(Self::Bigquery), - "snowflake" => Ok(Self::Snowflake), - "mssql" => Ok(Self::Mssql), - "oracledb" => Ok(Self::Oracledb), - "graphql" => Ok(Self::Graphql), - "nativets" => Ok(Self::Nativets), - "bun" => Ok(Self::Bun), - "php" => Ok(Self::Php), - "rust" => Ok(Self::Rust), - "ansible" => Ok(Self::Ansible), - "csharp" => Ok(Self::Csharp), - "nu" => Ok(Self::Nu), - "java" => Ok(Self::Java), - "ruby" => Ok(Self::Ruby), - "duckdb" => Ok(Self::Duckdb), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for ScriptLang { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for ScriptLang { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for ScriptLang { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SlackToken { - pub access_token: String, - pub bot: SlackTokenBot, - pub team_id: String, - pub team_name: String, - } - impl From<&SlackToken> for SlackToken { - fn from(value: &SlackToken) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SlackTokenBot { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub bot_access_token: Option, - } - impl From<&SlackTokenBot> for SlackTokenBot { - fn from(value: &SlackTokenBot) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Slot { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - } - impl From<&Slot> for Slot { - fn from(value: &Slot) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SlotList { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub active: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub slot_name: Option, - } - impl From<&SlotList> for SlotList { - fn from(value: &SlotList) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct SqsTrigger { - pub aws_auth_resource_type: AwsAuthResourceType, - pub aws_resource_path: String, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub message_attributes: Vec, - pub queue_url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - } - impl From<&SqsTrigger> for SqsTrigger { - fn from(value: &SqsTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct StaticTransform { - #[serde(rename = "type")] - pub type_: StaticTransformType, - pub value: serde_json::Value, - } - impl From<&StaticTransform> for StaticTransform { - fn from(value: &StaticTransform) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum StaticTransformType { - #[serde(rename = "static")] - Static, - } - impl From<&StaticTransformType> for StaticTransformType { - fn from(value: &StaticTransformType) -> Self { - value.clone() - } - } - impl ToString for StaticTransformType { - fn to_string(&self) -> String { - match *self { - Self::Static => "static".to_string(), - } - } - } - impl std::str::FromStr for StaticTransformType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "static" => Ok(Self::Static), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for StaticTransformType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for StaticTransformType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for StaticTransformType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct StopAfterIf { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_message: Option, - pub expr: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub skip_if_stopped: Option, - } - impl From<&StopAfterIf> for StopAfterIf { - fn from(value: &StopAfterIf) -> Self { - value.clone() - } - } - ///The mode of subscription. 'existing' means using an existing GCP subscription, while 'create_update' involves creating or updating a new subscription. - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum SubscriptionMode { - #[serde(rename = "existing")] - Existing, - #[serde(rename = "create_update")] - CreateUpdate, - } - impl From<&SubscriptionMode> for SubscriptionMode { - fn from(value: &SubscriptionMode) -> Self { - value.clone() - } - } - impl ToString for SubscriptionMode { - fn to_string(&self) -> String { - match *self { - Self::Existing => "existing".to_string(), - Self::CreateUpdate => "create_update".to_string(), - } - } - } - impl std::str::FromStr for SubscriptionMode { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "existing" => Ok(Self::Existing), - "create_update" => Ok(Self::CreateUpdate), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for SubscriptionMode { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for SubscriptionMode { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for SubscriptionMode { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TableToTrack(pub Vec); - impl std::ops::Deref for TableToTrack { - type Target = Vec; - fn deref(&self) -> &Vec { - &self.0 - } - } - impl From for Vec { - fn from(value: TableToTrack) -> Self { - value.0 - } - } - impl From<&TableToTrack> for TableToTrack { - fn from(value: &TableToTrack) -> Self { - value.clone() - } - } - impl From> for TableToTrack { - fn from(value: Vec) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TableToTrackItem { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub columns_name: Vec, - pub table_name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub where_clause: Option, - } - impl From<&TableToTrackItem> for TableToTrackItem { - fn from(value: &TableToTrackItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TeamInfo { - ///List of channels within the team - pub channels: Vec, - ///The unique identifier of the Microsoft Teams team - pub team_id: String, - ///The display name of the Microsoft Teams team - pub team_name: String, - } - impl From<&TeamInfo> for TeamInfo { - fn from(value: &TeamInfo) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TeamsChannel { - ///Microsoft Teams channel ID - pub channel_id: TeamsChannelChannelId, - ///Microsoft Teams channel name - pub channel_name: TeamsChannelChannelName, - ///Microsoft Teams team ID - pub team_id: TeamsChannelTeamId, - ///Microsoft Teams team name - pub team_name: TeamsChannelTeamName, - } - impl From<&TeamsChannel> for TeamsChannel { - fn from(value: &TeamsChannel) -> Self { - value.clone() - } - } - ///Microsoft Teams channel ID - #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] - pub struct TeamsChannelChannelId(String); - impl std::ops::Deref for TeamsChannelChannelId { - type Target = String; - fn deref(&self) -> &String { - &self.0 - } - } - impl From for String { - fn from(value: TeamsChannelChannelId) -> Self { - value.0 - } - } - impl From<&TeamsChannelChannelId> for TeamsChannelChannelId { - fn from(value: &TeamsChannelChannelId) -> Self { - value.clone() - } - } - impl std::str::FromStr for TeamsChannelChannelId { - type Err = &'static str; - fn from_str(value: &str) -> Result { - if value.len() < 1usize { - return Err("shorter than 1 characters"); - } - Ok(Self(value.to_string())) - } - } - impl std::convert::TryFrom<&str> for TeamsChannelChannelId { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for TeamsChannelChannelId { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for TeamsChannelChannelId { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - impl<'de> serde::Deserialize<'de> for TeamsChannelChannelId { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - String::deserialize(deserializer)? - .parse() - .map_err(|e: &'static str| { - ::custom(e.to_string()) - }) - } - } - ///Microsoft Teams channel name - #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] - pub struct TeamsChannelChannelName(String); - impl std::ops::Deref for TeamsChannelChannelName { - type Target = String; - fn deref(&self) -> &String { - &self.0 - } - } - impl From for String { - fn from(value: TeamsChannelChannelName) -> Self { - value.0 - } - } - impl From<&TeamsChannelChannelName> for TeamsChannelChannelName { - fn from(value: &TeamsChannelChannelName) -> Self { - value.clone() - } - } - impl std::str::FromStr for TeamsChannelChannelName { - type Err = &'static str; - fn from_str(value: &str) -> Result { - if value.len() < 1usize { - return Err("shorter than 1 characters"); - } - Ok(Self(value.to_string())) - } - } - impl std::convert::TryFrom<&str> for TeamsChannelChannelName { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for TeamsChannelChannelName { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for TeamsChannelChannelName { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - impl<'de> serde::Deserialize<'de> for TeamsChannelChannelName { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - String::deserialize(deserializer)? - .parse() - .map_err(|e: &'static str| { - ::custom(e.to_string()) - }) - } - } - ///Microsoft Teams team ID - #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] - pub struct TeamsChannelTeamId(String); - impl std::ops::Deref for TeamsChannelTeamId { - type Target = String; - fn deref(&self) -> &String { - &self.0 - } - } - impl From for String { - fn from(value: TeamsChannelTeamId) -> Self { - value.0 - } - } - impl From<&TeamsChannelTeamId> for TeamsChannelTeamId { - fn from(value: &TeamsChannelTeamId) -> Self { - value.clone() - } - } - impl std::str::FromStr for TeamsChannelTeamId { - type Err = &'static str; - fn from_str(value: &str) -> Result { - if value.len() < 1usize { - return Err("shorter than 1 characters"); - } - Ok(Self(value.to_string())) - } - } - impl std::convert::TryFrom<&str> for TeamsChannelTeamId { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for TeamsChannelTeamId { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for TeamsChannelTeamId { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - impl<'de> serde::Deserialize<'de> for TeamsChannelTeamId { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - String::deserialize(deserializer)? - .parse() - .map_err(|e: &'static str| { - ::custom(e.to_string()) - }) - } - } - ///Microsoft Teams team name - #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] - pub struct TeamsChannelTeamName(String); - impl std::ops::Deref for TeamsChannelTeamName { - type Target = String; - fn deref(&self) -> &String { - &self.0 - } - } - impl From for String { - fn from(value: TeamsChannelTeamName) -> Self { - value.0 - } - } - impl From<&TeamsChannelTeamName> for TeamsChannelTeamName { - fn from(value: &TeamsChannelTeamName) -> Self { - value.clone() - } - } - impl std::str::FromStr for TeamsChannelTeamName { - type Err = &'static str; - fn from_str(value: &str) -> Result { - if value.len() < 1usize { - return Err("shorter than 1 characters"); - } - Ok(Self(value.to_string())) - } - } - impl std::convert::TryFrom<&str> for TeamsChannelTeamName { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for TeamsChannelTeamName { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for TeamsChannelTeamName { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - impl<'de> serde::Deserialize<'de> for TeamsChannelTeamName { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - String::deserialize(deserializer)? - .parse() - .map_err(|e: &'static str| { - ::custom(e.to_string()) - }) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TemplateScript { - pub language: Language, - pub postgres_resource_path: String, - pub relations: Vec, - } - impl From<&TemplateScript> for TemplateScript { - fn from(value: &TemplateScript) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TimeseriesMetric { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub metric_id: Option, - pub values: Vec, - } - impl From<&TimeseriesMetric> for TimeseriesMetric { - fn from(value: &TimeseriesMetric) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TokenResponse { - pub access_token: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires_in: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub grant_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub refresh_token: Option, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scope: Vec, - } - impl From<&TokenResponse> for TokenResponse { - fn from(value: &TokenResponse) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TriggerExtraProperty { - pub edited_at: chrono::DateTime, - pub edited_by: String, - pub email: String, - pub extra_perms: std::collections::HashMap, - pub is_flow: bool, - pub path: String, - pub script_path: String, - pub workspace_id: String, - } - impl From<&TriggerExtraProperty> for TriggerExtraProperty { - fn from(value: &TriggerExtraProperty) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TriggersCount { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub default_email_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub gcp_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub http_routes_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kafka_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mqtt_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub nats_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub postgres_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub primary_schedule: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub sqs_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub webhook_count: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub websocket_count: Option, - } - impl From<&TriggersCount> for TriggersCount { - fn from(value: &TriggersCount) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TriggersCountPrimarySchedule { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub schedule: Option, - } - impl From<&TriggersCountPrimarySchedule> for TriggersCountPrimarySchedule { - fn from(value: &TriggersCountPrimarySchedule) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct TruncatedToken { - pub created_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expiration: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub label: Option, - pub last_used_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub scopes: Vec, - pub token_prefix: String, - } - impl From<&TruncatedToken> for TruncatedToken { - fn from(value: &TruncatedToken) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UpdateInput { - pub id: String, - pub is_public: bool, - pub name: String, - } - impl From<&UpdateInput> for UpdateInput { - fn from(value: &UpdateInput) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UploadFilePart { - pub part_number: i64, - pub tag: String, - } - impl From<&UploadFilePart> for UploadFilePart { - fn from(value: &UploadFilePart) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct User { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub added_via: Option, - pub created_at: chrono::DateTime, - pub disabled: bool, - pub email: String, - pub folders: Vec, - pub folders_owners: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub groups: Vec, - pub is_admin: bool, - pub is_super_admin: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - pub operator: bool, - pub username: String, - } - impl From<&User> for User { - fn from(value: &User) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserSource { - ///The domain used for auto-invite (when source is 'domain') - #[serde(default, skip_serializing_if = "Option::is_none")] - pub domain: Option, - ///The instance group name (when source is 'instance_group') - #[serde(default, skip_serializing_if = "Option::is_none")] - pub group: Option, - ///How the user was added to the workspace - pub source: UserSourceSource, - } - impl From<&UserSource> for UserSource { - fn from(value: &UserSource) -> Self { - value.clone() - } - } - ///How the user was added to the workspace - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum UserSourceSource { - #[serde(rename = "domain")] - Domain, - #[serde(rename = "instance_group")] - InstanceGroup, - #[serde(rename = "manual")] - Manual, - } - impl From<&UserSourceSource> for UserSourceSource { - fn from(value: &UserSourceSource) -> Self { - value.clone() - } - } - impl ToString for UserSourceSource { - fn to_string(&self) -> String { - match *self { - Self::Domain => "domain".to_string(), - Self::InstanceGroup => "instance_group".to_string(), - Self::Manual => "manual".to_string(), - } - } - } - impl std::str::FromStr for UserSourceSource { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "domain" => Ok(Self::Domain), - "instance_group" => Ok(Self::InstanceGroup), - "manual" => Ok(Self::Manual), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for UserSourceSource { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for UserSourceSource { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for UserSourceSource { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserUsage { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub email: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub executions: Option, - } - impl From<&UserUsage> for UserUsage { - fn from(value: &UserUsage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserWorkspaceList { - pub email: String, - pub workspaces: Vec, - } - impl From<&UserWorkspaceList> for UserWorkspaceList { - fn from(value: &UserWorkspaceList) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct UserWorkspaceListWorkspacesItem { - pub color: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub created_by: Option, - pub id: String, - pub name: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub operator_settings: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_workspace_id: Option, - pub username: String, - } - impl From<&UserWorkspaceListWorkspacesItem> for UserWorkspaceListWorkspacesItem { - fn from(value: &UserWorkspaceListWorkspacesItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WebhookFilters { - pub path: String, - pub runnable_kind: RunnableKind, - pub user_or_folder_regex: WebhookFiltersUserOrFolderRegex, - pub user_or_folder_regex_value: String, - } - impl From<&WebhookFilters> for WebhookFilters { - fn from(value: &WebhookFilters) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WebhookFiltersUserOrFolderRegex { - #[serde(rename = "*")] - X, - #[serde(rename = "u")] - U, - #[serde(rename = "f")] - F, - } - impl From<&WebhookFiltersUserOrFolderRegex> for WebhookFiltersUserOrFolderRegex { - fn from(value: &WebhookFiltersUserOrFolderRegex) -> Self { - value.clone() - } - } - impl ToString for WebhookFiltersUserOrFolderRegex { - fn to_string(&self) -> String { - match *self { - Self::X => "*".to_string(), - Self::U => "u".to_string(), - Self::F => "f".to_string(), - } - } - } - impl std::str::FromStr for WebhookFiltersUserOrFolderRegex { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "*" => Ok(Self::X), - "u" => Ok(Self::U), - "f" => Ok(Self::F), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WebhookFiltersUserOrFolderRegex { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WebhookFiltersUserOrFolderRegex { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WebhookFiltersUserOrFolderRegex { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WebsocketTrigger { - pub can_return_message: bool, - pub enabled: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_args: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub error_handler_path: Option, - pub filters: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub initial_messages: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_server_ping: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub retry: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub server_id: Option, - pub url: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url_runnable_args: Option, - } - impl From<&WebsocketTrigger> for WebsocketTrigger { - fn from(value: &WebsocketTrigger) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WebsocketTriggerFiltersItem { - pub key: String, - pub value: serde_json::Value, - } - impl From<&WebsocketTriggerFiltersItem> for WebsocketTriggerFiltersItem { - fn from(value: &WebsocketTriggerFiltersItem) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub enum WebsocketTriggerInitialMessage { - #[serde(rename = "raw_message")] - RawMessage(String), - #[serde(rename = "runnable_result")] - RunnableResult { args: ScriptArgs, is_flow: bool, path: String }, - } - impl From<&WebsocketTriggerInitialMessage> for WebsocketTriggerInitialMessage { - fn from(value: &WebsocketTriggerInitialMessage) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WhileloopFlow { - pub modules: Vec, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallel: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parallelism: Option, - pub skip_failures: bool, - #[serde(rename = "type")] - pub type_: WhileloopFlowType, - } - impl From<&WhileloopFlow> for WhileloopFlow { - fn from(value: &WhileloopFlow) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WhileloopFlowType { - #[serde(rename = "whileloopflow")] - Whileloopflow, - } - impl From<&WhileloopFlowType> for WhileloopFlowType { - fn from(value: &WhileloopFlowType) -> Self { - value.clone() - } - } - impl ToString for WhileloopFlowType { - fn to_string(&self) -> String { - match *self { - Self::Whileloopflow => "whileloopflow".to_string(), - } - } - } - impl std::str::FromStr for WhileloopFlowType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "whileloopflow" => Ok(Self::Whileloopflow), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WhileloopFlowType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WhileloopFlowType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WhileloopFlowType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WindmillFileMetadata { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub expires: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_modified: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub size_in_bytes: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub version_id: Option, - } - impl From<&WindmillFileMetadata> for WindmillFileMetadata { - fn from(value: &WindmillFileMetadata) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WindmillFilePreview { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub content: Option, - pub content_type: WindmillFilePreviewContentType, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub msg: Option, - } - impl From<&WindmillFilePreview> for WindmillFilePreview { - fn from(value: &WindmillFilePreview) -> Self { - value.clone() - } - } - #[derive( - Clone, - Copy, - Debug, - Deserialize, - Eq, - Hash, - Ord, - PartialEq, - PartialOrd, - Serialize - )] - pub enum WindmillFilePreviewContentType { - RawText, - Csv, - Parquet, - Unknown, - } - impl From<&WindmillFilePreviewContentType> for WindmillFilePreviewContentType { - fn from(value: &WindmillFilePreviewContentType) -> Self { - value.clone() - } - } - impl ToString for WindmillFilePreviewContentType { - fn to_string(&self) -> String { - match *self { - Self::RawText => "RawText".to_string(), - Self::Csv => "Csv".to_string(), - Self::Parquet => "Parquet".to_string(), - Self::Unknown => "Unknown".to_string(), - } - } - } - impl std::str::FromStr for WindmillFilePreviewContentType { - type Err = &'static str; - fn from_str(value: &str) -> Result { - match value { - "RawText" => Ok(Self::RawText), - "Csv" => Ok(Self::Csv), - "Parquet" => Ok(Self::Parquet), - "Unknown" => Ok(Self::Unknown), - _ => Err("invalid value"), - } - } - } - impl std::convert::TryFrom<&str> for WindmillFilePreviewContentType { - type Error = &'static str; - fn try_from(value: &str) -> Result { - value.parse() - } - } - impl std::convert::TryFrom<&String> for WindmillFilePreviewContentType { - type Error = &'static str; - fn try_from(value: &String) -> Result { - value.parse() - } - } - impl std::convert::TryFrom for WindmillFilePreviewContentType { - type Error = &'static str; - fn try_from(value: String) -> Result { - value.parse() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WindmillLargeFile { - pub s3: String, - } - impl From<&WindmillLargeFile> for WindmillLargeFile { - fn from(value: &WindmillLargeFile) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkerPing { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub custom_tags: Vec, - pub ip: String, - pub jobs_executed: i64, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_job_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_job_workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub last_ping: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub memory: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub memory_usage: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate_15s: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate_30m: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub occupancy_rate_5m: Option, - pub started_at: chrono::DateTime, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub vcpus: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub wm_memory_usage: Option, - pub wm_version: String, - pub worker: String, - pub worker_group: String, - pub worker_instance: String, - } - impl From<&WorkerPing> for WorkerPing { - fn from(value: &WorkerPing) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkflowStatus { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub duration_ms: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub scheduled_for: Option>, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub started_at: Option>, - } - impl From<&WorkflowStatus> for WorkflowStatus { - fn from(value: &WorkflowStatus) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkflowStatusRecord( - pub std::collections::HashMap, - ); - impl std::ops::Deref for WorkflowStatusRecord { - type Target = std::collections::HashMap; - fn deref(&self) -> &std::collections::HashMap { - &self.0 - } - } - impl From - for std::collections::HashMap { - fn from(value: WorkflowStatusRecord) -> Self { - value.0 - } - } - impl From<&WorkflowStatusRecord> for WorkflowStatusRecord { - fn from(value: &WorkflowStatusRecord) -> Self { - value.clone() - } - } - impl From> - for WorkflowStatusRecord { - fn from(value: std::collections::HashMap) -> Self { - Self(value) - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkflowTask { - pub args: ScriptArgs, - } - impl From<&WorkflowTask> for WorkflowTask { - fn from(value: &WorkflowTask) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct Workspace { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub color: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub domain: Option, - pub id: String, - pub name: String, - pub owner: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_workspace_id: Option, - } - impl From<&Workspace> for Workspace { - fn from(value: &Workspace) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceDefaultScripts { - #[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")] - pub default_script_content: std::collections::HashMap, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub hidden: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub order: Vec, - } - impl From<&WorkspaceDefaultScripts> for WorkspaceDefaultScripts { - fn from(value: &WorkspaceDefaultScripts) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceDeployUiSettings { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_path: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub include_type: Vec, - } - impl From<&WorkspaceDeployUiSettings> for WorkspaceDeployUiSettings { - fn from(value: &WorkspaceDeployUiSettings) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceGitSyncSettings { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub repositories: Vec, - } - impl From<&WorkspaceGitSyncSettings> for WorkspaceGitSyncSettings { - fn from(value: &WorkspaceGitSyncSettings) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceGithubInstallation { - pub account_id: String, - pub installation_id: f64, - } - impl From<&WorkspaceGithubInstallation> for WorkspaceGithubInstallation { - fn from(value: &WorkspaceGithubInstallation) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceInfo { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub role: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workspace_name: Option, - } - impl From<&WorkspaceInfo> for WorkspaceInfo { - fn from(value: &WorkspaceInfo) -> Self { - value.clone() - } - } - #[derive(Clone, Debug, Deserialize, Serialize)] - pub struct WorkspaceInvite { - pub email: String, - pub is_admin: bool, - pub operator: bool, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub parent_workspace_id: Option, - pub workspace_id: String, - } - impl From<&WorkspaceInvite> for WorkspaceInvite { - fn from(value: &WorkspaceInvite) -> Self { - value.clone() - } - } -} -#[derive(Clone, Debug)] -/**Client for Windmill API - -Version: 1.543.0*/ -pub struct Client { - pub(crate) baseurl: String, - pub(crate) client: reqwest::Client, -} -impl Client { - /// Create a new client. - /// - /// `baseurl` is the base URL provided to the internal - /// `reqwest::Client`, and should include a scheme and hostname, - /// as well as port and a path stem if applicable. - pub fn new(baseurl: &str) -> Self { - #[cfg(not(target_arch = "wasm32"))] - let client = { - let dur = std::time::Duration::from_secs(15); - reqwest::ClientBuilder::new().connect_timeout(dur).timeout(dur) - }; - #[cfg(target_arch = "wasm32")] - let client = reqwest::ClientBuilder::new(); - Self::new_with_client(baseurl, client.build().unwrap()) - } - /// Construct a new client with an existing `reqwest::Client`, - /// allowing more control over its configuration. - /// - /// `baseurl` is the base URL provided to the internal - /// `reqwest::Client`, and should include a scheme and hostname, - /// as well as port and a path stem if applicable. - pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self { - Self { - baseurl: baseurl.to_string(), - client, - } - } - /// Get the base URL to which requests are made. - pub fn baseurl(&self) -> &String { - &self.baseurl - } - /// Get the internal `reqwest::Client` used to make requests. - pub fn client(&self) -> &reqwest::Client { - &self.client - } - /// Get the version of this API. - /// - /// This string is pulled directly from the source OpenAPI - /// document and may be in any format the API selects. - pub fn api_version(&self) -> &'static str { - "1.543.0" - } -} -impl Client { - /**list all workspaces visible to me - -Sends a `GET` request to `/workspaces/list` - -*/ - pub async fn list_workspaces<'a>( - &'a self, - ) -> Result>, Error<()>> { - let url = format!("{}/workspaces/list", self.baseurl,); - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create script - -Sends a `POST` request to `/w/{workspace}/scripts/create` - -Arguments: -- `workspace` -- `body`: Partially filled script -*/ - pub async fn create_script<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewScript, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/scripts/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**get flow by path - -Sends a `GET` request to `/w/{workspace}/flows/get/{path}` - -*/ - pub async fn get_flow_by_path<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - with_starred_info: Option, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/get/{}", self.baseurl, encode_path(& workspace.to_string()), - encode_path(& path.to_string()), - ); - let mut query = Vec::with_capacity(1usize); - if let Some(v) = &with_starred_info { - query.push(("with_starred_info", v.to_string())); - } - let request = self - .client - .get(url) - .header( - reqwest::header::ACCEPT, - reqwest::header::HeaderValue::from_static("application/json"), - ) - .query(&query) - .build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => ResponseValue::from_response(response).await, - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create flow - -Sends a `POST` request to `/w/{workspace}/flows/create` - -Arguments: -- `workspace` -- `body`: Partially filled flow -*/ - pub async fn create_flow<'a>( - &'a self, - workspace: &'a str, - body: &'a types::CreateFlowBody, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/flows/create", self.baseurl, encode_path(& workspace.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**create schedule - -Sends a `POST` request to `/w/{workspace}/schedules/create` - -Arguments: -- `workspace` -- `body`: new schedule -*/ - pub async fn create_schedule<'a>( - &'a self, - workspace: &'a str, - body: &'a types::NewSchedule, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/create", self.baseurl, encode_path(& workspace - .to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 201u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } - /**update schedule - -Sends a `POST` request to `/w/{workspace}/schedules/update/{path}` - -Arguments: -- `workspace` -- `path` -- `body`: updated schedule -*/ - pub async fn update_schedule<'a>( - &'a self, - workspace: &'a str, - path: &'a str, - body: &'a types::EditSchedule, - ) -> Result, Error<()>> { - let url = format!( - "{}/w/{}/schedules/update/{}", self.baseurl, encode_path(& workspace - .to_string()), encode_path(& path.to_string()), - ); - let request = self.client.post(url).json(&body).build()?; - let result = self.client.execute(request).await; - let response = result?; - match response.status().as_u16() { - 200u16 => Ok(ResponseValue::stream(response)), - _ => Err(Error::UnexpectedResponse(response)), - } - } -} -pub mod prelude { - pub use super::Client; -} diff --git a/backend/windmill-api-client/src/lib.rs b/backend/windmill-api-client/src/lib.rs index 3b879e0d98..4e37958b7e 100644 --- a/backend/windmill-api-client/src/lib.rs +++ b/backend/windmill-api-client/src/lib.rs @@ -1,14 +1,753 @@ -include!("./codegen.rs"); +//! Minimal Windmill API client for tests +//! +//! This is a handwritten minimal client that provides just enough functionality +//! for the integration tests. It replaces the auto-generated progenitor client. +use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +/// Client for Windmill API +#[derive(Clone)] +pub struct Client { + pub baseurl: String, + pub client: reqwest::Client, +} + +impl Client { + /// Create a new client with an existing reqwest::Client + pub fn new_with_client(baseurl: &str, client: reqwest::Client) -> Self { + Self { + baseurl: baseurl.to_string(), + client, + } + } + + /// Get the base URL + pub fn baseurl(&self) -> &String { + &self.baseurl + } + + /// Get the internal reqwest::Client + pub fn client(&self) -> &reqwest::Client { + &self.client + } + + /// Create a script + pub async fn create_script( + &self, + workspace: &str, + body: &types::NewScript, + ) -> Result { + let url = format!( + "{}/w/{}/scripts/create", + self.baseurl, + urlencoding::encode(workspace) + ); + let response = self.client.post(&url).json(body).send().await?; + + if response.status().is_success() { + Ok(response.text().await?) + } else { + Err(Error::UnexpectedResponse(response.status().as_u16(), response.text().await.unwrap_or_default())) + } + } + + /// Create a flow + pub async fn create_flow( + &self, + workspace: &str, + body: &types::CreateFlowBody, + ) -> Result { + let url = format!( + "{}/w/{}/flows/create", + self.baseurl, + urlencoding::encode(workspace) + ); + let response = self.client.post(&url).json(body).send().await?; + + if response.status().is_success() { + Ok(response.text().await?) + } else { + Err(Error::UnexpectedResponse(response.status().as_u16(), response.text().await.unwrap_or_default())) + } + } + + /// Get flow by path + pub async fn get_flow_by_path( + &self, + workspace: &str, + path: &str, + with_starred_info: Option, + ) -> Result { + let url = format!( + "{}/w/{}/flows/get/{}", + self.baseurl, + urlencoding::encode(workspace), + urlencoding::encode(path) + ); + + let mut request = self.client.get(&url); + if let Some(starred) = with_starred_info { + request = request.query(&[("with_starred_info", starred.to_string())]); + } + + let response = request.send().await?; + + if response.status().is_success() { + Ok(response.json().await?) + } else { + Err(Error::UnexpectedResponse(response.status().as_u16(), response.text().await.unwrap_or_default())) + } + } + + /// Create a schedule + pub async fn create_schedule( + &self, + workspace: &str, + body: &types::NewSchedule, + ) -> Result { + let url = format!( + "{}/w/{}/schedules/create", + self.baseurl, + urlencoding::encode(workspace) + ); + let response = self.client.post(&url).json(body).send().await?; + + if response.status().is_success() { + Ok(response.text().await?) + } else { + Err(Error::UnexpectedResponse(response.status().as_u16(), response.text().await.unwrap_or_default())) + } + } + + /// Update a schedule + pub async fn update_schedule( + &self, + workspace: &str, + path: &str, + body: &types::EditSchedule, + ) -> Result { + let url = format!( + "{}/w/{}/schedules/update/{}", + self.baseurl, + urlencoding::encode(workspace), + urlencoding::encode(path) + ); + let response = self.client.post(&url).json(body).send().await?; + + if response.status().is_success() { + Ok(response.text().await?) + } else { + Err(Error::UnexpectedResponse(response.status().as_u16(), response.text().await.unwrap_or_default())) + } + } + + /// List workspaces + pub async fn list_workspaces(&self) -> Result, Error> { + let url = format!("{}/workspaces/list", self.baseurl); + let response = self.client.get(&url).send().await?; + + if response.status().is_success() { + Ok(response.json().await?) + } else { + Err(Error::UnexpectedResponse(response.status().as_u16(), response.text().await.unwrap_or_default())) + } + } +} + +/// Create a client with bearer token authentication pub fn create_client(base_url: &str, token: String) -> Client { - let mut val = reqwest::header::HeaderValue::from_str(&format!("Bearer {token}")) - .expect("header creation"); + let mut val = HeaderValue::from_str(&format!("Bearer {token}")).expect("header creation"); val.set_sensitive(true); - let mut headers = reqwest::header::HeaderMap::new(); - headers.insert(reqwest::header::AUTHORIZATION, val); + let mut headers = HeaderMap::new(); + headers.insert(AUTHORIZATION, val); let client = reqwest::ClientBuilder::new() .default_headers(headers) .build() .expect("client build"); Client::new_with_client(&format!("{}/api", base_url.trim_end_matches('/')), client) } + +/// Error type for API client +#[derive(Debug)] +pub enum Error { + /// Request error + Request(reqwest::Error), + /// Unexpected response status + UnexpectedResponse(u16, String), +} + +impl From for Error { + fn from(err: reqwest::Error) -> Self { + Error::Request(err) + } +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Error::Request(e) => write!(f, "Request error: {}", e), + Error::UnexpectedResponse(status, body) => { + write!(f, "Unexpected response ({}): {}", status, body) + } + } + } +} + +impl std::error::Error for Error {} + +/// API types +pub mod types { + use super::*; + + /// Script language + #[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] + pub enum ScriptLang { + #[serde(rename = "python3")] + Python3, + #[serde(rename = "deno")] + Deno, + #[serde(rename = "go")] + Go, + #[serde(rename = "bash")] + Bash, + #[serde(rename = "powershell")] + Powershell, + #[serde(rename = "postgresql")] + Postgresql, + #[serde(rename = "mysql")] + Mysql, + #[serde(rename = "bigquery")] + Bigquery, + #[serde(rename = "snowflake")] + Snowflake, + #[serde(rename = "mssql")] + Mssql, + #[serde(rename = "oracledb")] + Oracledb, + #[serde(rename = "graphql")] + Graphql, + #[serde(rename = "nativets")] + Nativets, + #[serde(rename = "bun")] + Bun, + #[serde(rename = "php")] + Php, + #[serde(rename = "rust")] + Rust, + #[serde(rename = "ansible")] + Ansible, + #[serde(rename = "csharp")] + Csharp, + #[serde(rename = "nu")] + Nu, + #[serde(rename = "java")] + Java, + #[serde(rename = "ruby")] + Ruby, + #[serde(rename = "duckdb")] + Duckdb, + } + + impl std::str::FromStr for ScriptLang { + type Err = &'static str; + fn from_str(value: &str) -> Result { + match value { + "python3" => Ok(Self::Python3), + "deno" => Ok(Self::Deno), + "go" => Ok(Self::Go), + "bash" => Ok(Self::Bash), + "powershell" => Ok(Self::Powershell), + "postgresql" => Ok(Self::Postgresql), + "mysql" => Ok(Self::Mysql), + "bigquery" => Ok(Self::Bigquery), + "snowflake" => Ok(Self::Snowflake), + "mssql" => Ok(Self::Mssql), + "oracledb" => Ok(Self::Oracledb), + "graphql" => Ok(Self::Graphql), + "nativets" => Ok(Self::Nativets), + "bun" => Ok(Self::Bun), + "php" => Ok(Self::Php), + "rust" => Ok(Self::Rust), + "ansible" => Ok(Self::Ansible), + "csharp" => Ok(Self::Csharp), + "nu" => Ok(Self::Nu), + "java" => Ok(Self::Java), + "ruby" => Ok(Self::Ruby), + "duckdb" => Ok(Self::Duckdb), + _ => Err("invalid script language"), + } + } + } + + /// Raw script language (for flow modules) + #[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq, Hash)] + pub enum RawScriptLanguage { + #[serde(rename = "python3")] + Python3, + #[serde(rename = "deno")] + Deno, + #[serde(rename = "go")] + Go, + #[serde(rename = "bash")] + Bash, + #[serde(rename = "powershell")] + Powershell, + #[serde(rename = "postgresql")] + Postgresql, + #[serde(rename = "mysql")] + Mysql, + #[serde(rename = "bigquery")] + Bigquery, + #[serde(rename = "snowflake")] + Snowflake, + #[serde(rename = "mssql")] + Mssql, + #[serde(rename = "oracledb")] + Oracledb, + #[serde(rename = "graphql")] + Graphql, + #[serde(rename = "nativets")] + Nativets, + #[serde(rename = "bun")] + Bun, + #[serde(rename = "php")] + Php, + #[serde(rename = "rust")] + Rust, + #[serde(rename = "ansible")] + Ansible, + #[serde(rename = "csharp")] + Csharp, + #[serde(rename = "nu")] + Nu, + #[serde(rename = "java")] + Java, + #[serde(rename = "ruby")] + Ruby, + #[serde(rename = "duckdb")] + Duckdb, + } + + /// New script request body + #[derive(Clone, Debug, Serialize)] + pub struct NewScript { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub assets: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cache_ttl: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub codebase: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrency_key: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrency_time_window_s: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrent_limit: Option, + pub content: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dedicated_worker: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub delete_after_use: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deployment_message: Option, + pub description: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub draft_only: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub envs: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub has_preprocessor: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub is_template: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + pub language: ScriptLang, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lock: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub no_main_func: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_behalf_of_email: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parent_hash: Option, + pub path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub restart_unless_cancelled: Option, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub schema: HashMap, + pub summary: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visible_to_runner_only: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ws_error_handler_muted: Option, + } + + /// Script arguments (used in schedules) + pub type ScriptArgs = HashMap; + + /// New schedule request body + #[derive(Clone, Debug, Serialize)] + pub struct NewSchedule { + pub args: ScriptArgs, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cron_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + pub is_flow: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub no_flow_overlap: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure_exact: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure_extra_args: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure_times: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_recovery: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_recovery_extra_args: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_recovery_times: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_success: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_success_extra_args: Option, + pub path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retry: Option, + pub schedule: String, + pub script_path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + pub timezone: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ws_error_handler_muted: Option, + } + + /// Edit schedule request body + #[derive(Clone, Debug, Serialize)] + pub struct EditSchedule { + pub args: ScriptArgs, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cron_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub no_flow_overlap: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure_exact: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure_extra_args: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_failure_times: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_recovery: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_recovery_extra_args: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_recovery_times: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_success: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_success_extra_args: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retry: Option, + pub schedule: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + pub timezone: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ws_error_handler_muted: Option, + } + + /// Open flow definition + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct OpenFlow { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub schema: HashMap, + pub summary: String, + pub value: FlowValue, + } + + /// Flow value containing modules + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct FlowValue { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cache_ttl: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrency_key: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrency_time_window_s: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrent_limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub early_return: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub failure_module: Option, + pub modules: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub preprocessor_module: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub same_worker: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub skip_expr: Option, + } + + /// Flow module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct FlowModule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cache_ttl: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub continue_on_error: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub delete_after_use: Option, + pub id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mock: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub retry: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub skip_if: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub sleep: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub stop_after_all_iters_if: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub stop_after_if: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub suspend: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + pub value: FlowModuleValue, + } + + /// Input transform + #[derive(Clone, Debug, Deserialize, Serialize)] + #[serde(untagged)] + pub enum InputTransform { + Static { + #[serde(rename = "type")] + type_: String, + value: serde_json::Value + }, + Javascript { + #[serde(rename = "type")] + type_: String, + expr: String + }, + } + + /// Flow module value (the actual module content) + #[derive(Clone, Debug, Deserialize, Serialize)] + #[serde(untagged)] + pub enum FlowModuleValue { + RawScript(RawScript), + Script(ScriptModule), + Flow(FlowModule2), + ForLoop(ForLoopModule), + WhileLoop(WhileLoopModule), + BranchOne(BranchOneModule), + BranchAll(BranchAllModule), + Identity(IdentityModule), + Other(serde_json::Value), + } + + /// Raw script module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct RawScript { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub assets: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrency_time_window_s: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub concurrent_limit: Option, + pub content: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub custom_concurrency_key: Option, + pub input_transforms: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub is_trigger: Option, + pub language: RawScriptLanguage, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub lock: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(rename = "type")] + pub type_: String, + } + + impl RawScript { + pub fn new(content: String, language: RawScriptLanguage) -> Self { + Self { + assets: vec![], + concurrency_time_window_s: None, + concurrent_limit: None, + content, + custom_concurrency_key: None, + input_transforms: HashMap::new(), + is_trigger: None, + language, + lock: None, + path: None, + tag: None, + type_: "rawscript".to_string(), + } + } + } + + /// Script module reference + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct ScriptModule { + #[serde(rename = "type")] + pub type_: String, + pub path: String, + pub input_transforms: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hash: Option, + } + + /// Flow module reference + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct FlowModule2 { + #[serde(rename = "type")] + pub type_: String, + pub path: String, + pub input_transforms: HashMap, + } + + /// For loop module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct ForLoopModule { + #[serde(rename = "type")] + pub type_: String, + pub iterator: InputTransform, + pub modules: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parallel: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parallelism: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub skip_failures: Option, + } + + /// While loop module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct WhileLoopModule { + #[serde(rename = "type")] + pub type_: String, + pub modules: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub skip_failures: Option, + } + + /// Branch one module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct BranchOneModule { + #[serde(rename = "type")] + pub type_: String, + pub branches: Vec, + pub default: Vec, + } + + /// Branch all module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct BranchAllModule { + #[serde(rename = "type")] + pub type_: String, + pub branches: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub parallel: Option, + } + + /// Identity module + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct IdentityModule { + #[serde(rename = "type")] + pub type_: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub flow: Option, + } + + /// Open flow with path + #[derive(Clone, Debug, Deserialize, Serialize)] + pub struct OpenFlowWPath { + #[serde(flatten)] + pub open_flow: OpenFlow, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dedicated_worker: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub on_behalf_of_email: Option, + pub path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub visible_to_runner_only: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ws_error_handler_muted: Option, + } + + /// Create flow request body + #[derive(Clone, Debug, Serialize)] + pub struct CreateFlowBody { + #[serde(flatten)] + pub open_flow_w_path: OpenFlowWPath, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deployment_message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub draft_only: Option, + } + + /// Flow response type + #[derive(Clone, Debug, Deserialize)] + pub struct Flow { + pub path: String, + #[serde(flatten)] + pub open_flow: OpenFlow, + #[serde(flatten)] + pub extra: HashMap, + } + + /// Workspace + #[derive(Clone, Debug, Deserialize)] + pub struct Workspace { + pub id: String, + pub name: String, + #[serde(default)] + pub owner: Option, + #[serde(flatten)] + pub extra: HashMap, + } +} diff --git a/backend/windmill-api/Cargo.toml b/backend/windmill-api/Cargo.toml index 3e352d8b66..f2647f9481 100644 --- a/backend/windmill-api/Cargo.toml +++ b/backend/windmill-api/Cargo.toml @@ -27,7 +27,7 @@ websocket = ["dep:tokio-tungstenite"] smtp = ["dep:mail-parser", "dep:openssl", "windmill-common/smtp"] license = ["dep:rsa"] zip = ["dep:async_zip"] -oauth2 = ["dep:async-oauth2"] +oauth2 = ["dep:windmill-oauth"] http_trigger = ["dep:matchit", "dep:thiserror", "dep:sha1", "dep:constant_time_eq"] static_frontend = ["dep:rust-embed"] postgres_trigger = ["dep:rust-postgres", "dep:pg_escape", "dep:byteorder", "dep:thiserror", "dep:rust_decimal", "dep:rust-postgres-native-tls"] @@ -36,11 +36,11 @@ sqs_trigger = ["dep:aws-sdk-sqs", "dep:aws-sdk-sts", "dep:aws-sdk-sso", "dep:aws deno_core = ["dep:deno_core", "dep:deno_error"] gcp_trigger = ["dep:thiserror", "dep:google-cloud-pubsub", "dep:google-cloud-googleapis", "dep:tonic"] cloud = ["windmill-common/cloud"] -mcp = ["dep:rmcp"] +mcp = ["dep:windmill-mcp", "windmill-mcp/server"] python = [] [dependencies] -rmcp = { version = "0.12.0", features=["transport-streamable-http-server", "transport-streamable-http-server-session", "transport-worker"], optional = true } +windmill-mcp = { workspace = true, optional = true } windmill-queue.workspace = true windmill-common = { workspace = true, default-features = false } windmill-audit.workspace = true @@ -67,7 +67,7 @@ itertools.workspace = true reqwest.workspace = true serde.workspace = true sqlx.workspace = true -async-oauth2 = { workspace = true, optional = true } +windmill-oauth = { workspace = true, optional = true } tracing.workspace = true sql-builder.workspace = true serde_json.workspace = true diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index c1af44fc48..591bcc5254 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.3" info: - version: 1.602.0 + version: 1.603.0 title: Windmill API contact: @@ -230,6 +230,83 @@ paths: schema: type: string + /auth/is_smtp_configured: + get: + security: [] + summary: check if SMTP is configured for password reset + operationId: isSmtpConfigured + tags: + - user + responses: + "200": + description: returns true if SMTP is configured + content: + application/json: + schema: + type: boolean + + /auth/request_password_reset: + post: + security: [] + summary: request password reset email + operationId: requestPasswordReset + tags: + - user + requestBody: + description: email to send password reset link to + required: true + content: + application/json: + schema: + type: object + required: + - email + properties: + email: + type: string + format: email + responses: + "200": + description: password reset email sent (if user exists) + content: + application/json: + schema: + $ref: "#/components/schemas/PasswordResetResponse" + "400": + description: SMTP not configured + + /auth/reset_password: + post: + security: [] + summary: reset password using token + operationId: resetPassword + tags: + - user + requestBody: + description: token and new password + required: true + content: + application/json: + schema: + type: object + required: + - token + - new_password + properties: + token: + type: string + new_password: + type: string + responses: + "200": + description: password reset successfully + content: + application/json: + schema: + $ref: "#/components/schemas/PasswordResetResponse" + "400": + description: invalid or expired token + /w/{workspace}/users/get/{username}: get: summary: get user (require admin privilege) @@ -17457,6 +17534,14 @@ components: - email - password + PasswordResetResponse: + type: object + properties: + message: + type: string + required: + - message + EditWorkspaceUser: type: object properties: diff --git a/backend/windmill-api/src/mcp/server.rs b/backend/windmill-api/src/mcp/server.rs index 4270729f6e..40c0bd5228 100644 --- a/backend/windmill-api/src/mcp/server.rs +++ b/backend/windmill-api/src/mcp/server.rs @@ -9,19 +9,20 @@ use std::sync::Arc; use std::{borrow::Cow, time::Duration}; use axum::body::to_bytes; -use rmcp::{ - handler::server::ServerHandler, - model::*, - service::{RequestContext, RoleServer}, - transport::StreamableHttpServerConfig, - ErrorData, -}; use serde_json::Value; use tokio::try_join; use tokio_util::sync::CancellationToken; use windmill_common::db::UserDB; use windmill_common::worker::to_raw_value; use windmill_common::{utils::StripPath, DB}; +use windmill_mcp::server::{ + Annotated, CallToolRequestParam, CallToolResult, Content, ErrorData, Implementation, + InitializeRequestParam, InitializeResult, ListPromptsResult, ListResourceTemplatesResult, + ListResourcesResult, ListToolsResult, LocalSessionManager, PaginatedRequestParam, + ProtocolVersion, RawContent, RawTextContent, RequestContext, RoleServer, ServerCapabilities, + ServerHandler, ServerInfo, StreamableHttpServerConfig, StreamableHttpService, Tool, + ToolAnnotations, +}; use crate::db::ApiAuthed; use crate::jobs::{ @@ -47,9 +48,6 @@ use super::utils::{ use axum::{ extract::Path, http::Request, middleware::Next, response::Response, routing::get, Json, Router, }; -use rmcp::transport::streamable_http_server::{ - session::local::LocalSessionManager, StreamableHttpService, -}; use windmill_common::error::JsonResult; /// MCP Server Runner - implements the core MCP protocol handlers diff --git a/backend/windmill-api/src/mcp/tools/endpoint_tools.rs b/backend/windmill-api/src/mcp/tools/endpoint_tools.rs index 0ed1f493e4..372310b463 100644 --- a/backend/windmill-api/src/mcp/tools/endpoint_tools.rs +++ b/backend/windmill-api/src/mcp/tools/endpoint_tools.rs @@ -4,10 +4,10 @@ //! them to MCP tools and handling HTTP calls to Windmill API endpoints. use crate::db::ApiAuthed; -use rmcp::{model::Tool, ErrorData}; use std::sync::Arc; use windmill_common::db::Authed; use windmill_common::{auth::create_jwt_token, BASE_INTERNAL_URL}; +use windmill_mcp::server::{ErrorData, Tool, ToolAnnotations}; // Import the auto-generated tools use super::auto_generated_endpoints; @@ -66,7 +66,7 @@ pub fn endpoint_tool_to_mcp_tool(tool: &EndpointTool) -> Tool { } /// Create appropriate annotations for endpoint tools based on HTTP method -fn create_endpoint_annotations(tool: &EndpointTool) -> rmcp::model::ToolAnnotations { +fn create_endpoint_annotations(tool: &EndpointTool) -> ToolAnnotations { let method = tool.method.as_ref(); // Determine characteristics based on HTTP method @@ -79,7 +79,7 @@ fn create_endpoint_annotations(tool: &EndpointTool) -> rmcp::model::ToolAnnotati _ => (false, true, false, true), // Default: assume can modify and be destructive }; - rmcp::model::ToolAnnotations { + ToolAnnotations { title: Some(format!("{} {}", method, tool.path)), read_only_hint: Some(read_only), destructive_hint: Some(destructive), diff --git a/backend/windmill-api/src/mcp/utils/database.rs b/backend/windmill-api/src/mcp/utils/database.rs index 32da184638..8453177ac0 100644 --- a/backend/windmill-api/src/mcp/utils/database.rs +++ b/backend/windmill-api/src/mcp/utils/database.rs @@ -3,7 +3,7 @@ //! Contains all database query functions and database-related utilities //! used by the MCP server implementation. -use rmcp::ErrorData; +use windmill_mcp::server::ErrorData; use sql_builder::prelude::*; use windmill_common::db::UserDB; use windmill_common::scripts::{get_full_hub_script_by_path, Schema}; diff --git a/backend/windmill-api/src/mcp/utils/schema.rs b/backend/windmill-api/src/mcp/utils/schema.rs index 0de27a677f..b441d94a78 100644 --- a/backend/windmill-api/src/mcp/utils/schema.rs +++ b/backend/windmill-api/src/mcp/utils/schema.rs @@ -3,7 +3,7 @@ //! Contains functions for transforming Windmill schemas into MCP-compatible formats, //! including resource enrichment and schema conversion utilities. -use rmcp::ErrorData; +use windmill_mcp::server::ErrorData; use serde_json::Value; use std::collections::HashMap; use windmill_common::db::UserDB; diff --git a/backend/windmill-api/src/mcp/utils/scope_matcher.rs b/backend/windmill-api/src/mcp/utils/scope_matcher.rs index 05fdafb706..4b50d747ac 100644 --- a/backend/windmill-api/src/mcp/utils/scope_matcher.rs +++ b/backend/windmill-api/src/mcp/utils/scope_matcher.rs @@ -3,7 +3,7 @@ //! Contains utilities for parsing and matching MCP token scopes to determine //! which scripts, flows, and endpoints a token has access to. -use rmcp::ErrorData; +use windmill_mcp::server::ErrorData; /// Configuration for MCP scopes parsed from token scopes #[derive(Debug, Clone, Default)] diff --git a/backend/windmill-api/src/oauth2_oss.rs b/backend/windmill-api/src/oauth2_oss.rs index 04e0e1b202..fba65a11bd 100644 --- a/backend/windmill-api/src/oauth2_oss.rs +++ b/backend/windmill-api/src/oauth2_oss.rs @@ -21,7 +21,7 @@ use hmac::Mac; #[cfg(all(feature = "oauth2", not(feature = "private")))] use itertools::Itertools; #[cfg(all(feature = "oauth2", not(feature = "private")))] -use oauth2::{Client as OClient, *}; +use windmill_oauth::{OClient, AccessToken, RefreshToken, Scope, helpers}; #[cfg(not(feature = "private"))] use serde::{Deserialize, Serialize}; #[cfg(not(feature = "private"))] diff --git a/backend/windmill-api/src/resources.rs b/backend/windmill-api/src/resources.rs index eb6a20ab08..900d79a133 100644 --- a/backend/windmill-api/src/resources.rs +++ b/backend/windmill-api/src/resources.rs @@ -48,7 +48,7 @@ use windmill_common::{ }; pub fn workspaced_service() -> Router { - Router::new() + let router = Router::new() .route("/list", get(list_resources)) .route("/list_search", get(list_search_resources)) .route("/list_names/:type", get(list_names)) @@ -75,8 +75,12 @@ pub fn workspaced_service() -> Router { "/file_resource_type_to_file_ext_map", get(file_resource_ext_to_resource_type), ) - .route("/type/create", post(create_resource_type)) - .route("/mcp_tools/*path", get(get_mcp_tools)) + .route("/type/create", post(create_resource_type)); + + #[cfg(feature = "mcp")] + let router = router.route("/mcp_tools/*path", get(get_mcp_tools)); + + router } pub fn public_service() -> Router { @@ -1400,6 +1404,7 @@ where } /// Get list of tools from an MCP resource +#[cfg(feature = "mcp")] async fn get_mcp_tools( authed: ApiAuthed, Extension(db): Extension, @@ -1431,11 +1436,11 @@ async fn get_mcp_tools( // Parse MCP resource let mcp_resource = - serde_json::from_str::(resource_value.0.get()) + serde_json::from_str::(resource_value.0.get()) .map_err(|e| Error::BadRequest(format!("Failed to parse MCP resource: {}", e)))?; // Create MCP client connection - let client = windmill_common::mcp_client::McpClient::from_resource(mcp_resource, &db, &w_id) + let client = windmill_mcp::McpClient::from_resource(mcp_resource, &db, &w_id) .await .map_err(|e| Error::ExecutionErr(format!("Failed to connect to MCP server: {}", e)))?; diff --git a/backend/windmill-api/src/users.rs b/backend/windmill-api/src/users.rs index 3e03fbd88f..8dbf7efa9e 100644 --- a/backend/windmill-api/src/users.rs +++ b/backend/windmill-api/src/users.rs @@ -53,6 +53,7 @@ use windmill_common::users::COOKIE_NAME; use windmill_common::users::{truncate_token, username_to_permissioned_as}; use windmill_common::utils::paginate; use windmill_common::worker::CLOUD_HOSTED; +use windmill_common::BASE_URL; use windmill_common::{ auth::{get_folders_for_user, get_groups_for_user}, db::UserDB, @@ -125,6 +126,9 @@ pub fn make_unauthed_service() -> Router { .route("/login", post(login)) .route("/logout", post(logout).get(logout)) .route("/is_first_time_setup", get(is_first_time_setup)) + .route("/request_password_reset", post(request_password_reset)) + .route("/reset_password", post(reset_password)) + .route("/is_smtp_configured", get(is_smtp_configured)) } pub async fn maybe_refresh_folders( @@ -3081,3 +3085,197 @@ async fn update_username_in_workpsace<'c>( Ok(()) } + +// Password Reset Types +#[derive(Deserialize)] +pub struct RequestPasswordReset { + pub email: String, +} + +#[derive(Deserialize)] +pub struct ResetPassword { + pub token: String, + pub new_password: String, +} + +#[derive(Serialize)] +pub struct PasswordResetResponse { + pub message: String, +} + +// Password Reset Functions + +/// Check if SMTP is configured +async fn is_smtp_configured(Extension(db): Extension) -> JsonResult { + let smtp = windmill_common::server::load_smtp_config(&db).await?; + Ok(Json(smtp.is_some())) +} + +/// Request a password reset email +async fn request_password_reset( + Extension(db): Extension, + Json(req): Json, +) -> Result> { + let email = req.email.to_lowercase(); + + // Check if SMTP is configured + let smtp = windmill_common::server::load_smtp_config(&db).await?; + let smtp = smtp.ok_or_else(|| { + Error::BadRequest("SMTP is not configured. Password reset is not available.".to_string()) + })?; + + // Check if user exists with password login type + let user_exists = sqlx::query_scalar!( + "SELECT EXISTS(SELECT 1 FROM password WHERE email = $1 AND login_type = 'password')", + &email + ) + .fetch_one(&db) + .await? + .unwrap_or(false); + + // Always return success to prevent email enumeration + // But only send email if user exists + if user_exists { + // Generate a secure token + let token = rd_string(32); + + // Delete any existing tokens for this email + sqlx::query!("DELETE FROM magic_link WHERE email = $1", &email) + .execute(&db) + .await?; + + // Insert new token with 1 hour expiration + sqlx::query!( + "INSERT INTO magic_link (email, token, expiration) VALUES ($1, $2, NOW() + INTERVAL '1 hour')", + &email, + &token + ) + .execute(&db) + .await?; + + // Get the base URL for the reset link + let base_url = BASE_URL.read().await.clone(); + let base_url = if base_url.is_empty() { + std::env::var("BASE_URL").unwrap_or_else(|_| "http://localhost".to_string()) + } else { + base_url + }; + + let reset_link = format!("{}/user/reset-password?token={}", base_url, token); + + // Send the email + let subject = "Windmill Password Reset"; + let content = format!( + "You have requested a password reset for your Windmill account.\n\n\ + Click the link below to reset your password:\n\ + {}\n\n\ + This link will expire in 1 hour.\n\n\ + If you did not request this password reset, you can safely ignore this email.", + reset_link + ); + + // Send the email - don't fail the request if email fails + if let Err(e) = windmill_common::email_oss::send_email_plain_text( + subject, + &content, + vec![email.clone()], + smtp, + Some(Duration::from_secs(10)), + ) + .await + { + tracing::error!("Failed to send password reset email to {}: {:?}", email, e); + } + } + + // Always return success to prevent email enumeration + Ok(Json(PasswordResetResponse { + message: "If an account with that email exists, a password reset link has been sent." + .to_string(), + })) +} + +/// Reset password using a token +async fn reset_password( + Extension(db): Extension, + Extension(argon2): Extension>>, + Json(req): Json, +) -> Result> { + let mut tx = db.begin().await?; + + // Find the token and verify it's not expired + let magic_link = sqlx::query!( + "SELECT email FROM magic_link WHERE token = $1 AND expiration > NOW()", + &req.token + ) + .fetch_optional(&mut *tx) + .await?; + + let email = match magic_link { + Some(link) => link.email, + None => { + return Err(Error::BadRequest( + "Invalid or expired password reset token".to_string(), + )) + } + }; + + // Hash the new password + let password_hash = crate::users_oss::hash_password(argon2, req.new_password)?; + + // Update the password + let rows_updated = sqlx::query!( + "UPDATE password SET password_hash = $1 WHERE email = $2 AND login_type = 'password'", + &password_hash, + &email + ) + .execute(&mut *tx) + .await? + .rows_affected(); + + if rows_updated == 0 { + return Err(Error::BadRequest( + "Unable to update password. User may not exist or may use a different login method." + .to_string(), + )); + } + + // Delete the used token and any other tokens for this email + sqlx::query!("DELETE FROM magic_link WHERE email = $1", &email) + .execute(&mut *tx) + .await?; + + // Invalidate all existing sessions for this user + sqlx::query!( + "DELETE FROM token WHERE email = $1 AND label = 'session'", + &email + ) + .execute(&mut *tx) + .await?; + + // Audit log + let audit_author = AuditAuthor { + email: email.clone(), + username: email.clone(), + username_override: None, + token_prefix: None, + }; + + audit_log( + &mut *tx, + &audit_author, + "users.password_reset", + ActionKind::Update, + "global", + Some(&email), + None, + ) + .await?; + + tx.commit().await?; + + Ok(Json(PasswordResetResponse { + message: "Password has been reset successfully. You can now log in with your new password." + .to_string(), + })) +} diff --git a/backend/windmill-api/src/users_oss.rs b/backend/windmill-api/src/users_oss.rs index 4d1b3976d2..7cb643b84a 100644 --- a/backend/windmill-api/src/users_oss.rs +++ b/backend/windmill-api/src/users_oss.rs @@ -55,6 +55,13 @@ pub async fn set_password( )) } +#[cfg(not(feature = "private"))] +pub fn hash_password(_argon2: Arc>, _password: String) -> Result { + Err(Error::internal_err( + "Not implemented in Windmill's Open Source repository".to_string(), + )) +} + #[cfg(not(feature = "private"))] pub fn send_email_if_possible(_subject: &str, _content: &str, _to: &str) { tracing::warn!( @@ -70,7 +77,6 @@ pub struct OnboardingData { pub use_case: String, } - #[cfg(not(feature = "private"))] pub async fn submit_onboarding_data( _authed: ApiAuthed, @@ -80,4 +86,4 @@ pub async fn submit_onboarding_data( Err(Error::internal_err( "Not implemented in Windmill's Open Source repository".to_string(), )) -} \ No newline at end of file +} diff --git a/backend/windmill-common/Cargo.toml b/backend/windmill-common/Cargo.toml index e9a642e59b..1acf9f4c6a 100644 --- a/backend/windmill-common/Cargo.toml +++ b/backend/windmill-common/Cargo.toml @@ -11,7 +11,6 @@ private = ["dep:aws-sdk-rds"] jemalloc = ["dep:tikv-jemalloc-ctl"] tantivy = [] prometheus = ["dep:prometheus"] -loki = ["dep:tracing-loki"] benchmark = [] parquet = ["dep:object_store", "dep:aws-sdk-sts", "dep:aws-smithy-types-convert", "dep:datafusion"] aws_auth = ["dep:aws-sdk-sts"] @@ -59,7 +58,6 @@ itertools.workspace = true regex.workspace = true git-version.workspace = true cron.workspace = true -tracing-loki = { version = "^0", optional = true } magic-crypt.workspace = true object_store = { workspace = true, optional = true } prometheus = { workspace = true, optional = true } @@ -100,7 +98,7 @@ async-recursion.workspace = true pep440_rs.workspace = true semver.workspace = true -croner = "2.2.0" +croner.workspace = true quick_cache.workspace = true pin-project-lite.workspace = true futures.workspace = true @@ -108,7 +106,6 @@ tempfile.workspace = true systemstat.workspace = true size.workspace = true globset.workspace = true -rmcp = { version = "0.12.0", features = ["client", "transport-streamable-http-client", "transport-streamable-http-client-reqwest"] } opentelemetry-semantic-conventions = { workspace = true, optional = true } opentelemetry-otlp = { workspace = true, optional = true } diff --git a/backend/windmill-common/src/lib.rs b/backend/windmill-common/src/lib.rs index 82d7911847..a650f6bf0c 100644 --- a/backend/windmill-common/src/lib.rs +++ b/backend/windmill-common/src/lib.rs @@ -64,7 +64,6 @@ pub mod git_sync_ee; pub mod git_sync_oss; pub mod jobs; pub mod jwt; -pub mod mcp_client; pub mod more_serde; pub mod oauth2; #[cfg(all(feature = "enterprise", feature = "openidconnect", feature = "private"))] diff --git a/backend/windmill-mcp/Cargo.toml b/backend/windmill-mcp/Cargo.toml new file mode 100644 index 0000000000..e09e665ff8 --- /dev/null +++ b/backend/windmill-mcp/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "windmill-mcp" +version.workspace = true +authors.workspace = true +edition.workspace = true + +[lib] +name = "windmill_mcp" +path = "src/lib.rs" + +[features] +default = [] +server = ["rmcp/transport-streamable-http-server", "rmcp/transport-streamable-http-server-session", "rmcp/transport-worker"] + +[dependencies] +windmill-common = { workspace = true, default-features = false } +anyhow.workspace = true +reqwest = { version = "=0.12", features = ["json", "stream", "gzip"] } +serde.workspace = true +serde_json.workspace = true +tracing.workspace = true +rmcp.workspace = true diff --git a/backend/windmill-common/src/mcp_client.rs b/backend/windmill-mcp/src/lib.rs similarity index 86% rename from backend/windmill-common/src/mcp_client.rs rename to backend/windmill-mcp/src/lib.rs index ee57622902..a6a93e4770 100644 --- a/backend/windmill-common/src/mcp_client.rs +++ b/backend/windmill-mcp/src/lib.rs @@ -1,10 +1,19 @@ -use crate::variables::get_secret_value_as_admin; -use crate::DB; +/* + * Author: Ruben Fiszel + * Copyright: Windmill Labs, Inc 2022 + * This file and its contents are licensed under the AGPLv3 License. + * Please see the included NOTICE for copyright information and + * LICENSE-AGPL for a copy of the license. + */ + use anyhow::{Context, Result}; use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; use serde_json::{json, Value}; use std::str::FromStr; +use windmill_common::variables::get_secret_value_as_admin; +use windmill_common::DB; +// Re-export rmcp types for client usage pub use rmcp::model::Tool as McpTool; use rmcp::{ model::{ @@ -18,6 +27,26 @@ use rmcp::{ RoleClient, ServiceExt, }; +// Re-export rmcp server types when server feature is enabled +#[cfg(feature = "server")] +pub mod server { + //! Re-exports of rmcp server types for MCP server implementations + + pub use rmcp::handler::server::ServerHandler; + pub use rmcp::model::{ + Annotated, CallToolRequestParam, CallToolResult, Content, Implementation, + InitializeRequestParam, InitializeResult, ListPromptsResult, ListResourceTemplatesResult, + ListResourcesResult, ListToolsResult, PaginatedRequestParam, ProtocolVersion, RawContent, + RawTextContent, ServerCapabilities, ServerInfo, Tool, ToolAnnotations, + }; + pub use rmcp::service::{RequestContext, RoleServer}; + pub use rmcp::transport::streamable_http_server::{ + session::local::LocalSessionManager, StreamableHttpService, + }; + pub use rmcp::transport::StreamableHttpServerConfig; + pub use rmcp::ErrorData; +} + use std::collections::HashMap; use serde::{Deserialize, Serialize}; diff --git a/backend/windmill-oauth/Cargo.toml b/backend/windmill-oauth/Cargo.toml new file mode 100644 index 0000000000..434b3fca97 --- /dev/null +++ b/backend/windmill-oauth/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "windmill-oauth" +version.workspace = true +authors.workspace = true +edition.workspace = true + +[lib] +name = "windmill_oauth" +path = "src/lib.rs" + +[features] +default = [] + +[dependencies] +windmill-common = { workspace = true, default-features = false } + +async-oauth2.workspace = true +axum.workspace = true +tower-cookies.workspace = true +# Note: We use reqwest 0.12 via async-oauth2, not the workspace reqwest 0.13 +reqwest = { version = "0.12", features = ["json"] } +sqlx.workspace = true +tokio.workspace = true + +serde.workspace = true +serde_json.workspace = true + +hmac.workspace = true +sha2.workspace = true +base64.workspace = true +hex.workspace = true + +chrono.workspace = true +itertools.workspace = true +anyhow.workspace = true +lazy_static.workspace = true +tracing.workspace = true diff --git a/backend/windmill-oauth/src/lib.rs b/backend/windmill-oauth/src/lib.rs new file mode 100644 index 0000000000..c89cb190b7 --- /dev/null +++ b/backend/windmill-oauth/src/lib.rs @@ -0,0 +1,856 @@ +/* + * Author: Ruben Fiszel + * Copyright: Windmill Labs, Inc 2022 + * This file and its contents are licensed under the AGPLv3 License. + * Please see the included NOTICE for copyright information and + * LICENSE-AGPL for a copy of the license. + */ + +//! OAuth2 client and token management for Windmill. +//! +//! This crate provides OAuth2 functionality including: +//! - OAuth2 client configuration and building +//! - Token exchange and refresh +//! - Slack OAuth integration +//! - Client credentials flow support + +use std::collections::HashMap; +use std::fmt::Debug; +use std::sync::Arc; + +use anyhow::anyhow; +use base64::Engine; +use hmac::Mac; +use itertools::Itertools; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use sqlx::{Postgres, Transaction}; +use tokio::sync::RwLock; +use tower_cookies::{Cookie, Cookies}; +use windmill_common::error::{self, to_anyhow, Error}; +use windmill_common::more_serde::maybe_number_opt; +use windmill_common::oauth2::*; +use windmill_common::utils::now_from_db; +use windmill_common::variables::{build_crypt, encrypt}; + +pub type DB = sqlx::Pool; + +// Re-export oauth2 types that consumers need (also used internally) +pub use oauth2::{ + AccessToken, AuthType, Client as OClient, RefreshToken, Scope, State, Url, + helpers, +}; + +// Re-export reqwest Client (version 0.12 compatible with async-oauth2) +pub use reqwest::Client as HttpClient; + +lazy_static::lazy_static! { + pub static ref BASE_URL: Arc> = Arc::new(RwLock::new("".to_string())); + pub static ref IS_SECURE: Arc> = Arc::new(RwLock::new(false)); + pub static ref COOKIE_DOMAIN: Option = std::env::var("COOKIE_DOMAIN").ok(); + + /// HTTP client for OAuth operations (reqwest 0.12, compatible with async-oauth2) + pub static ref OAUTH_HTTP_CLIENT: reqwest::Client = reqwest::ClientBuilder::new() + .user_agent("windmill/oauth") + .connect_timeout(std::time::Duration::from_secs(10)) + .timeout(std::time::Duration::from_secs(30)) + .build() + .expect("Failed to create OAuth HTTP client"); +} + +/// OAuth client with associated scopes and configuration +#[derive(Debug, Clone)] +pub struct ClientWithScopes { + pub display_name: Option, + pub client: OClient, + pub scopes: Vec, + pub extra_params: Option>, + pub extra_params_callback: Option>, + pub allowed_domains: Option>, + pub userinfo_url: Option, + pub grant_types: Vec, +} + +/// Map of OAuth client names to their configurations +pub type BasicClientsMap = HashMap; + +/// OAuth provider configuration +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct OAuthConfig { + #[serde(default = "empty_auth")] + pub auth_url: String, + #[serde(default = "empty_string")] + pub token_url: String, + pub userinfo_url: Option, + pub scopes: Option>, + pub extra_params: Option>, + pub extra_params_callback: Option>, + pub req_body_auth: Option, + #[serde(default = "default_grant_types")] + pub grant_types: Vec, +} + +/// OAuth client credentials +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct OAuthClient { + #[serde(default = "empty_string")] + pub id: String, + #[serde(default = "empty_string")] + pub secret: String, + #[serde(default, deserialize_with = "windmill_common::utils::empty_as_none")] + pub display_name: Option, + pub allowed_domains: Option>, + pub connect_config: Option, + pub login_config: Option, + pub tenant: Option, + #[serde(default = "default_grant_types")] + pub grant_types: Vec, +} + +fn empty_string() -> String { + "".to_string() +} + +fn empty_auth() -> String { + "https://missing-auth-url".to_string() +} + +fn default_grant_types() -> Vec { + vec!["authorization_code".to_string()] +} + +/// Container for all OAuth clients (login, connect, and slack) +#[derive(Debug)] +pub struct AllClients { + pub logins: BasicClientsMap, + pub connects: BasicClientsMap, + pub slack: Option, +} + +/// Slack token response from OAuth flow +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SlackTokenResponse { + pub access_token: AccessToken, + pub team_id: String, + pub team_name: String, + #[serde(rename = "scope")] + #[serde(deserialize_with = "helpers::deserialize_space_delimited_vec")] + #[serde(serialize_with = "helpers::serialize_space_delimited_vec")] + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + pub scopes: Option>, + pub bot: SlackBotToken, +} + +/// Standard OAuth token response +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TokenResponse { + pub access_token: AccessToken, + #[serde(deserialize_with = "maybe_number_opt")] + #[serde(default)] + pub expires_in: Option, + pub refresh_token: Option, + #[serde(deserialize_with = "helpers::deserialize_space_delimited_vec")] + #[serde(serialize_with = "helpers::serialize_space_delimited_vec")] + #[serde(default)] + pub scope: Option>, +} + +/// Slack bot token from OAuth response +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SlackBotToken { + pub bot_access_token: String, +} + +/// OAuth callback parameters +#[derive(Deserialize)] +pub struct OAuthCallback { + pub code: String, + pub state: String, +} + +/// Build all OAuth clients from configuration +pub async fn build_oauth_clients( + base_url: &str, + oauths_from_config: Option>, + connect_configs_json: &str, + login_configs_json: &str, +) -> anyhow::Result { + let connect_configs = + serde_json::from_str::>(connect_configs_json)?; + let login_configs = serde_json::from_str::>(login_configs_json)?; + + let oauths = if let Some(oauths) = oauths_from_config { + tracing::info!("Using OAuth clients from config: {oauths:?}"); + oauths + } else { + let path = "./oauth.json"; + let content: String = if let Ok(e) = std::env::var("OAUTH_JSON_AS_BASE64") { + std::str::from_utf8( + &base64::engine::general_purpose::STANDARD + .decode(e) + .map_err(to_anyhow)?, + )? + .to_string() + } else if std::path::Path::new(path).exists() { + std::fs::read_to_string(path).map_err(to_anyhow)? + } else { + tracing::warn!("oauth.json not found, no OAuth clients loaded"); + return Ok(AllClients { + logins: HashMap::new(), + connects: HashMap::new(), + slack: None, + }); + }; + + if content.is_empty() { + tracing::warn!("oauth.json is empty, no OAuth clients loaded"); + return Ok(AllClients { + logins: HashMap::new(), + connects: HashMap::new(), + slack: None, + }); + }; + match serde_json::from_str::>(&content) { + Ok(clients) => clients, + Err(e) => { + tracing::error!("deserializing oauth.json: {e}"); + HashMap::new() + } + } + .into_iter() + .collect() + }; + + tracing::info!( + "OAuth loaded clients: {}", + oauths.keys().join(", ") + ); + + let logins = login_configs + .into_iter() + .filter_map(|x| oauths.get(&x.0).map(|c| (x.0, (c, x.1)))) + .chain(oauths.iter().filter_map(|x| { + x.1.login_config + .as_ref() + .map(|c| (x.0.clone(), (x.1, c.clone()))) + })) + .filter_map(|(k, (client_params, config))| { + let named_client = build_basic_client( + k.clone(), + config.clone(), + client_params.clone(), + true, + base_url, + None, + ); + named_client + .map(|named_client| { + ( + named_client.0, + ClientWithScopes { + client: named_client.1, + scopes: config.scopes.unwrap_or(vec![]), + extra_params: config.extra_params, + extra_params_callback: config.extra_params_callback, + allowed_domains: client_params.allowed_domains.clone(), + userinfo_url: config.userinfo_url, + display_name: client_params.display_name.clone(), + grant_types: client_params.grant_types.clone(), + }, + ) + }) + .map_err(|e| { + tracing::error!("Error building oauth client {k}: {e}"); + e + }) + .ok() + }) + .collect(); + + let connects = connect_configs + .into_iter() + .filter_map(|x| oauths.get(&x.0).map(|c| (x.0, (c, x.1)))) + .chain(oauths.iter().filter_map(|x| { + x.1.connect_config + .as_ref() + .map(|c| (x.0.clone(), (x.1, c.clone()))) + })) + .filter_map(|(k, (client_params, config))| { + let named_client = build_basic_client( + k.clone(), + config.clone(), + client_params.clone(), + false, + base_url, + if k == "supabase_wizard" { + Some(format!("{base_url}/oauth/callback_supabase")) + } else { + None + }, + ); + named_client + .map(|named_client| { + ( + named_client.0, + ClientWithScopes { + client: named_client.1, + scopes: config.scopes.unwrap_or(vec![]), + extra_params: config.extra_params, + extra_params_callback: config.extra_params_callback, + allowed_domains: None, + userinfo_url: None, + display_name: client_params.display_name.clone(), + grant_types: client_params.grant_types.clone(), + }, + ) + }) + .map_err(|e| { + tracing::error!("Error building oauth client {k}: {e}"); + e + }) + .ok() + }) + .collect(); + + let slack = oauths + .get("slack") + .map(|v| { + build_basic_client( + "slack".to_string(), + OAuthConfig { + auth_url: "https://slack.com/oauth/authorize".to_string(), + token_url: "https://slack.com/api/oauth.access".to_string(), + userinfo_url: None, + scopes: None, + extra_params: None, + extra_params_callback: None, + req_body_auth: None, + grant_types: vec!["authorization_code".to_string()], + }, + v.clone(), + false, + base_url, + Some(format!("{base_url}/oauth/callback_slack")), + ) + .map(|x| x.1) + .map_err(|e| { + tracing::error!("Error building oauth slack client: {e}"); + e + }) + .ok() + }) + .flatten(); + + let all_clients = AllClients { logins, connects, slack }; + tracing::debug!("Final oauth config: {all_clients:#?}"); + Ok(all_clients) +} + +/// Build a basic OAuth client from configuration +pub fn build_basic_client( + name: String, + config: OAuthConfig, + client_params: OAuthClient, + login: bool, + base_url: &str, + override_callback: Option, +) -> error::Result<(String, OClient)> { + let auth_url = Url::parse(&config.auth_url) + .map_err(|e| anyhow!("Invalid authorization endpoint URL: {e}"))?; + let token_url = + Url::parse(&config.token_url).map_err(|e| anyhow!("Invalid token endpoint URL: {e}"))?; + + let redirect_url = if login { + format!("{base_url}/user/login_callback/{name}") + } else if let Some(callback) = override_callback { + callback + } else { + format!("{base_url}/oauth/callback/{name}") + }; + + let mut client = OClient::new(client_params.id, auth_url, token_url); + if config.req_body_auth.unwrap_or(false) { + client.set_auth_type(AuthType::RequestBody); + } + client.set_client_secret(client_params.secret.clone()); + client.set_redirect_url( + Url::parse(&redirect_url).map_err(|e| anyhow!("Invalid redirect URL: {e}"))?, + ); + + Ok((name.to_string(), client)) +} + +/// Build a Slack OAuth client with custom credentials +pub async fn build_slack_client( + client_id: &str, + client_secret: &str, + _workspace_id: &str, +) -> error::Result { + let auth_url = Url::parse("https://slack.com/oauth/authorize") + .map_err(|e| anyhow!("Invalid Slack authorization URL: {e}"))?; + let token_url = Url::parse("https://slack.com/api/oauth.access") + .map_err(|e| anyhow!("Invalid Slack token URL: {e}"))?; + + let base_url = BASE_URL.read().await.clone(); + let redirect_url = format!("{}/oauth/callback_slack", base_url); + + let mut client = OClient::new(client_id.to_string(), auth_url, token_url); + client.set_client_secret(client_secret.to_string()); + client.set_redirect_url( + Url::parse(&redirect_url).map_err(|e| anyhow!("Invalid redirect URL: {e}"))?, + ); + + Ok(client) +} + +/// Build OAuth client for client credentials flow with resource-level credentials +pub async fn build_client_credentials_oauth_client( + db: &DB, + client_name: &str, + client_id: &str, + client_secret: &str, + cc_token_url_override: Option<&str>, + connect_configs_json: &str, +) -> error::Result<(OClient, OAuthClient)> { + use windmill_common::global_settings::{load_value_from_global_settings, OAUTH_SETTING}; + + let oauths = load_value_from_global_settings(db, OAUTH_SETTING).await?; + let oauths = oauths.unwrap_or_default(); + let oauth_config = oauths + .get(client_name) + .ok_or_else(|| error::Error::BadRequest("OAuth configuration not found".to_string()))?; + + let oauth_client_config: OAuthClient = serde_json::from_value(oauth_config.clone()) + .map_err(|e| error::Error::BadRequest(format!("Invalid OAuth config: {}", e)))?; + + let mut connect_config = if let Some(ref config) = oauth_client_config.connect_config { + if !config.auth_url.is_empty() && !config.token_url.is_empty() { + config.clone() + } else { + let static_configs = + serde_json::from_str::>(connect_configs_json) + .map_err(|e| { + error::Error::InternalErr(format!( + "Failed to parse oauth_connect.json: {}", + e + )) + })?; + + static_configs.get(client_name).cloned().ok_or_else(|| { + error::Error::BadRequest(format!( + "OAuth configuration not found for '{}' in either global settings or static config", + client_name + )) + })? + } + } else { + let static_configs = + serde_json::from_str::>(connect_configs_json).map_err( + |e| { + error::Error::InternalErr(format!("Failed to parse oauth_connect.json: {}", e)) + }, + )?; + + static_configs.get(client_name).cloned().ok_or_else(|| { + error::Error::BadRequest(format!( + "OAuth configuration not found for '{}' in either global settings or static config", + client_name + )) + })? + }; + + if let Some(override_url) = cc_token_url_override { + connect_config.token_url = override_url.to_string(); + } + + let resource_oauth_client = OAuthClient { + id: client_id.to_string(), + secret: client_secret.to_string(), + allowed_domains: oauth_client_config.allowed_domains.clone(), + connect_config: Some(connect_config.clone()), + login_config: oauth_client_config.login_config.clone(), + display_name: oauth_client_config.display_name.clone(), + grant_types: oauth_client_config.grant_types.clone(), + tenant: oauth_client_config.tenant.clone(), + }; + + let base_url = BASE_URL.read().await.clone(); + let (_, client) = build_basic_client( + client_name.to_string(), + connect_config, + resource_oauth_client, + false, + &base_url, + None, + )?; + + Ok((client, oauth_client_config)) +} + +/// Exchange authorization code for tokens +pub async fn exchange_code( + callback: OAuthCallback, + cookies: &Cookies, + client: OClient, + extra_params: Option>, + http_client: &reqwest::Client, +) -> error::Result { + let name = if COOKIE_DOMAIN.is_some() { + "csrf_domain" + } else { + "csrf" + }; + let csrf_state = cookies + .get(name) + .map(|x| x.value().to_string()) + .unwrap_or("".to_string()); + if callback.state != csrf_state { + return Err(error::Error::BadRequest("csrf did not match".to_string())); + } + + let mut token_url = client.exchange_code(callback.code); + + if let Some(extra_params) = extra_params { + for (key, value) in extra_params { + token_url = token_url.param(key, value) + } + } + + token_url + .with_client(http_client) + .execute::() + .await + .map_err(|e| error::Error::InternalErr(format!("{:?}", e))) +} + +/// Internal token exchange implementation +pub async fn exchange_token( + client: OClient, + refresh_token: &str, + grant_type: &str, + oauth_client_info: Option<&ClientWithScopes>, + http_client: &reqwest::Client, +) -> Result { + let token_json = match grant_type { + "authorization_code" => { + client + .exchange_refresh_token(&RefreshToken::from(refresh_token)) + .with_client(http_client) + .execute::() + .await + .map_err(to_anyhow)? + } + "client_credentials" => { + let mut token_request = client.exchange_client_credentials(); + + if let Some(oauth_info) = oauth_client_info { + if let Some(extra_params) = oauth_info.extra_params_callback.as_ref() { + for (key, value) in extra_params.iter() { + token_request = token_request.param(key.clone(), value.clone()); + } + } + } + + token_request + .with_client(http_client) + .execute::() + .await + .map_err(to_anyhow)? + } + "" | _ if grant_type.is_empty() => { + client + .exchange_refresh_token(&RefreshToken::from(refresh_token)) + .with_client(http_client) + .execute::() + .await + .map_err(to_anyhow)? + } + _ => { + return Err(Error::BadRequest(format!( + "Unsupported grant type: {}", + grant_type + ))) + } + }; + + let token = serde_json::from_value::(token_json.clone()).map_err(|e| { + Error::BadConfig(format!( + "Error deserializing response as a new token: {e}\nresponse:{token_json}" + )) + })?; + Ok(token) +} + +/// Refresh an OAuth token and update the database +pub async fn refresh_token<'c>( + mut tx: Transaction<'c, Postgres>, + path: &str, + w_id: &str, + id: i32, + db: &DB, + oauth_clients: &AllClients, + http_client: &reqwest::Client, + connect_configs_json: &str, +) -> error::Result { + let account = sqlx::query!( + "SELECT client, refresh_token, grant_type, cc_client_id, cc_client_secret, cc_token_url FROM account WHERE workspace_id = $1 AND id = $2", + w_id, + id, + ) + .fetch_optional(&mut *tx) + .await?; + let account = windmill_common::utils::not_found_if_none(account, "Account", &id.to_string())?; + let oauth_client_info = oauth_clients + .connects + .get(&account.client) + .ok_or_else(|| error::Error::BadRequest("invalid client".to_string()))? + .clone(); + + let mut client = if account.grant_type == "client_credentials" { + match (&account.cc_client_id, &account.cc_client_secret) { + (Some(client_id), Some(client_secret)) => { + let (client, _) = build_client_credentials_oauth_client( + db, + &account.client, + client_id, + client_secret, + account.cc_token_url.as_deref(), + connect_configs_json, + ) + .await?; + client + } + _ => { + return Err(error::Error::BadRequest( + "client_credentials flow requires cc_client_id and cc_client_secret to be stored in account".to_string() + )); + } + } + } else { + oauth_client_info.client.to_owned() + }; + + if account.grant_type == "client_credentials" { + for scope in oauth_client_info.scopes.iter() { + client.add_scope(scope); + } + } + + tracing::info!( + grant_type = %account.grant_type, + client = %account.client, + workspace_id = %w_id, + account_id = %id, + "Refreshing OAuth token" + ); + + let token = exchange_token( + client, + &account.refresh_token, + &account.grant_type, + Some(&oauth_client_info), + http_client, + ) + .await; + + if let Err(token_err) = token { + sqlx::query!( + "UPDATE account SET refresh_error = $1 WHERE workspace_id = $2 AND id = $3", + token_err.alt(), + w_id, + id, + ) + .execute(&mut *tx) + .await?; + tx.commit().await?; + return Err(error::Error::BadRequest(format!( + "Error refreshing token: {}", + token_err.alt() + ))); + }; + + let token = token.unwrap(); + + let expires_at = now_from_db(&mut *tx).await? + + chrono::Duration::try_seconds( + token + .expires_in + .ok_or_else(|| Error::InternalErr("expires_in expected and not found".to_string()))? + .try_into() + .unwrap(), + ) + .unwrap_or_default(); + sqlx::query!( + "UPDATE account SET refresh_token = $1, expires_at = $2, refresh_error = NULL WHERE workspace_id = $3 AND id = $4", + token + .refresh_token + .map(|x| x.to_string()) + .unwrap_or(account.refresh_token), + expires_at, + w_id, + id, + ) + .execute(&mut *tx) + .await?; + tx.commit().await?; + + let token_str = token.access_token.to_string(); + let mc = build_crypt(db, w_id).await?; + let encrypted_token = encrypt(&mc, token_str.as_str()); + + sqlx::query!( + "UPDATE variable SET value = $1 WHERE workspace_id = $2 AND path = $3", + encrypted_token, + w_id, + path + ) + .execute(db) + .await?; + + tracing::info!( + grant_type = %account.grant_type, + client = %account.client, + workspace_id = %w_id, + account_id = %id, + "OAuth token refreshed successfully" + ); + + Ok(token_str) +} + +/// Generate OAuth redirect URL with CSRF protection +pub fn oauth_redirect( + clients: &HashMap, + client_name: String, + cookies: Cookies, + scopes: Option>, + extra_params: Option>, + is_secure: bool, +) -> error::Result { + let client_w_scopes = clients + .get(&client_name) + .ok_or_else(|| error::Error::BadRequest("client not found".to_string()))?; + let state = State::new_random(); + let mut client = client_w_scopes.client.clone(); + let scopes_iter = if let Some(scopes) = scopes { + scopes + } else { + client_w_scopes.scopes.clone() + }; + + for scope in scopes_iter.iter() { + client.add_scope(scope); + } + + let mut auth_url = client.authorize_url(&state); + + if let Some(extra_params) = extra_params { + let mut query_string = auth_url.query_pairs_mut(); + for (key, value) in extra_params { + query_string.append_pair(&key, &value); + } + } + + set_csrf_cookie(&state, cookies, is_secure); + Ok(axum::response::Redirect::to(auth_url.as_str())) +} + +/// Set CSRF cookie for OAuth state verification +pub fn set_csrf_cookie(state: &State, cookies: Cookies, is_secure: bool) { + let csrf = state.to_base64(); + let name = if COOKIE_DOMAIN.is_some() { + "csrf_domain".to_string() + } else { + "csrf".to_string() + }; + let mut cookie = Cookie::new(name, csrf); + cookie.set_secure(is_secure); + cookie.set_same_site(Some(tower_cookies::cookie::SameSite::Lax)); + cookie.set_http_only(true); + cookie.set_path("/"); + if COOKIE_DOMAIN.is_some() { + cookie.set_domain(COOKIE_DOMAIN.clone().unwrap()); + } + cookies.add(cookie); +} + +/// Slack signature verifier for webhook authentication +#[derive(Clone, Debug)] +pub struct SlackVerifier { + mac: HmacSha256, +} + +impl SlackVerifier { + pub fn new>(secret: S) -> anyhow::Result { + HmacSha256::new_from_slice(secret.as_ref()) + .map(|mac| SlackVerifier { mac }) + .map_err(|_| anyhow::anyhow!("invalid secret")) + } + + pub fn verify(&self, ts: &str, body: &str, exp_sig: &str) -> anyhow::Result<()> { + let basestring = format!("v0:{}:{}", ts, body); + let mut mac = self.mac.clone(); + + mac.update(basestring.as_bytes()); + let sig = format!("v0={}", hex::encode(mac.finalize().into_bytes())); + if sig != exp_sig { + Err(anyhow::anyhow!("signature mismatch"))?; + } + Ok(()) + } +} + +/// Fetch user info from OAuth provider +pub async fn http_get_user_info( + http_client: &reqwest::Client, + url: &str, + token: &str, +) -> error::Result { + let res = http_client + .get(url) + .bearer_auth(token) + .send() + .await + .map_err(to_anyhow) + .map_err(|e| error::Error::InternalErr(format!("failed to fetch user info: {}", e)))?; + if !res.status().is_success() { + tracing::debug!( + "The bearer token of the failed oauth user info exchange is: {}", + token + ); + return Err(error::Error::BadConfig(format!( + "The user info endpoint responded with non 200: {}\n{}\n{}", + res.status(), + res.headers() + .iter() + .map(|x| format!("{}: {}", x.0.as_str(), x.1.to_str().unwrap_or_default())) + .collect::>() + .join("\n"), + res.text().await.unwrap_or_default(), + ))); + } + Ok(res + .json::() + .await + .map_err(to_anyhow) + .map_err(|e| error::Error::InternalErr(format!("failed to decode json from user info: {}", e)))?) +} + +/// GitHub email info response +#[derive(Deserialize)] +pub struct GHEmailInfo { + pub email: String, + pub verified: bool, + pub primary: bool, +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_slack_verifier() { + let verifier = SlackVerifier::new("test_secret").unwrap(); + assert!(verifier.verify("123", "body", "wrong_sig").is_err()); + } +} diff --git a/backend/windmill-worker/Cargo.toml b/backend/windmill-worker/Cargo.toml index 137abe3d62..60b4838b76 100644 --- a/backend/windmill-worker/Cargo.toml +++ b/backend/windmill-worker/Cargo.toml @@ -11,6 +11,7 @@ path = "src/lib.rs" [features] default = [] private = [] +mcp = ["dep:windmill-mcp"] prometheus = ["dep:prometheus", "windmill-common/prometheus"] enterprise = ["windmill-queue/enterprise", "windmill-git-sync/enterprise", "windmill-common/enterprise", "dep:pem", "dep:tokio-util"] mssql = ["dep:tiberius"] @@ -40,6 +41,7 @@ duckdb = ["dep:libloading"] windmill-queue.workspace = true windmill-audit.workspace = true # there isn't really a reason for audit-worth actions to happen in the worker. windmill-common = { workspace = true, default-features = false } +windmill-mcp = { workspace = true, optional = true } windmill-macros.workspace = true windmill-parser.workspace = true windmill-parser-ts.workspace = true diff --git a/backend/windmill-worker/src/ai/tools.rs b/backend/windmill-worker/src/ai/tools.rs index 638129e34d..584be8fe2b 100644 --- a/backend/windmill-worker/src/ai/tools.rs +++ b/backend/windmill-worker/src/ai/tools.rs @@ -22,7 +22,16 @@ use std::{collections::HashMap, sync::Arc}; use uuid::Uuid; use windmill_common::flows::InputTransform; use windmill_common::jobs::JobPayload; -use windmill_common::mcp_client::{McpClient, McpToolSource}; +use crate::ai::types::McpToolSource; + +#[cfg(feature = "mcp")] +use windmill_mcp::McpClient; + +#[cfg(not(feature = "mcp"))] +pub struct McpClientStub; + +#[cfg(not(feature = "mcp"))] +type McpClient = McpClientStub; use windmill_common::{ client::AuthedClient, db::DB, diff --git a/backend/windmill-worker/src/ai/types.rs b/backend/windmill-worker/src/ai/types.rs index b48b4a73d1..51f5833851 100644 --- a/backend/windmill-worker/src/ai/types.rs +++ b/backend/windmill-worker/src/ai/types.rs @@ -3,7 +3,17 @@ use serde::{Deserialize, Serialize}; use serde_json::value::RawValue; use std::collections::HashMap; use uuid::Uuid; -use windmill_common::mcp_client::McpToolSource; +#[cfg(feature = "mcp")] +pub use windmill_mcp::McpToolSource; + +/// Stub type when mcp feature is not enabled +#[cfg(not(feature = "mcp"))] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +pub struct McpToolSource { + pub name: String, + pub tool_name: String, + pub resource_path: String, +} use windmill_common::{ ai_providers::AIProvider, db::DB, error::Error, flow_status::AgentAction, flows::FlowModule, s3_helpers::S3Object, diff --git a/backend/windmill-worker/src/ai/utils.rs b/backend/windmill-worker/src/ai/utils.rs index 17b6f9fce0..41da22c6a9 100644 --- a/backend/windmill-worker/src/ai/utils.rs +++ b/backend/windmill-worker/src/ai/utils.rs @@ -1,4 +1,5 @@ -use crate::ai::types::{ToolDef, ToolDefFunction}; +pub use crate::ai::types::McpToolSource; +use crate::ai::types::ToolDef; use anyhow::Context; use serde_json::value::RawValue; use sqlx::types::Json; @@ -7,6 +8,7 @@ use std::{ sync::Arc, }; use uuid::Uuid; +use windmill_common::flows::FlowModuleValue; use windmill_common::{ ai_providers::AIProvider, db::DB, @@ -18,10 +20,8 @@ use windmill_common::{ scripts::{ScriptHash, ScriptLang}, worker::to_raw_value, }; -use windmill_common::{ - flows::FlowModuleValue, - mcp_client::{McpClient, McpResource, McpTool, McpToolSource}, -}; +#[cfg(feature = "mcp")] +use windmill_mcp::{McpClient, McpResource, McpTool}; use windmill_queue::{flow_status::get_step_of_flow_status, MiniPulledJob}; use crate::{ai::types::*, parse_sig_of_lang}; @@ -322,6 +322,7 @@ pub fn should_use_structured_output_tool(provider: &AIProvider, model: &str) -> } /// Cleanup MCP clients by gracefully shutting down connections +#[cfg(feature = "mcp")] pub async fn cleanup_mcp_clients(mcp_clients: HashMap>) { if mcp_clients.is_empty() { return; @@ -351,6 +352,7 @@ pub async fn cleanup_mcp_clients(mcp_clients: HashMap>) { } /// Convert raw MCP tools to Windmill Tool format with source tracking +#[cfg(feature = "mcp")] fn convert_mcp_tools_to_windmill_tools( mcp_tools: &[McpTool], resource_name: &str, @@ -396,6 +398,7 @@ fn convert_mcp_tools_to_windmill_tools( } /// Configuration for loading tools from an MCP server resource +#[cfg(feature = "mcp")] #[derive(Debug, Clone)] pub struct McpResourceConfig { pub resource_path: String, @@ -408,6 +411,7 @@ pub struct McpResourceConfig { /// - If include_tools is Some and non-empty: whitelist approach (keep only listed tools) /// - Else if exclude_tools is Some and non-empty: blacklist approach (remove listed tools) /// - Otherwise: no filtering (keep all tools) +#[cfg(feature = "mcp")] fn apply_tool_filters( tools: Vec, include_tools: &Option>, @@ -449,6 +453,7 @@ fn apply_tool_filters( /// Load tools from MCP servers and return both the clients and tools /// Returns a map of resource name -> client, and a vector of tools +#[cfg(feature = "mcp")] pub async fn load_mcp_tools( db: &DB, workspace_id: &str, @@ -517,6 +522,7 @@ pub async fn load_mcp_tools( } /// Execute an MCP tool by routing the call to the appropriate MCP client +#[cfg(feature = "mcp")] pub async fn execute_mcp_tool( mcp_clients: &HashMap>, mcp_source: &McpToolSource, @@ -539,6 +545,39 @@ pub async fn execute_mcp_tool( Ok(result) } +// Stub implementations when mcp feature is not enabled +#[cfg(not(feature = "mcp"))] +pub struct McpResourceConfig {} + +/// Stub for cleanup_mcp_clients when mcp is not enabled +#[cfg(not(feature = "mcp"))] +pub async fn cleanup_mcp_clients(_mcp_clients: HashMap>) { + // No-op when MCP is disabled +} + +/// Stub for load_mcp_tools when mcp is not enabled +#[cfg(not(feature = "mcp"))] +pub async fn load_mcp_tools( + _db: &DB, + _workspace_id: &str, + _mcp_configs: Vec, +) -> Result<(HashMap>, Vec), Error> { + Ok((HashMap::new(), Vec::new())) +} + +/// Stub for execute_mcp_tool when mcp is not enabled +#[cfg(not(feature = "mcp"))] +pub async fn execute_mcp_tool( + _mcp_clients: &HashMap>, + mcp_source: &McpToolSource, + _arguments_str: &str, +) -> Result { + Err(Error::internal_err(format!( + "MCP support is not enabled. Cannot execute MCP tool: {}", + mcp_source.tool_name + ))) +} + /// Check if any tool's input transforms reference previous_result pub fn any_tool_needs_previous_result(tools: &[Tool]) -> bool { tools.iter().any(|tool| { diff --git a/backend/windmill-worker/src/ai_executor.rs b/backend/windmill-worker/src/ai_executor.rs index 9e4145274e..9e981556b1 100644 --- a/backend/windmill-worker/src/ai_executor.rs +++ b/backend/windmill-worker/src/ai_executor.rs @@ -13,7 +13,11 @@ use regex::Regex; use serde_json::value::RawValue; use std::{collections::HashMap, sync::Arc}; use uuid::Uuid; -use windmill_common::mcp_client::McpClient; +#[cfg(feature = "mcp")] +use windmill_mcp::McpClient; + +#[cfg(not(feature = "mcp"))] +use crate::ai::tools::McpClientStub as McpClient; use windmill_common::{ ai_providers::AIProvider, cache, @@ -149,24 +153,34 @@ pub async fn handle_ai_agent_job( // Separate Windmill tools from MCP tools, websearch, and extract MCP resource configs let mut windmill_modules: Vec = Vec::new(); + #[allow(unused_mut)] let mut mcp_configs: Vec = Vec::new(); let mut has_websearch = false; for tool in tools { match &tool.value { + #[allow(unused_variables)] ToolValue::Mcp(mcp_config) => { - // This is an MCP tool - extract config - tracing::debug!( - "MCP server module: path={}, include={:?}, exclude={:?}", - mcp_config.resource_path, - mcp_config.include_tools, - mcp_config.exclude_tools - ); - mcp_configs.push(crate::ai::utils::McpResourceConfig { - resource_path: mcp_config.resource_path.clone(), - include_tools: Some(mcp_config.include_tools.clone()), - exclude_tools: Some(mcp_config.exclude_tools.clone()), - }); + #[cfg(feature = "mcp")] + { + // This is an MCP tool - extract config + tracing::debug!( + "MCP server module: path={}, include={:?}, exclude={:?}", + mcp_config.resource_path, + mcp_config.include_tools, + mcp_config.exclude_tools + ); + mcp_configs.push(crate::ai::utils::McpResourceConfig { + resource_path: mcp_config.resource_path.clone(), + include_tools: Some(mcp_config.include_tools.clone()), + exclude_tools: Some(mcp_config.exclude_tools.clone()), + }); + } + + #[cfg(not(feature = "mcp"))] + { + tracing::warn!("MCP tool detected but MCP feature is not enabled"); + } } ToolValue::FlowModule(_) => { // Regular Windmill flow module (script, flow, etc.) - convert to FlowModule @@ -299,6 +313,7 @@ pub async fn handle_ai_agent_job( // Load MCP tools if configured let mut tools = tools; + let mcp_clients = if !mcp_configs.is_empty() { let (clients, mcp_tools) = load_mcp_tools(db, &job.workspace_id, mcp_configs).await?; tools.extend(mcp_tools); diff --git a/benchmarks/lib.ts b/benchmarks/lib.ts index 7e7776c9eb..9a5d4f396b 100644 --- a/benchmarks/lib.ts +++ b/benchmarks/lib.ts @@ -2,7 +2,7 @@ import { sleep } from "https://deno.land/x/sleep@v1.2.1/mod.ts"; import * as windmill from "https://deno.land/x/windmill@v1.174.0/mod.ts"; import * as api from "https://deno.land/x/windmill@v1.174.0/windmill-api/index.ts"; -export const VERSION = "v1.602.0"; +export const VERSION = "v1.603.0"; export async function login(email: string, password: string): Promise { return await windmill.UserService.login({ diff --git a/cli/src/main.ts b/cli/src/main.ts index 43cc801cd6..b5779e0172 100644 --- a/cli/src/main.ts +++ b/cli/src/main.ts @@ -70,7 +70,7 @@ export { // } // }); -export const VERSION = "1.602.0"; +export const VERSION = "1.603.0"; // Re-exported from constants.ts to maintain backwards compatibility export { WM_FORK_PREFIX } from "./core/constants.ts"; diff --git a/docker-compose.yml b/docker-compose.yml index a6d96aaec9..df118357d2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,6 +68,8 @@ services: - DATABASE_URL=${DATABASE_URL} - MODE=worker - WORKER_GROUP=default + # If running with non-root/non-windmill UID (e.g., user: "1001:1001"), + # add: - HOME=/tmp # Uncomment to enable PID namespace isolation (requires privileged: true above) # - ENABLE_UNSHARE_PID=true depends_on: diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a3b2eb81f8..a997de306f 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "windmill-components", - "version": "1.602.0", + "version": "1.603.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "windmill-components", - "version": "1.602.0", + "version": "1.603.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/frontend/package.json b/frontend/package.json index 94890ea18e..7c173629e7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "windmill-components", - "version": "1.602.0", + "version": "1.603.0", "scripts": { "dev": "vite dev", "build": "vite build", diff --git a/frontend/src/lib/components/Login.svelte b/frontend/src/lib/components/Login.svelte index 617d494189..5d3fc0b898 100644 --- a/frontend/src/lib/components/Login.svelte +++ b/frontend/src/lib/components/Login.svelte @@ -84,6 +84,7 @@ let showPassword = $state(false) let logins: OAuthLogin[] | undefined = $state(undefined) let saml: string | undefined = $state(undefined) + let smtpConfigured: boolean | undefined = $state(undefined) type OAuthLogin = { type: string @@ -194,6 +195,17 @@ loadLogins() + async function checkSmtpConfigured() { + try { + smtpConfigured = await UserService.isSmtpConfigured() + } catch (err) { + console.error('Could not check if SMTP is configured', err) + smtpConfigured = false + } + } + + checkSmtpConfigured() + function handleKeyUp(event: KeyboardEvent) { const key = event.key @@ -372,6 +384,16 @@ autocomplete="current-password" /> + {#if smtpConfigured} + + {/if}
diff --git a/frontend/src/lib/components/sidebar/OperatorMenu.svelte b/frontend/src/lib/components/sidebar/OperatorMenu.svelte index 63f7773d8a..8f2688898d 100644 --- a/frontend/src/lib/components/sidebar/OperatorMenu.svelte +++ b/frontend/src/lib/components/sidebar/OperatorMenu.svelte @@ -34,7 +34,7 @@ import { Menu, Menubar, MenuItem } from '$lib/components/meltComponents' import MenuButton, { sidebarClasses } from './MenuButton.svelte' import MenuLink from './MenuLink.svelte' - import { onDestroy } from 'svelte' + import ResizeTransitionWrapper from '../common/ResizeTransitionWrapper.svelte' let darkMode: boolean = $state(false) interface Props { @@ -78,7 +78,13 @@ ) ) - let secondMenuLinks = $derived( + type SecondMenuLink = { label: string; id: string; href: string } + function filterLink(link: SecondMenuLink) { + if (!$userWorkspaces || !$workspaceStore) return false + let userWorkspace = $userWorkspaces.find((_) => _.id === $workspaceStore) + return userWorkspace?.operator_settings?.[link.id] === true + } + let secondMenuLinks: SecondMenuLink[] = $derived( [ { label: 'Resources', @@ -95,6 +101,25 @@ id: 'assets', href: `${base}/assets` }, + { + label: 'Groups', + id: 'groups', + href: `${base}/groups` + }, + { + label: 'Folders', + id: 'folders', + href: `${base}/folders` + }, + { + label: 'Workers', + id: 'workers', + href: `${base}/workers` + } + ].filter(filterLink) + ) + let secondMenuTriggerLinks = $derived( + [ { label: 'Custom HTTP routes', id: 'triggers', @@ -144,52 +169,15 @@ label: 'Audit logs', id: 'audit_logs', href: `${base}/audit_logs` - }, - { - label: 'Groups', - id: 'groups', - href: `${base}/groups` - }, - { - label: 'Folders', - id: 'folders', - href: `${base}/folders` - }, - { - label: 'Workers', - id: 'workers', - href: `${base}/workers` } - ].filter((link) => { - if (!$userWorkspaces || !$workspaceStore) return false - return ( - $userWorkspaces.find((_) => _.id === $workspaceStore)?.operator_settings?.[link.id] === true - ) - }) + ].filter(filterLink) ) - - let moreOpen = $state(false) - let moreOpenTimeout: number | undefined = $state() - - function debouncedSetMoreOpen(value: boolean) { - if (moreOpenTimeout) { - clearTimeout(moreOpenTimeout) - } - moreOpenTimeout = setTimeout(() => { - moreOpen = value - }, 150) // 150ms debounce - } - - onDestroy(() => { - if (moreOpenTimeout) { - clearTimeout(moreOpenTimeout) - } - }) + let showMore = $state(false) {#snippet children({ createMenu })} - + (showMore = false)}> {#snippet triggr({ trigger })} logout()} class={twMerge( 'flex flex-row gap-3.5 items-center px-2 py-2 w-full', - 'text-secondary text-xs', - 'hover:bg-surface-hover hover:text-primary cursor-pointer', + 'text-primary text-xs', + 'hover:bg-surface-hover cursor-pointer', 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-primary' )} {item} @@ -315,57 +303,42 @@ Sign out
-
debouncedSetMoreOpen(true)} - onmouseleave={() => debouncedSetMoreOpen(false)} - role="none" - > - debouncedSetMoreOpen(true)} - onFocusOut={() => debouncedSetMoreOpen(false)} - {item} - > - {#if !moreOpen || secondMenuLinks.length === 0} -
More...
- {/if} -
- {#if moreOpen && secondMenuLinks.length > 0} - {#each secondMenuLinks as menuLink (menuLink.href ?? menuLink.label)} -
- debouncedSetMoreOpen(true)} - onFocusOut={() => debouncedSetMoreOpen(false)} - > - {menuLink.label} - -
- {/each} +
(showMore = false)} role="none"> + {#if secondMenuLinks.length} + + {#if !showMore} +
(showMore = true)} role="none"> + +
More...
+
+
+ {:else} + {#snippet renderSecondMenuLinks(menuLinks: SecondMenuLink[])} + {#each menuLinks as menuLink (menuLink.href ?? menuLink.label)} + + {menuLink.label} + + {/each} + {/snippet} +
+
{@render renderSecondMenuLinks(secondMenuLinks)}
+
{@render renderSecondMenuLinks(secondMenuTriggerLinks)}
+
+ {/if} +
+ {/if} + {#if $enterpriseLicense} + {/if}
- {#if $enterpriseLicense} -
{ - if (moreOpenTimeout) { - setTimeout(() => { - clearTimeout(moreOpenTimeout) - }, 15) - } - }} - onmouseleave={() => { - debouncedSetMoreOpen(false) - }} - role="none" - > - -
- {/if} {/snippet} {/snippet} diff --git a/frontend/src/lib/components/table/DataTable.svelte b/frontend/src/lib/components/table/DataTable.svelte index ea154fa5b5..c50395b089 100644 --- a/frontend/src/lib/components/table/DataTable.svelte +++ b/frontend/src/lib/components/table/DataTable.svelte @@ -35,6 +35,7 @@ neverShowLoader?: boolean loading?: boolean loadingMore?: boolean + containerClass?: string children?: import('svelte').Snippet emptyMessage?: import('svelte').Snippet } @@ -59,6 +60,7 @@ neverShowLoader = false, loading = false, loadingMore = false, + containerClass = '', children, emptyMessage }: Props = $props() @@ -119,7 +121,8 @@ class={twMerge( 'h-full', rounded ? 'rounded-md overflow-hidden' : '', - noBorder ? 'border-0' : 'border' + noBorder ? 'border-0' : 'border', + containerClass )} bind:clientHeight={tableHeight} > diff --git a/frontend/src/lib/components/workspaceSettings/DucklakeSettings.svelte b/frontend/src/lib/components/workspaceSettings/DucklakeSettings.svelte index 173c156044..616d3c68e6 100644 --- a/frontend/src/lib/components/workspaceSettings/DucklakeSettings.svelte +++ b/frontend/src/lib/components/workspaceSettings/DucklakeSettings.svelte @@ -352,18 +352,12 @@ class="cursor-not-allowed" > - + Please save settings first {:else} diff --git a/frontend/src/lib/components/workspaceSettings/StorageSettings.svelte b/frontend/src/lib/components/workspaceSettings/StorageSettings.svelte index 69514e819c..75f5da9ddb 100644 --- a/frontend/src/lib/components/workspaceSettings/StorageSettings.svelte +++ b/frontend/src/lib/components/workspaceSettings/StorageSettings.svelte @@ -1,11 +1,9 @@ @@ -82,140 +128,127 @@
{/if} {#if s3ResourceSettings} -
-
- - - - - - - - - -
-
- - - - {@render permissionBtn(s3ResourceSettings)} - -
-
+ + + + {#each tableHeadNames as name, i} + + {name} + {#if tableHeadTooltips[name]} + {@html tableHeadTooltips[name]} + {/if} + + {/each} + + + + {#each tableRows as tableRow, idx} + + + {#if tableRow[0] === null} + + {:else} + + {/if} + + +
+
+ s3ResourceSettings.secondaryStorage?.[idx]?.[1].resourceType || 's3', - (v) => { - if (s3ResourceSettings.secondaryStorage?.[idx]) { - s3ResourceSettings.secondaryStorage[idx][1].resourceType = v - } - } - } - items={[ - { value: 's3', label: 'S3' }, - { value: 'azure_blob', label: 'Azure Blob' }, - { value: 's3_aws_oidc', label: 'AWS OIDC' }, - { value: 'azure_workload_identity', label: 'Azure Workload Identity' }, - { value: 'gcloud_storage', label: 'Google Cloud Storage' } - ]} - /> - - s3ResourceSettings.secondaryStorage?.[idx]?.[1].resourcePath || undefined, - (v) => { - if (s3ResourceSettings.secondaryStorage?.[idx]) { - s3ResourceSettings.secondaryStorage[idx][1].resourcePath = v - } - } - } - /> - {@render permissionBtn(s3ResourceSettings.secondaryStorage![idx][1])} - - { - if (s3ResourceSettings.secondaryStorage) { - s3ResourceSettings.secondaryStorage.splice(idx, 1) - s3ResourceSettings.secondaryStorage = [...s3ResourceSettings.secondaryStorage] - } - }} - /> -
+ +
+ {@render permissionBtn(tableRow[1])} + {#if emptyString(tableRow[1].resourcePath) || isDirty(tableRow[0])} + + + + + Please save settings first + + {:else} + + {/if} +
+
+ + {#if tableRow[0] !== null} + { + if (s3ResourceSettings.secondaryStorage) { + s3ResourceSettings.secondaryStorage.splice(idx - 1, 1) + s3ResourceSettings.secondaryStorage = [...s3ResourceSettings.secondaryStorage] + } + }} + /> + {/if} + + {/each} -
- - - Secondary storage is a feature that allows you to read and write from storage that isn't - your main storage by specifying it in the s3 object as "secondary_storage" with the name - of it - -
-
- + + +
+ +
+
+
+ +
+
diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index 5b6c6e2ce7..10c26c8536 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -1960,3 +1960,28 @@ export function countChars(str: string, char: string): number { export function onlyAlphaNumAndUnderscore(str: string): string { return str.replace(/[^a-zA-Z0-9_]/g, '') } + +export function buildReactiveObj(fields: { + [name in keyof T]: [() => T[name], (v: T[name]) => void] +}): T { + const obj = {} as T + for (const key in fields) { + Object.defineProperty(obj, key, { + get: fields[key][0], + set: fields[key][1], + enumerable: true, + configurable: true + }) + } + return obj +} + +export function pick(obj: T, keys: K[]): Pick { + const result = {} as Pick + for (const key of keys) { + if (key in obj) { + result[key] = obj[key] + } + } + return result +} diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte index ba96caaca0..1227746277 100644 --- a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte @@ -120,7 +120,7 @@ publicResource: undefined, secondaryStorage: undefined }) - let initialS3ResourceSettings: S3ResourceSettings = $state({ + let s3ResourceSavedSettings: S3ResourceSettings = $state({ resourceType: 's3', resourcePath: undefined, publicResource: undefined, @@ -353,7 +353,7 @@ settings.large_file_storage, !!$enterpriseLicense ) - initialS3ResourceSettings = clone(s3ResourceSettings) + s3ResourceSavedSettings = clone(s3ResourceSettings) dataTableSettings = convertDataTableSettingsFromBackend(settings.datatable) ducklakeSettings = convertDucklakeSettingsFromBackend(settings.ducklake) ducklakeSavedSettings = clone(ducklakeSettings) @@ -580,7 +580,7 @@ } const savedValue = { - s3ResourceSettings: initialS3ResourceSettings, + s3ResourceSettings: s3ResourceSavedSettings, ducklakeSettings: ducklakeSavedSettings } @@ -594,7 +594,7 @@ // Function to discard unsaved storage settings changes function discardStorageSettingsChanges() { - s3ResourceSettings = clone(initialS3ResourceSettings) + s3ResourceSettings = clone(s3ResourceSavedSettings) ducklakeSettings = clone(ducklakeSavedSettings) } @@ -1203,8 +1203,9 @@ {:else if tab == 'windmill_lfs'} { - initialS3ResourceSettings = clone(s3ResourceSettings) + s3ResourceSavedSettings = clone(s3ResourceSettings) }} /> + import { goto } from '$lib/navigation' + import { WindmillIcon } from '$lib/components/icons' + import DarkModeToggle from '$lib/components/sidebar/DarkModeToggle.svelte' + import Button from '$lib/components/common/button/Button.svelte' + import { sendUserToast } from '$lib/toast' + import { UserService } from '$lib/gen' + import LoginPageHeader from '$lib/components/LoginPageHeader.svelte' + import { enterpriseLicense, whitelabelNameStore } from '$lib/stores' + + let email = $state('') + let loading = $state(false) + let submitted = $state(false) + + async function requestPasswordReset() { + if (!email) { + sendUserToast('Please enter your email address', true) + return + } + + loading = true + try { + await UserService.requestPasswordReset({ requestBody: { email } }) + submitted = true + sendUserToast('If an account with that email exists, a password reset link has been sent.') + } catch (err: any) { + if (err?.body?.includes('SMTP is not configured')) { + sendUserToast('Password reset is not available. SMTP is not configured.', true) + } else { + sendUserToast('An error occurred. Please try again later.', true) + } + } finally { + loading = false + } + } + + function handleKeyUp(event: KeyboardEvent) { + if (event.key === 'Enter') { + event.preventDefault() + requestPasswordReset() + } + } + + +
+ +
+
+ {#if !$enterpriseLicense || !$whitelabelNameStore} + + {/if} +
+

+ Reset password +

+

+ Enter your email address and we'll send you a link to reset your password +

+
+ +
+
+ +
+
+ {#if submitted} +
+

+ If an account with that email exists, we've sent a password reset link. +

+

+ Please check your email and follow the instructions to reset your password. +

+
+ +
+
+ {:else} +
+
+ +
+ +
+
+ +
+ + +
+
+ {/if} +
+
+
diff --git a/frontend/src/routes/user/reset-password/+page.svelte b/frontend/src/routes/user/reset-password/+page.svelte new file mode 100644 index 0000000000..7299a079b9 --- /dev/null +++ b/frontend/src/routes/user/reset-password/+page.svelte @@ -0,0 +1,147 @@ + + +
+ +
+
+ {#if !$enterpriseLicense || !$whitelabelNameStore} + + {/if} +
+

+ {success ? 'Password Reset' : 'Set New Password'} +

+ {#if !success} +

Enter your new password below

+ {/if} +
+ +
+
+ +
+
+ {#if !token} +
+

Invalid or missing reset token.

+
+ +
+
+ {:else if success} +
+

Your password has been reset successfully.

+

You can now log in with your new password.

+
+ +
+
+ {:else} +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + +
+
+ {/if} +
+
+
diff --git a/lsp/Pipfile b/lsp/Pipfile index 4b917d0590..e9836cde25 100644 --- a/lsp/Pipfile +++ b/lsp/Pipfile @@ -4,8 +4,8 @@ verify_ssl = true name = "pypi" [packages] -wmill = ">=1.602.0" -wmill_pg = ">=1.602.0" +wmill = ">=1.603.0" +wmill_pg = ">=1.603.0" sendgrid = "*" mysql-connector-python = "*" pymongo = "*" diff --git a/openflow.openapi.yaml b/openflow.openapi.yaml index cdf3169411..6b4cfa8195 100644 --- a/openflow.openapi.yaml +++ b/openflow.openapi.yaml @@ -1,7 +1,7 @@ openapi: '3.0.3' info: - version: 1.602.0 + version: 1.603.0 title: OpenFlow Spec contact: name: Ruben Fiszel diff --git a/powershell-client/WindmillClient/WindmillClient.psd1 b/powershell-client/WindmillClient/WindmillClient.psd1 index 31429ddc95..85cab89a08 100644 --- a/powershell-client/WindmillClient/WindmillClient.psd1 +++ b/powershell-client/WindmillClient/WindmillClient.psd1 @@ -12,7 +12,7 @@ RootModule = 'WindmillClient.psm1' # Version number of this module. - ModuleVersion = '1.602.0' + ModuleVersion = '1.603.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/python-client/wmill/pyproject.toml b/python-client/wmill/pyproject.toml index 8fd8e2bc4a..7250f85807 100644 --- a/python-client/wmill/pyproject.toml +++ b/python-client/wmill/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "wmill" -version = "1.602.0" +version = "1.603.0" description = "A client library for accessing Windmill server wrapping the Windmill client API" license = "Apache-2.0" homepage = "https://windmill.dev" diff --git a/python-client/wmill_pg/pyproject.toml b/python-client/wmill_pg/pyproject.toml index d41a10ee95..a4ab8db7ec 100644 --- a/python-client/wmill_pg/pyproject.toml +++ b/python-client/wmill_pg/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "wmill-pg" -version = "1.602.0" +version = "1.603.0" description = "An extension client for the wmill client library focused on pg" license = "Apache-2.0" homepage = "https://windmill.dev" diff --git a/typescript-client/jsr.json b/typescript-client/jsr.json index cd95c1d909..fc0fcb0cf7 100644 --- a/typescript-client/jsr.json +++ b/typescript-client/jsr.json @@ -1,6 +1,6 @@ { "name": "@windmill/windmill", - "version": "1.602.0", + "version": "1.603.0", "exports": "./src/index.ts", "publish": { "exclude": ["!src", "./s3Types.ts", "./sqlUtils.ts", "./client.ts"] diff --git a/typescript-client/package.json b/typescript-client/package.json index 57310e2040..b706898edc 100644 --- a/typescript-client/package.json +++ b/typescript-client/package.json @@ -1,7 +1,7 @@ { "name": "windmill-client", "description": "Windmill SDK client for browsers and Node.js", - "version": "1.602.0", + "version": "1.603.0", "author": "Ruben Fiszel", "license": "Apache 2.0", "devDependencies": { diff --git a/version.txt b/version.txt index f73fe67481..2112774555 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.602.0 +1.603.0