diff --git a/Cargo.lock b/Cargo.lock index b21dabae..ce9eb625 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,9 +65,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -102,11 +102,23 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" +[[package]] +name = "anstyle" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" + [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "askama" @@ -146,7 +158,7 @@ dependencies = [ "humansize", "mime", "mime_guess", - "nom", + "nom 7.1.3", "num-traits", "percent-encoding 2.2.0", "proc-macro2", @@ -162,7 +174,7 @@ version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0b2340f55d9661d76793b2bfc2eb0e62689bd79d067a95707ea762afd5e9dd" dependencies = [ - "anstyle", + "anstyle 0.3.5", "bstr", "doc-comment", "predicates", @@ -177,6 +189,19 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-compression" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0122885821398cc923ece939e24d1056a2384ee719432397fa9db87230ff11" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio 1.26.0", +] + [[package]] name = "atty" version = "0.2.14" @@ -218,6 +243,15 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base64" version = "0.10.1" @@ -233,12 +267,36 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "bitvec" +version = "0.19.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55f93d0ef3363c364d5976646a38f04cf67cfe1d4c8d160cdea02cab2c116b33" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -256,7 +314,7 @@ checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", "once_cell", - "regex-automata", + "regex-automata 0.1.10", "serde", ] @@ -380,7 +438,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim", "textwrap 0.11.0", "unicode-width", @@ -389,36 +447,42 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.13" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c911b090850d79fc64fe9ea01e28e465f65e821e08813ced95bced72f7a8a9b" +checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", - "clap_lex", "once_cell", ] +[[package]] +name = "clap_builder" +version = "4.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" +dependencies = [ + "anstyle 1.0.1", + "clap_lex", +] + [[package]] name = "clap_derive" -version = "4.1.12" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a932373bab67b984c790ddf2c9ca295d8e3af3b7ef92de5a5bacdccdee4b09b" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.23", ] [[package]] name = "clap_lex" -version = "0.3.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646" -dependencies = [ - "os_str_bytes", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "cloudabi" @@ -426,7 +490,7 @@ version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -456,7 +520,7 @@ dependencies = [ "powershell_script 0.2.1", "prettytable-rs", "rand_core 0.6.4", - "reqwest", + "reqwest 0.9.24", "rpassword", "rusty-hook", "serde", @@ -495,7 +559,7 @@ name = "cloudtruth-installer" version = "1.2.3" dependencies = [ "powershell_script 1.0.4", - "reqwest", + "reqwest 0.9.24", "serde_json", "tempfile", ] @@ -504,13 +568,37 @@ dependencies = [ name = "cloudtruth-restapi" version = "1.0.0" dependencies = [ - "reqwest", + "reqwest 0.9.24", "serde", "serde_derive", "serde_json", "url 2.3.1", ] +[[package]] +name = "cloudtruth-sdk" +version = "0.1.0" +dependencies = [ + "once_cell", + "reqwest 0.11.18", +] + +[[package]] +name = "cloudtruth-sdk-codegen" +version = "0.1.0" +dependencies = [ + "color-eyre 0.6.2", + "dyn-clone", + "http 0.2.9", + "indexmap 1.9.2", + "openapiv3", + "proc-macro2", + "quote", + "rfc6570-level-2", + "serde_json", + "syn 2.0.23", +] + [[package]] name = "cloudtruth-test-harness" version = "1.2.3" @@ -541,7 +629,7 @@ version = "1.2.3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.23", ] [[package]] @@ -624,7 +712,7 @@ version = "0.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7b3e3c41e9488eeda196b6806dbf487742107d61b2e16485bcca6c25ed5755b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "concolor-query", "is-terminal", ] @@ -920,7 +1008,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ "cfg-if 1.0.0", - "hashbrown", + "hashbrown 0.12.3", "lock_api 0.4.9", "once_cell", "parking_lot_core 0.9.7", @@ -1054,6 +1142,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +[[package]] +name = "dyn-clone" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" + [[package]] name = "edit" version = "0.1.4" @@ -1105,19 +1199,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059" dependencies = [ "fsio", - "indexmap", + "indexmap 1.9.2", ] [[package]] -name = "errno" -version = "0.2.8" +name = "equivalent" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi 0.3.9", -] +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" [[package]] name = "errno" @@ -1260,7 +1349,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" dependencies = [ - "bitflags", + "bitflags 1.3.2", "fuchsia-zircon-sys", ] @@ -1270,6 +1359,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + [[package]] name = "futures" version = "0.1.31" @@ -1303,9 +1398,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-cpupool" @@ -1437,14 +1532,33 @@ dependencies = [ "bytes 0.4.12", "fnv", "futures 0.1.31", - "http", - "indexmap", + "http 0.1.21", + "indexmap 1.9.2", "log", "slab", "string", "tokio-io", ] +[[package]] +name = "h2" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +dependencies = [ + "bytes 1.4.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.9", + "indexmap 1.9.2", + "slab", + "tokio 1.26.0", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1454,6 +1568,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "heck" version = "0.4.1" @@ -1521,6 +1641,17 @@ dependencies = [ "itoa 0.4.8", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes 1.4.0", + "fnv", + "itoa 1.0.5", +] + [[package]] name = "http-body" version = "0.1.0" @@ -1529,16 +1660,33 @@ checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" dependencies = [ "bytes 0.4.12", "futures 0.1.31", - "http", + "http 0.1.21", "tokio-buf", ] +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes 1.4.0", + "http 0.2.9", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + [[package]] name = "humansize" version = "1.1.1" @@ -1570,9 +1718,9 @@ dependencies = [ "bytes 0.4.12", "futures 0.1.31", "futures-cpupool", - "h2", - "http", - "http-body", + "h2 0.1.26", + "http 0.1.21", + "http-body 0.1.0", "httparse", "iovec", "itoa 0.4.8", @@ -1588,7 +1736,45 @@ dependencies = [ "tokio-tcp", "tokio-threadpool", "tokio-timer", - "want", + "want 0.2.0", +] + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes 1.4.0", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.20", + "http 0.2.9", + "http-body 0.4.5", + "httparse", + "httpdate", + "itoa 1.0.5", + "pin-project-lite", + "socket2", + "tokio 1.26.0", + "tower-service", + "tracing", + "want 0.3.1", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http 0.2.9", + "hyper 0.14.27", + "rustls", + "tokio 1.26.0", + "tokio-rustls", ] [[package]] @@ -1599,11 +1785,24 @@ checksum = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f" dependencies = [ "bytes 0.4.12", "futures 0.1.31", - "hyper", + "hyper 0.12.36", "native-tls", "tokio-io", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes 1.4.0", + "hyper 0.14.27", + "native-tls", + "tokio 1.26.0", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.53" @@ -1673,7 +1872,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg 1.1.0", - "hashbrown", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -1716,16 +1926,21 @@ dependencies = [ "libc", ] +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + [[package]] name = "is-terminal" -version = "0.4.3" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.36.8", - "windows-sys 0.45.0", + "rustix 0.38.3", + "windows-sys 0.48.0", ] [[package]] @@ -1800,11 +2015,24 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lexical-core" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "ryu", + "static_assertions", +] + [[package]] name = "libc" -version = "0.2.139" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "link-cplusplus" @@ -1823,15 +2051,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" [[package]] name = "linux-raw-sys" -version = "0.3.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "lock_api" @@ -1914,11 +2142,12 @@ dependencies = [ [[package]] name = "miette" -version = "5.6.0" +version = "5.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07749fb52853e739208049fb513287c6f448de9103dfa78b05ae01f2fc5809bb" +checksum = "a236ff270093b0b67451bc50a509bd1bad302cb1d3c7d37d5efe931238581fa9" dependencies = [ "backtrace", + "backtrace-ext", "is-terminal", "miette-derive", "once_cell", @@ -1934,13 +2163,13 @@ dependencies = [ [[package]] name = "miette-derive" -version = "5.6.0" +version = "5.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a07ad93a80d1b92bb44cb42d7c49b49c9aab1778befefad49cceb5e4c5bf460" +checksum = "4901771e1d44ddb37964565c654a3223ba41a594d02b8da471cc4464912b5cfa" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.23", ] [[package]] @@ -1993,6 +2222,18 @@ dependencies = [ "winapi 0.2.8", ] +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + [[package]] name = "miow" version = "0.2.2" @@ -2046,6 +2287,19 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0" +[[package]] +name = "nom" +version = "6.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +dependencies = [ + "bitvec", + "funty", + "lexical-core", + "memchr", + "version_check", +] + [[package]] name = "nom" version = "7.1.3" @@ -2101,9 +2355,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -2111,13 +2365,24 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openapiv3" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1a9f106eb0a780abd17ba9fca8e0843e3461630bcbe2af0ad4d5d3ba4e9aa4" +dependencies = [ + "indexmap 1.9.2", + "serde", + "serde_json", +] + [[package]] name = "openssl" version = "0.10.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "foreign-types", "libc", @@ -2176,12 +2441,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "os_str_bytes" -version = "6.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" - [[package]] name = "owo-colors" version = "1.3.0" @@ -2345,7 +2604,7 @@ version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c575290b64d24745b6c57a12a31465f0a66f3a4799686a6921526a33b0797965" dependencies = [ - "anstyle", + "anstyle 0.3.5", "difflib", "float-cmp", "itertools", @@ -2386,9 +2645,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.54" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -2405,13 +2664,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" + [[package]] name = "rand" version = "0.6.5" @@ -2600,7 +2865,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2609,7 +2874,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2625,12 +2890,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.1" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", + "regex-automata 0.3.2", "regex-syntax", ] @@ -2640,11 +2906,22 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +[[package]] +name = "regex-automata" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" [[package]] name = "reqwest" @@ -2659,16 +2936,16 @@ dependencies = [ "encoding_rs", "flate2", "futures 0.1.31", - "http", - "hyper", - "hyper-tls", + "http 0.1.21", + "hyper 0.12.36", + "hyper-tls 0.3.2", "log", "mime", "mime_guess", "native-tls", "serde", "serde_json", - "serde_urlencoded", + "serde_urlencoded 0.5.5", "time", "tokio 0.1.22", "tokio-executor", @@ -2677,7 +2954,78 @@ dependencies = [ "tokio-timer", "url 1.7.2", "uuid 0.7.4", - "winreg", + "winreg 0.6.2", +] + +[[package]] +name = "reqwest" +version = "0.11.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +dependencies = [ + "async-compression", + "base64 0.21.2", + "bytes 1.4.0", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.20", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", + "hyper-rustls", + "hyper-tls 0.5.0", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding 2.2.0", + "pin-project-lite", + "rustls", + "rustls-native-certs", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded 0.7.1", + "tokio 1.26.0", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower-service", + "url 2.3.1", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.10.1", +] + +[[package]] +name = "rfc6570-level-2" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bf3499b472ff2440e1618280298a37b8b1bc15e6d494b50cdf8f400dd66edd" +dependencies = [ + "anyhow", + "itertools", + "nom 6.1.2", + "percent-encoding 2.2.0", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", ] [[package]] @@ -2716,30 +3064,72 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" dependencies = [ - "bitflags", - "errno 0.2.8", + "bitflags 1.3.2", + "errno", "io-lifetimes", "libc", - "linux-raw-sys 0.1.4", + "linux-raw-sys 0.3.1", "windows-sys 0.45.0", ] [[package]] name = "rustix" -version = "0.37.3" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" +checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" dependencies = [ - "bitflags", - "errno 0.3.1", - "io-lifetimes", + "bitflags 2.3.3", + "errno", "libc", - "linux-raw-sys 0.3.1", - "windows-sys 0.45.0", + "linux-raw-sys 0.4.3", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b19faa85ecb5197342b54f987b142fb3e30d0c90da40f80ef4fa9a726e6676ed" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -2796,13 +3186,23 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -2842,29 +3242,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "7daf513456463b42aa1d94cff7e0c24d682b429f020b9afa4f5ba5c40a22b237" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "b69b106b68bc8054f0e974e70d19984040f8a5cf9215ca82626ea4853f82c4b9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn 2.0.23", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" dependencies = [ "itoa 1.0.5", "ryu", @@ -2882,9 +3282,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -2901,13 +3301,25 @@ dependencies = [ "url 1.7.2", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa 1.0.5", + "ryu", + "serde", +] + [[package]] name = "serde_yaml" version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ - "indexmap", + "indexmap 1.9.2", "ryu", "serde", "yaml-rust", @@ -2919,7 +3331,7 @@ version = "0.9.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f82e6c8c047aa50a7328632d067bcae6ef38772a79e28daf32f735e0e4f3dd10" dependencies = [ - "indexmap", + "indexmap 1.9.2", "itoa 1.0.5", "ryu", "serde", @@ -3075,6 +3487,28 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string" version = "0.2.1" @@ -3148,9 +3582,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.12" +version = "2.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" dependencies = [ "proc-macro2", "quote", @@ -3169,6 +3603,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.5.0" @@ -3255,7 +3695,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.23", ] [[package]] @@ -3302,7 +3742,7 @@ checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" dependencies = [ "bytes 0.4.12", "futures 0.1.31", - "mio", + "mio 0.6.23", "num_cpus", "tokio-current-thread", "tokio-executor", @@ -3320,8 +3760,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" dependencies = [ "autocfg 1.1.0", + "bytes 1.4.0", + "libc", + "memchr", + "mio 0.8.8", "num_cpus", "pin-project-lite", + "socket2", "tokio-macros", "windows-sys 0.45.0", ] @@ -3379,6 +3824,16 @@ dependencies = [ "syn 1.0.107", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio 1.26.0", +] + [[package]] name = "tokio-reactor" version = "0.1.12" @@ -3389,7 +3844,7 @@ dependencies = [ "futures 0.1.31", "lazy_static", "log", - "mio", + "mio 0.6.23", "num_cpus", "parking_lot 0.9.0", "slab", @@ -3398,6 +3853,16 @@ dependencies = [ "tokio-sync", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio 1.26.0", +] + [[package]] name = "tokio-stream" version = "0.1.12" @@ -3428,7 +3893,7 @@ dependencies = [ "bytes 0.4.12", "futures 0.1.31", "iovec", - "mio", + "mio 0.6.23", "tokio-io", "tokio-reactor", ] @@ -3462,6 +3927,20 @@ dependencies = [ "tokio-executor", ] +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes 1.4.0", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio 1.26.0", + "tracing", +] + [[package]] name = "toml" version = "0.5.11" @@ -3473,26 +3952,32 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -3622,9 +4107,9 @@ checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "unicode-linebreak" @@ -3632,7 +4117,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", "regex", ] @@ -3673,6 +4158,12 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "1.7.2" @@ -3781,6 +4272,15 @@ dependencies = [ "try-lock", ] +[[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.10.0+wasi-snapshot-preview1" @@ -3818,6 +4318,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.84" @@ -4077,9 +4589,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" dependencies = [ "memchr", ] @@ -4093,6 +4605,15 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "ws2_32-sys" version = "0.2.1" @@ -4103,13 +4624,19 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + [[package]] name = "xtask" version = "0.1.0" dependencies = [ "anyhow", "askama", - "clap 4.1.13", + "clap 4.3.11", "duct", "futures 0.3.27", "itertools", diff --git a/crates/cloudtruth-sdk-codegen/Cargo.toml b/crates/cloudtruth-sdk-codegen/Cargo.toml new file mode 100644 index 00000000..9e169ff7 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "cloudtruth-sdk-codegen" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +color-eyre = "0.6.2" +http = "0.2.9" +indexmap = "1" +openapiv3 = { version = "1" } +proc-macro2 = "1.0.63" +quote = "1.0.29" +serde_json = "1.0" +syn = { version = "2.0.23", features = ["full"] } +rfc6570-level-2 = "1.2.0" +dyn-clone = "1.0.11" diff --git a/crates/cloudtruth-sdk-codegen/src/api.rs b/crates/cloudtruth-sdk-codegen/src/api.rs new file mode 100644 index 00000000..da3c8cf4 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/api.rs @@ -0,0 +1,5 @@ +mod operation; +mod spec; + +pub use operation::ApiOperation; +pub use spec::ApiSpec; diff --git a/crates/cloudtruth-sdk-codegen/src/api/operation.rs b/crates/cloudtruth-sdk-codegen/src/api/operation.rs new file mode 100644 index 00000000..35e50b27 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/api/operation.rs @@ -0,0 +1,86 @@ +use std::rc::Rc; + +use color_eyre::{eyre::eyre, Result}; +use indexmap::IndexMap; +use openapiv3::{Operation, Parameter, RequestBody, Responses}; + +use rfc6570_level_2::UriTemplate; + +#[derive(Debug, Clone)] +pub struct ApiOperation { + path_template: UriTemplate, + http_method: http::Method, + summary: Option>, + description: Option>, + operation_id: Option>, + tags: Vec>, + deprecated: bool, + request_body: Option, + parameters: Vec, + responses: Responses, + security: Option>>>, +} + +impl ApiOperation { + pub fn from_openapi(path: &str, method: &str, op: Operation) -> Result { + let Operation { + description, + summary, + operation_id, + tags, + request_body, + parameters, + responses, + deprecated, + security, + .. + } = op; + let request_body = request_body.map(|b| b.into_item().unwrap()); + let parameters: Vec = parameters + .into_iter() + .map(|p| p.into_item().unwrap()) + .collect(); + + Ok(ApiOperation { + path_template: UriTemplate::new(path).map_err(|err| eyre!(Box::new(err)))?, // convert anyhow to eyre + http_method: method.parse()?, + description: description.map(|s| Rc::from(s.as_str())), + summary: summary.map(|s| Rc::from(s.as_str())), + operation_id: operation_id.map(|s| Rc::from(s.as_str())), + tags: tags.into_iter().map(|s| Rc::from(s.as_str())).collect(), + deprecated, + request_body, + parameters, + responses, + security, + }) + } + + pub fn uri(&self) -> &str { + self.path_template.uri() + } + + pub fn http_method(&self) -> &http::Method { + &self.http_method + } + + pub fn summary(&self) -> Option<&Rc> { + self.summary.as_ref() + } + + pub fn description(&self) -> Option<&Rc> { + self.description.as_ref() + } + + pub fn operation_id(&self) -> Option<&Rc> { + self.operation_id.as_ref() + } + + pub fn tags(&self) -> &[Rc] { + self.tags.as_ref() + } + + pub fn deprecated(&self) -> bool { + self.deprecated + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/api/spec.rs b/crates/cloudtruth-sdk-codegen/src/api/spec.rs new file mode 100644 index 00000000..a1878d6e --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/api/spec.rs @@ -0,0 +1,33 @@ +use std::rc::Rc; + +use color_eyre::Result; +use openapiv3::OpenAPI; + +use crate::api::ApiOperation; + +#[derive(Debug, Clone)] +pub struct ApiSpec { + operations: Vec>, +} + +impl ApiSpec { + pub fn new(open_api: OpenAPI) -> Result { + let mut operations = open_api + .operations() + .filter(|(path, _, _)| path.starts_with("/api/v1/integrations/azure/key_vault/")) + .map(|(path, method, op)| { + Ok(Rc::new(ApiOperation::from_openapi( + path, + method, + op.clone(), + )?)) + }) + .collect::>>>()?; + operations.sort_by(|a, b| a.uri().cmp(b.uri())); + Ok(Self { operations }) + } + + pub fn operations(&self) -> &[Rc] { + &self.operations + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/generator.rs b/crates/cloudtruth-sdk-codegen/src/generator.rs new file mode 100644 index 00000000..06dd00b3 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/generator.rs @@ -0,0 +1,124 @@ +use std::rc::Rc; + +use syn::parse_quote; + +use crate::{ + api::ApiSpec, + sdk::{ + methods::{ + SdkApiMethod, SdkChildConstructor, SdkRootConstructor, SdkStaticRootConstructor, + }, + SdkObject, + }, +}; + +pub struct SdkGenerator { + spec: ApiSpec, + root_prefix: String, +} + +impl SdkGenerator { + pub fn new(spec: ApiSpec) -> Self { + Self { + spec, + root_prefix: String::new(), + } + } + + pub fn spec(&self) -> &ApiSpec { + &self.spec + } + + pub fn root_prefix(&mut self, prefix: impl Into) -> &mut Self { + self.root_prefix = prefix.into(); + self + } + + pub fn build_objects(&self) -> Vec> { + // iterator over API operations from the spec (assumed to be sorted) + let operations = self.spec.operations(); + // list of objects that we are building + let mut objects = Vec::with_capacity(operations.len()); + // a stack of ancestors from pervious iterations + let mut ancestors = Vec::with_capacity(operations.len()); + // create root SDK object + let mut root = SdkObject::new("CloudtruthSdk", None); + root.add_field("client", parse_quote![Arc]); + root.add_method(SdkRootConstructor::new(&root)); + root.add_method(SdkStaticRootConstructor::new()); + // add root to ancestor stack + ancestors.push((self.root_prefix.as_ref(), root)); + + for op in operations.iter() { + // println!(); + let uri = op.uri().trim_end_matches('/'); + // let method = op.http_method(); + // println!("{method} {uri}"); + + // find the ancestor of current path in the stack and get the descendant path segments + let descendant_path = loop { + match ancestors.last() { + Some((ancestor_prefix, _)) => match uri.strip_prefix(ancestor_prefix) { + // found ancestor, return the descendant path + Some(descendant_path) => break descendant_path, + // not an ancestor, pop from stack and append to our output list + None => objects.push(Rc::new(ancestors.pop().unwrap().1)), + }, + // no valid ancestor (unexpected behavior) + None => panic!("No ancestor found for {uri}"), + } + }; + // println!("{descendant_path:#}"); + for child_segment in descendant_path.trim_start_matches('/').split('/') { + if child_segment.is_empty() { + continue; + } + let is_path_var = child_segment.starts_with('{') && child_segment.ends_with('}'); + let name = if is_path_var { + child_segment + .chars() + .filter(|c| *c == '_' || c.is_alphanumeric()) + .collect::() + } else { + child_segment.to_string() + }; + // append this path segment to current prefix + let segment_start = child_segment.as_ptr() as usize - uri.as_ptr() as usize; + let segment_end = segment_start + child_segment.len(); + let path = &uri[..segment_end]; + // get parent object + let size = ancestors.len(); + let parent_object = ancestors.get_mut(size - 1).map(|(_, obj)| obj); + // create SDK obect for this node + let mut current_object = SdkObject::new( + path.strip_prefix(&self.root_prefix).unwrap(), + parent_object.as_deref(), + ); + // attach struct field for the path variable + if is_path_var { + current_object.add_field(&name, parse_quote![Arc]); + } + + // attach getter method to parent object + if let Some(parent_object) = parent_object { + let mut method = SdkChildConstructor::new(parent_object, ¤t_object); + if is_path_var { + method.add_arg(&name, parse_quote![impl Into>]); + } + parent_object.add_method(method); + } + + // add to ancestors stack + ancestors.push((path, current_object)); + } + let size = ancestors.len(); + if let Some((_, last_object)) = ancestors.get_mut(size - 1) { + last_object.add_method(SdkApiMethod::new(uri, op.clone())); + } + } + + // add any remaining ancestors in stack to output list + objects.extend(ancestors.into_iter().map(|(_, ancestor)| Rc::new(ancestor))); + objects + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/lib.rs b/crates/cloudtruth-sdk-codegen/src/lib.rs new file mode 100644 index 00000000..b34eece2 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/lib.rs @@ -0,0 +1,47 @@ +pub mod api; +pub mod generator; +pub mod module; +mod names; +pub mod sdk; + +use api::ApiSpec; +use color_eyre::Result; +use generator::SdkGenerator; +use module::SdkModule; +use openapiv3::OpenAPI; +use quote::quote; + +macro_rules! sdk_path { + ($($path:expr),* $(,)?) => { + std::path::Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../cloudtruth-sdk/", $($path),*)) + }; +} + +pub(crate) use sdk_path; + +/// Shorthand to quickly create an Ident with call_site macro hygiene +/// Since this is a codegen project, macro hygiene isn't very important for us(?) +macro_rules! ident { + ($path:expr) => { + proc_macro2::Ident::new(&*($path), proc_macro2::Span::call_site()) + }; +} + +pub(crate) use ident; + +pub fn generate_sdk() -> Result<()> { + let data = include_str!("../../../openapi.json"); + let open_api: OpenAPI = serde_json::from_str(data).unwrap(); + let spec = ApiSpec::new(open_api)?; + let mut generator = SdkGenerator::new(spec); + generator.root_prefix("/api/v1"); + let objects = generator.build_objects(); + SdkModule::new( + sdk_path!("src/lib.rs"), + quote! { + #(#objects )* + }, + ) + .write()?; + Ok(()) +} diff --git a/crates/cloudtruth-sdk-codegen/src/main.rs b/crates/cloudtruth-sdk-codegen/src/main.rs new file mode 100644 index 00000000..a8db262d --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/main.rs @@ -0,0 +1,5 @@ +use color_eyre::Result; +fn main() -> Result<()> { + color_eyre::install()?; + cloudtruth_sdk_codegen::generate_sdk() +} diff --git a/crates/cloudtruth-sdk-codegen/src/module.rs b/crates/cloudtruth-sdk-codegen/src/module.rs new file mode 100644 index 00000000..440b9b8e --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/module.rs @@ -0,0 +1,45 @@ +use std::{borrow::Cow, fs::File, io::Write, path::Path, process::Command}; + +use color_eyre::{eyre::Context, Result}; +use proc_macro2::TokenStream; +use quote::quote; + +#[derive(Debug, Clone)] +pub struct SdkModule { + path: Cow<'static, Path>, + tokens: TokenStream, +} + +impl SdkModule { + pub fn new(path: impl Into>, tokens: impl Into) -> Self { + SdkModule { + path: path.into(), + tokens: tokens.into(), + } + } + + fn imports(&self) -> TokenStream { + quote! { + use std::sync::Arc; + use once_cell::sync::OnceCell; + use reqwest::blocking::Client; + } + } + + pub fn write(&self) -> Result<()> { + let imports = self.imports(); + let tokens = &self.tokens; + let output = quote! { + #imports + #tokens + }; + File::create(self.path.as_ref()) + .with_context(move || format!("Could not open: {}", self.path.display()))? + .write_all(output.to_string().as_bytes())?; + Command::new("rustfmt") + .arg(self.path.as_os_str()) + .spawn()? + .wait()?; + Ok(()) + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/names.rs b/crates/cloudtruth-sdk-codegen/src/names.rs new file mode 100644 index 00000000..df8621df --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/names.rs @@ -0,0 +1,28 @@ +// Converts a URL with snake_case path segments to PascalCase. +// Forward slashes and underscores are converted to capitalized names +// braces from path variables are ignored +pub fn convert_url_to_type_name(url: &str) -> String { + let mut pascal = String::new(); + let mut capitalize = true; + for ch in url.chars() { + if ch == '{' || ch == '}' { + continue; + } else if ch == '_' || ch == '/' { + capitalize = true; + } else if capitalize { + pascal.push(ch.to_ascii_uppercase()); + capitalize = false; + } else { + pascal.push(ch); + } + } + pascal +} + +// Remove curly brackets from a path variable of them form "{name}" +// If no brackets, string is returned as-is +pub fn trim_path_var_brackets(s: &str) -> &str { + s.strip_prefix('{') + .and_then(|s| s.strip_suffix('}')) + .unwrap_or(s) +} diff --git a/crates/cloudtruth-sdk-codegen/src/sdk.rs b/crates/cloudtruth-sdk-codegen/src/sdk.rs new file mode 100644 index 00000000..3acfb2af --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/sdk.rs @@ -0,0 +1,4 @@ +pub mod methods; +mod object; + +pub use object::SdkObject; diff --git a/crates/cloudtruth-sdk-codegen/src/sdk/methods.rs b/crates/cloudtruth-sdk-codegen/src/sdk/methods.rs new file mode 100644 index 00000000..169dd960 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/sdk/methods.rs @@ -0,0 +1,23 @@ +mod api_method; +mod child_constructor; +mod root_constructors; + +pub use api_method::SdkApiMethod; +pub use child_constructor::SdkChildConstructor; +use dyn_clone::DynClone; +pub use root_constructors::{SdkRootConstructor, SdkStaticRootConstructor}; + +use proc_macro2::TokenStream; +use quote::ToTokens; + +pub trait SdkMethod: DynClone { + fn generate_fn(&self) -> syn::ItemFn; +} + +dyn_clone::clone_trait_object!(SdkMethod); + +impl ToTokens for dyn SdkMethod { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.extend(self.generate_fn().to_token_stream()) + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/sdk/methods/api_method.rs b/crates/cloudtruth-sdk-codegen/src/sdk/methods/api_method.rs new file mode 100644 index 00000000..d53cd845 --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/sdk/methods/api_method.rs @@ -0,0 +1,50 @@ +use std::rc::Rc; + +use syn::parse_quote; + +use crate::api::ApiOperation; +use crate::{ident, names}; + +use super::SdkMethod; + +#[derive(Debug, Clone)] +pub struct SdkApiMethod { + api_op: Rc, + fn_name: Rc, +} + +impl SdkApiMethod { + pub fn new(url_path: impl AsRef, api_op: impl Into>) -> Self { + let api_op = api_op.into(); + let fn_name = Self::create_method_name(url_path.as_ref(), &api_op); + SdkApiMethod { api_op, fn_name } + } + + fn create_method_name(url_path: &str, api_op: &ApiOperation) -> Rc { + let op_id_parts = api_op.operation_id().unwrap().split('_'); + let path_parts = url_path + .split(|c| c == '/' || c == '_') + .map(names::trim_path_var_brackets) + .collect::>(); + op_id_parts + .filter(|op_id_part| !path_parts.contains(op_id_part)) + .collect::>() + .join("_") + .into() + } + + fn fn_name(&self) -> &Rc { + &self.fn_name + } +} + +impl SdkMethod for SdkApiMethod { + fn generate_fn(&self) -> syn::ItemFn { + let name = ident!(self.fn_name()); + parse_quote! { + pub fn #name() { + + } + } + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/sdk/methods/child_constructor.rs b/crates/cloudtruth-sdk-codegen/src/sdk/methods/child_constructor.rs new file mode 100644 index 00000000..89e61b9b --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/sdk/methods/child_constructor.rs @@ -0,0 +1,58 @@ +use std::rc::Rc; + +use proc_macro2::Ident; +use syn::{parse_quote, Field, FnArg, Type}; + +use crate::ident; +use crate::sdk::SdkObject; + +use super::SdkMethod; + +#[derive(Clone)] +pub struct SdkChildConstructor { + fn_name: Rc, + child_type_name: Rc, + parent_fields: Vec, + args: Vec<(Ident, Type)>, +} + +impl SdkChildConstructor { + pub fn new(parent: &SdkObject, child: &SdkObject) -> Self { + Self { + fn_name: child.name().clone(), + child_type_name: child.type_name().clone(), + parent_fields: parent + .fields() + .iter() + .map(|Field { ident, .. }| ident.clone().unwrap()) + .collect(), + args: Vec::new(), + } + } + + pub fn add_arg(&mut self, arg_name: &str, arg_type: Type) { + let arg_name = ident!(arg_name); + self.args.push((arg_name, arg_type)); + } +} + +impl SdkMethod for SdkChildConstructor { + fn generate_fn(&self) -> syn::ItemFn { + let Self { + fn_name, + child_type_name, + parent_fields, + args, + } = self; + let arg_names = args.iter().map(|(name, _)| name); + let args = args + .iter() + .map::(|(name, ty)| parse_quote!( #name : #ty )); + parse_quote! { + pub fn #fn_name(&self, #(#args,)*) -> #child_type_name { + let Self { #(#parent_fields,)* } = self; + #child_type_name { #(#parent_fields: #parent_fields.clone(),)* #(#arg_names: #arg_names.into(),)* } + } + } + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/sdk/methods/root_constructors.rs b/crates/cloudtruth-sdk-codegen/src/sdk/methods/root_constructors.rs new file mode 100644 index 00000000..485892fc --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/sdk/methods/root_constructors.rs @@ -0,0 +1,53 @@ +use std::rc::Rc; + +use proc_macro2::Ident; +use syn::parse_quote; + +use crate::sdk::SdkObject; + +use super::SdkMethod; + +#[derive(Clone)] +pub struct SdkRootConstructor { + name: Rc, +} + +impl SdkRootConstructor { + pub fn new(object: &SdkObject) -> Self { + let name = object.name().clone(); + SdkRootConstructor { name } + } +} + +impl SdkMethod for SdkRootConstructor { + fn generate_fn(&self) -> syn::ItemFn { + let Self { name } = self; + parse_quote! { + fn new() -> Self { + #name { + client: Arc::new(Client::new()), + } + } + } + } +} + +#[derive(Debug, Clone, Default)] +pub struct SdkStaticRootConstructor(); + +impl SdkStaticRootConstructor { + pub fn new() -> Self { + SdkStaticRootConstructor::default() + } +} + +impl SdkMethod for SdkStaticRootConstructor { + fn generate_fn(&self) -> syn::ItemFn { + parse_quote! { + pub fn instance() -> &'static Self { + static ONCE: OnceCell = OnceCell::new(); + ONCE.get_or_init(CloudtruthSdk::new) + } + } + } +} diff --git a/crates/cloudtruth-sdk-codegen/src/sdk/object.rs b/crates/cloudtruth-sdk-codegen/src/sdk/object.rs new file mode 100644 index 00000000..03925dbf --- /dev/null +++ b/crates/cloudtruth-sdk-codegen/src/sdk/object.rs @@ -0,0 +1,100 @@ +use std::rc::Rc; + +use proc_macro2::TokenStream; +use quote::{quote, ToTokens}; + +use syn::{parse_quote, punctuated::Punctuated, token::Comma, Field, Ident, Type}; + +use crate::ident; +use crate::names; + +use super::methods::SdkMethod; + +#[derive(Clone)] +pub struct SdkObject { + name: Rc, + type_name: Rc, + fields: Punctuated, + methods: Vec>, +} + +impl SdkObject { + pub fn new(url_path: impl AsRef, parent: Option<&SdkObject>) -> Self { + let url_path = url_path.as_ref(); + let mut object = Self { + type_name: Rc::new(ident!(names::convert_url_to_type_name(url_path))), + name: Rc::new(ident!(url_path + .split('/') + .map(names::trim_path_var_brackets) + .last() + .unwrap())), + methods: Vec::new(), + fields: Punctuated::new(), + }; + // add parent fields + if let Some(parent) = parent { + for field in parent.fields() { + object.add_field_ident(field.ident.clone().unwrap(), field.ty.clone()); + } + } + object + } + + /// Returns the name as-is (usually snake_case but depends on naming convention of API) + pub fn name(&self) -> &Rc { + &self.name + } + + /// Returns the name to be used in a Rust type (i.e. PascalCase) + pub fn type_name(&self) -> &Rc { + &self.type_name + } + + pub fn methods(&self) -> &[Box] { + &self.methods + } + + pub fn add_method(&mut self, method: impl SdkMethod + 'static) -> &mut Self { + self.methods.push(Box::new(method)); + self + } + + pub fn fields(&self) -> &Punctuated { + &self.fields + } + + pub fn add_field(&mut self, name: &str, field_type: Type) -> &mut Self { + self.add_field_ident(ident!(name), field_type) + } + + pub fn add_field_ident(&mut self, ident: Ident, field_type: Type) -> &mut Self { + self.fields.push(Field { + attrs: Vec::new(), + vis: syn::Visibility::Inherited, + mutability: syn::FieldMutability::None, + ident: Some(ident), + colon_token: parse_quote![:], + ty: field_type, + }); + self + } +} + +impl ToTokens for SdkObject { + fn to_tokens(&self, tokens: &mut TokenStream) { + let SdkObject { + type_name, + methods, + fields, + .. + } = self; + tokens.extend(quote! { + pub struct #type_name { + #fields + } + impl #type_name { + #(#methods)* + } + }); + } +} diff --git a/crates/cloudtruth-sdk/Cargo.toml b/crates/cloudtruth-sdk/Cargo.toml new file mode 100644 index 00000000..f84e0b7e --- /dev/null +++ b/crates/cloudtruth-sdk/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "cloudtruth-sdk" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +once_cell = "1.18.0" +reqwest = { version = "0.11.18", features = ["rustls-tls-native-roots", "json", "gzip", "blocking"] } diff --git a/crates/cloudtruth-sdk/src/lib.rs b/crates/cloudtruth-sdk/src/lib.rs new file mode 100644 index 00000000..78b41891 --- /dev/null +++ b/crates/cloudtruth-sdk/src/lib.rs @@ -0,0 +1,505 @@ +use once_cell::sync::OnceCell; +use reqwest::blocking::Client; +use std::sync::Arc; +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkStepsId { + client: Arc, + akvintegration_pk: Arc, + akvpull_pk: Arc, + akvpulltask_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkStepsId { + pub fn retrieve() {} +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkSteps { + client: Arc, + akvintegration_pk: Arc, + akvpull_pk: Arc, + akvpulltask_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkSteps { + pub fn list() {} + pub fn id( + &self, + id: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkStepsId { + let Self { + client, + akvintegration_pk, + akvpull_pk, + akvpulltask_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkStepsId { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpull_pk: akvpull_pk.clone(), + akvpulltask_pk: akvpulltask_pk.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPk { + client: Arc, + akvintegration_pk: Arc, + akvpull_pk: Arc, + akvpulltask_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPk { + pub fn steps( + &self, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkSteps { + let Self { + client, + akvintegration_pk, + akvpull_pk, + akvpulltask_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPkSteps { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpull_pk: akvpull_pk.clone(), + akvpulltask_pk: akvpulltask_pk.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksId { + client: Arc, + akvintegration_pk: Arc, + akvpull_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksId { + pub fn retrieve() {} +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasks { + client: Arc, + akvintegration_pk: Arc, + akvpull_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasks { + pub fn list() {} + pub fn akvpulltask_pk( + &self, + akvpulltask_pk: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPk { + let Self { + client, + akvintegration_pk, + akvpull_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksAkvpulltaskPk { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpull_pk: akvpull_pk.clone(), + akvpulltask_pk: akvpulltask_pk.into(), + } + } + pub fn id( + &self, + id: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksId { + let Self { + client, + akvintegration_pk, + akvpull_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasksId { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpull_pk: akvpull_pk.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPk { + client: Arc, + akvintegration_pk: Arc, + akvpull_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPk { + pub fn tasks(&self) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasks { + let Self { + client, + akvintegration_pk, + akvpull_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPkTasks { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpull_pk: akvpull_pk.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsIdSync { + client: Arc, + akvintegration_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsIdSync { + pub fn create() {} +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPullsId { + client: Arc, + akvintegration_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPullsId { + pub fn retrieve() {} + pub fn update() {} + pub fn destroy() {} + pub fn partial_update() {} + pub fn sync(&self) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsIdSync { + let Self { + client, + akvintegration_pk, + id, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsIdSync { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + id: id.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPulls { + client: Arc, + akvintegration_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPulls { + pub fn list() {} + pub fn create() {} + pub fn akvpull_pk( + &self, + akvpull_pk: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPk { + let Self { + client, + akvintegration_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsAkvpullPk { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpull_pk: akvpull_pk.into(), + } + } + pub fn id(&self, id: impl Into>) -> IntegrationsAzureKeyVaultAkvintegrationPkPullsId { + let Self { + client, + akvintegration_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPullsId { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkStepsId { + client: Arc, + akvintegration_pk: Arc, + akvpush_pk: Arc, + akvpushtask_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkStepsId { + pub fn retrieve() {} +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkSteps { + client: Arc, + akvintegration_pk: Arc, + akvpush_pk: Arc, + akvpushtask_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkSteps { + pub fn list() {} + pub fn id( + &self, + id: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkStepsId { + let Self { + client, + akvintegration_pk, + akvpush_pk, + akvpushtask_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkStepsId { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpush_pk: akvpush_pk.clone(), + akvpushtask_pk: akvpushtask_pk.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPk { + client: Arc, + akvintegration_pk: Arc, + akvpush_pk: Arc, + akvpushtask_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPk { + pub fn steps( + &self, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkSteps { + let Self { + client, + akvintegration_pk, + akvpush_pk, + akvpushtask_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPkSteps { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpush_pk: akvpush_pk.clone(), + akvpushtask_pk: akvpushtask_pk.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksId { + client: Arc, + akvintegration_pk: Arc, + akvpush_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksId { + pub fn retrieve() {} +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasks { + client: Arc, + akvintegration_pk: Arc, + akvpush_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasks { + pub fn list() {} + pub fn akvpushtask_pk( + &self, + akvpushtask_pk: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPk { + let Self { + client, + akvintegration_pk, + akvpush_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksAkvpushtaskPk { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpush_pk: akvpush_pk.clone(), + akvpushtask_pk: akvpushtask_pk.into(), + } + } + pub fn id( + &self, + id: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksId { + let Self { + client, + akvintegration_pk, + akvpush_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasksId { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpush_pk: akvpush_pk.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPk { + client: Arc, + akvintegration_pk: Arc, + akvpush_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPk { + pub fn tasks(&self) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasks { + let Self { + client, + akvintegration_pk, + akvpush_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPkTasks { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpush_pk: akvpush_pk.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesIdSync { + client: Arc, + akvintegration_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesIdSync { + pub fn create() {} +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushesId { + client: Arc, + akvintegration_pk: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushesId { + pub fn retrieve() {} + pub fn update() {} + pub fn destroy() {} + pub fn partial_update() {} + pub fn sync(&self) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesIdSync { + let Self { + client, + akvintegration_pk, + id, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesIdSync { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + id: id.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPkPushes { + client: Arc, + akvintegration_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPkPushes { + pub fn list() {} + pub fn create() {} + pub fn akvpush_pk( + &self, + akvpush_pk: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPk { + let Self { + client, + akvintegration_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesAkvpushPk { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + akvpush_pk: akvpush_pk.into(), + } + } + pub fn id(&self, id: impl Into>) -> IntegrationsAzureKeyVaultAkvintegrationPkPushesId { + let Self { + client, + akvintegration_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushesId { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultAkvintegrationPk { + client: Arc, + akvintegration_pk: Arc, +} +impl IntegrationsAzureKeyVaultAkvintegrationPk { + pub fn pulls(&self) -> IntegrationsAzureKeyVaultAkvintegrationPkPulls { + let Self { + client, + akvintegration_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPulls { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + } + } + pub fn pushes(&self) -> IntegrationsAzureKeyVaultAkvintegrationPkPushes { + let Self { + client, + akvintegration_pk, + } = self; + IntegrationsAzureKeyVaultAkvintegrationPkPushes { + client: client.clone(), + akvintegration_pk: akvintegration_pk.clone(), + } + } +} +pub struct CloudtruthSdk { + client: Arc, +} +impl CloudtruthSdk { + fn new() -> Self { + CloudtruthSdk { + client: Arc::new(Client::new()), + } + } + pub fn instance() -> &'static Self { + static ONCE: OnceCell = OnceCell::new(); + ONCE.get_or_init(CloudtruthSdk::new) + } + pub fn integrations(&self) -> Integrations { + let Self { client } = self; + Integrations { + client: client.clone(), + } + } +} +pub struct Integrations { + client: Arc, +} +impl Integrations { + pub fn azure(&self) -> IntegrationsAzure { + let Self { client } = self; + IntegrationsAzure { + client: client.clone(), + } + } +} +pub struct IntegrationsAzure { + client: Arc, +} +impl IntegrationsAzure { + pub fn key_vault(&self) -> IntegrationsAzureKeyVault { + let Self { client } = self; + IntegrationsAzureKeyVault { + client: client.clone(), + } + } +} +pub struct IntegrationsAzureKeyVault { + client: Arc, +} +impl IntegrationsAzureKeyVault { + pub fn list() {} + pub fn create() {} + pub fn akvintegration_pk( + &self, + akvintegration_pk: impl Into>, + ) -> IntegrationsAzureKeyVaultAkvintegrationPk { + let Self { client } = self; + IntegrationsAzureKeyVaultAkvintegrationPk { + client: client.clone(), + akvintegration_pk: akvintegration_pk.into(), + } + } + pub fn id(&self, id: impl Into>) -> IntegrationsAzureKeyVaultId { + let Self { client } = self; + IntegrationsAzureKeyVaultId { + client: client.clone(), + id: id.into(), + } + } +} +pub struct IntegrationsAzureKeyVaultId { + client: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultId { + pub fn retrieve() {} + pub fn update() {} + pub fn destroy() {} + pub fn partial_update() {} + pub fn scan(&self) -> IntegrationsAzureKeyVaultIdScan { + let Self { client, id } = self; + IntegrationsAzureKeyVaultIdScan { + client: client.clone(), + id: id.clone(), + } + } +} +pub struct IntegrationsAzureKeyVaultIdScan { + client: Arc, + id: Arc, +} +impl IntegrationsAzureKeyVaultIdScan { + pub fn create() {} +} diff --git a/crates/cloudtruth-sdk/src/main.rs b/crates/cloudtruth-sdk/src/main.rs new file mode 100644 index 00000000..e7a11a96 --- /dev/null +++ b/crates/cloudtruth-sdk/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}