nethsm-sdk-rs-3.0.0/.cargo_vcs_info.json0000644000000001360000000000100135330ustar { "git": { "sha1": "54941ab0636b1f98e854e3c7e80d4eb3dabb6b01" }, "path_in_vcs": "" }nethsm-sdk-rs-3.0.0/.github/workflows/cd-test.yml000064400000000000000000000010401046102023000200010ustar 00000000000000name: Continuous delivery - test on: pull_request: # opened, reopenened, synchronize are the default types for pull_request # labeled, unlabeled ensure this check is also run if a label is added or removed types: [opened, reopened, synchronize, labeled, unlabeled] jobs: test-publish: runs-on: ubuntu-latest if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-publish-check') }} steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - run: cargo publish --dry-run nethsm-sdk-rs-3.0.0/.github/workflows/cd.yml000064400000000000000000000007741046102023000170410ustar 00000000000000name: Continuous delivery - crates.io on: release: types: [published] workflow_dispatch: jobs: publish: runs-on: ubuntu-latest environment: crates.io permissions: id-token: write steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: rust-lang/crates-io-auth-action@e919bc7605cde86df457cf5b93c5e103838bd879 # v1.0.1 id: auth - run: cargo publish env: CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} nethsm-sdk-rs-3.0.0/.github/workflows/ci.yml000064400000000000000000000024031046102023000170350ustar 00000000000000name: CI on: [push, pull_request] env: RUSTFLAGS: --deny warnings jobs: check: name: Check library runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - name: Check library run: cargo check --all-targets test: name: Run tests runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - name: Run tests run: cargo test fmt: name: Run rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true components: "rustfmt" - name: Run rustfmt run: cargo fmt -- --check clippy: name: Run clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true components: "clippy" - name: Run clippy run: cargo clippy --all-features --all-targets nethsm-sdk-rs-3.0.0/.gitignore000064400000000000000000000000371046102023000143130ustar 00000000000000/target/ **/*.rs.bk Cargo.lock nethsm-sdk-rs-3.0.0/CHANGELOG.md000064400000000000000000000062001046102023000141320ustar 00000000000000# Changelog ## Unreleased - [All Changes](https://github.com/Nitrokey/nethsm-sdk-rs/compare/v3.0.0...HEAD) ## [v3.0.0](https://github.com/Nitrokey/nethsm-sdk-rs/releases/tag/v3.0.0) (2025-10-15) This release adds support for the new features provided by [NetHSM v3.0](https://github.com/Nitrokey/nethsm/releases/tag/v3.0). ### Breaking Changes - `models`: - Remove `KeyType::EcP224` and `TlsKeyType::EcP224` enum variants - Add `subject_alt_names` field to `DistinguishedName` (requires NetHSM v3.0) - Mark all models als non-exhaustive - Only implement `Default` if all fields are optional - Remove all submodules. The models are directly available from the `models` module. ### Features - `models`: Add new enum variants (requires NetHSM v3.0): - `KeyMechanism`: `Bip340Signature` - `KeyType`: `EcP256K1`, `BrainpoolP256`, `BrainpoolP384`, `BrainpoolP512` - `SignMode`: `Bip340` - `TlsKeyType`: `BrainpoolP256`, `BrainpoolP384`, `BrainpoolP512` - `apis::default_api`: - Add `keys_key_id_move_post` function (requires NetHSM v3.0) - Add `keys_key_prefix_get` function (requires NetHSM v3.0) [All Changes](https://github.com/Nitrokey/nethsm-sdk-rs/compare/v2.0.0...v3.0.0) ## [v2.0.0](https://github.com/Nitrokey/nethsm-sdk-rs/releases/tag/v2.0.0) (2025-02-17) - Update to ureq 3.0.0 ([#35][]) [#35]: https://github.com/Nitrokey/nethsm-sdk-rs/pull/35 [All Changes](https://github.com/Nitrokey/nethsm-sdk-rs/compare/v1.1.0...v2.0.0) ## [v1.1.1](https://github.com/Nitrokey/nethsm-sdk-rs/releases/tag/v1.1.1) (2024-09-18) ### Features - Implement `Display` for enums (@wiktor-k, [#33](https://github.com/Nitrokey/nethsm-sdk-rs/pull/33)) ### Bugfixes - Return correct error variants for API errors ([#30](https://github.com/Nitrokey/nethsm-sdk-rs/issues/30)) [All Changes](https://github.com/Nitrokey/nethsm-sdk-rs/compare/v1.1.0...v1.1.1) ## [v1.1.0](https://github.com/Nitrokey/nethsm-sdk-rs/releases/tag/v1.1.0) (2024-07-17) ### Features - Add support for namespaces by adding the `namespaces_get`, `namespaces_namespace_id_delete`, `namespaces_namespace_id_put`, `users_user_id_post` API calls ### Bugfixes - Return `Error::ResponseError` instead of `Error::Transport` for API errors ([#21](https://github.com/Nitrokey/nethsm-sdk-rs/issues/21)) - Fix multipart requests, namely `system_restore_post` ([#20](https://github.com/Nitrokey/nethsm-sdk-rs/issues/20)) - Add authentication for `system_restore_post` ([#15](https://github.com/Nitrokey/nethsm-sdk-rs/issues/15)) ### Other Changes - Add `AkPub` and `Pcr` schemas [All Changes](https://github.com/Nitrokey/nethsm-sdk-rs/compare/v1.0.1...v1.1.0) ## [v1.0.1](https://github.com/Nitrokey/nethsm-sdk-rs/releases/tag/v1.0.1) (2024-05-06) ### Bugfixes - Enable `alloc` feature for `base64` dependency ([#14](https://github.com/Nitrokey/nethsm-sdk-rs/issues/14)) [All Changes](https://github.com/Nitrokey/nethsm-sdk-rs/compare/v1.0.0...v1.0.1) ## [v1.0.0](https://github.com/Nitrokey/nethsm-sdk-rs/releases/tag/v1.0.0) (2023-11-27) This is the first stable release of `nethsm-sdk-rs` and supports NetHSM [v1.0][nethsm-v1.0]. [nethsm-v1.0]: https://github.com/Nitrokey/nethsm/releases/tag/v1.0 nethsm-sdk-rs-3.0.0/Cargo.lock0000644000001640060000000000100115150ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ "libc", ] [[package]] name = "anstream" version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ "windows-sys 0.60.2", ] [[package]] name = "anstyle-wincon" version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", "once_cell_polyfill", "windows-sys 0.60.2", ] [[package]] name = "async-trait" version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "base64" version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[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.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" [[package]] name = "bumpalo" version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "bytes" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" version = "1.2.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" dependencies = [ "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", "windows-link", ] [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "cookie" version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "percent-encoding", "time", "version_check", ] [[package]] name = "cookie_store" version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fc4bff745c9b4c7fb1e97b25d13153da2bc7796260141df62378998d070207f" dependencies = [ "cookie", "document-features", "idna", "indexmap", "log", "serde", "serde_derive", "serde_json", "time", "url", ] [[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 = "crc32fast" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] [[package]] name = "deranged" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" dependencies = [ "powerfmt", ] [[package]] name = "displaydoc" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "document-features" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[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 = "env_filter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ "log", "regex", ] [[package]] name = "env_logger" version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ "anstream", "anstyle", "env_filter", "jiff", "log", ] [[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.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", "windows-sys 0.61.2", ] [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" [[package]] name = "flate2" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc5a4e564e38c699f2880d3fda590bedc2e69f3f84cd48b457bd892ce61d0aa9" dependencies = [ "crc32fast", "miniz_oxide", ] [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" 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-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-task", "pin-project-lite", "pin-utils", ] [[package]] name = "getrandom" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", "wasi", ] [[package]] name = "getrandom" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", "r-efi", "wasip2", ] [[package]] name = "h2" version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", "http 0.2.12", "indexmap", "slab", "tokio", "tokio-util", "tracing", ] [[package]] name = "hashbrown" version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" dependencies = [ "serde", ] [[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" version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" 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 0.2.12", "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 0.2.12", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", "socket2 0.5.10", "tokio", "tower-service", "tracing", "want", ] [[package]] name = "hyper-tls" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", "hyper", "native-tls", "tokio", "tokio-native-tls", ] [[package]] name = "iana-time-zone" version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "log", "wasm-bindgen", "windows-core", ] [[package]] name = "iana-time-zone-haiku" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ "cc", ] [[package]] name = "icu_collections" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] name = "icu_locale_core" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", "tinystr", "writeable", "zerovec", ] [[package]] name = "icu_normalizer" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", "icu_provider", "smallvec", "zerovec", ] [[package]] name = "icu_normalizer_data" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", "zerotrie", "zerovec", ] [[package]] name = "idna" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", "utf8_iter", ] [[package]] name = "idna_adapter" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", ] [[package]] name = "indexmap" version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", "hashbrown", ] [[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 = "jiff" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" dependencies = [ "jiff-static", "log", "portable-atomic", "portable-atomic-util", "serde", ] [[package]] name = "jiff-static" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "js-sys" version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" dependencies = [ "once_cell", "wasm-bindgen", ] [[package]] name = "libc" version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "linux-raw-sys" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "litrs" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" [[package]] name = "log" version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "memchr" version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", ] [[package]] name = "miniz_oxide" version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", "simd-adler32", ] [[package]] name = "mio" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", "wasi", "windows-sys 0.59.0", ] [[package]] name = "multipart" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" dependencies = [ "log", "mime", "mime_guess", "rand 0.8.5", "tempfile", ] [[package]] name = "native-tls" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" dependencies = [ "libc", "log", "openssl", "openssl-probe", "openssl-sys", "schannel", "security-framework", "security-framework-sys", "tempfile", ] [[package]] name = "nethsm-sdk-rs" version = "3.0.0" dependencies = [ "base64 0.21.7", "chrono", "env_logger", "http 1.3.1", "mime", "multipart", "rustainers", "serde", "serde_derive", "serde_json", "tokio", "ureq", "url", ] [[package]] name = "num-conv" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "openssl" version = "0.10.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24ad14dd45412269e1a30f52ad8f0664f0f4f4a89ee8fe28c3b3527021ebb654" dependencies = [ "bitflags 2.9.4", "cfg-if", "foreign-types", "libc", "once_cell", "openssl-macros", "openssl-sys", ] [[package]] name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" version = "0.9.110" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a9f0075ba3c21b09f8e8b2026584b1d18d49388648f2fbbf3c97ea8deced8e2" dependencies = [ "cc", "libc", "pkg-config", "vcpkg", ] [[package]] name = "path-absolutize" version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" dependencies = [ "path-dedot", ] [[package]] name = "path-dedot" version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" dependencies = [ "once_cell", ] [[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[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 = "portable-atomic" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "portable-atomic-util" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" dependencies = [ "portable-atomic", ] [[package]] name = "potential_utf" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" dependencies = [ "zerovec", ] [[package]] name = "powerfmt" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "proc-macro2" version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.4", ] [[package]] name = "rand" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", ] [[package]] name = "rand_chacha" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core 0.6.4", ] [[package]] name = "rand_chacha" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", "rand_core 0.9.3", ] [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom 0.2.16", ] [[package]] name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom 0.3.4", ] [[package]] name = "regex" version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", "http 0.2.12", "http-body", "hyper", "hyper-tls", "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", "system-configuration", "tokio", "tokio-native-tls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "winreg", ] [[package]] name = "ring" version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", ] [[package]] name = "rustainers" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66809be4fb4620c48b4dd8346ddc413e7d9b6d3d3da59e7853ba5d81eca9b7e6" dependencies = [ "async-trait", "hex", "indexmap", "path-absolutize", "reqwest", "serde", "serde_json", "strum", "strum_macros", "thiserror", "tokio", "tracing", "typed-builder", "ulid", ] [[package]] name = "rustix" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags 2.9.4", "errno", "libc", "linux-raw-sys", "windows-sys 0.61.2", ] [[package]] name = "rustls" version = "0.23.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" dependencies = [ "log", "once_cell", "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-pemfile" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64 0.21.7", ] [[package]] name = "rustls-pemfile" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ "rustls-pki-types", ] [[package]] name = "rustls-pki-types" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" dependencies = [ "zeroize", ] [[package]] name = "rustls-webpki" version = "0.103.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" dependencies = [ "ring", "rustls-pki-types", "untrusted", ] [[package]] name = "rustversion" version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "schannel" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" dependencies = [ "windows-sys 0.61.2", ] [[package]] name = "security-framework" version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.9.4", "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "serde" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", ] [[package]] name = "serde_core" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", "serde_core", ] [[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 = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" dependencies = [ "libc", ] [[package]] name = "simd-adler32" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "slab" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", "windows-sys 0.52.0", ] [[package]] name = "socket2" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", "windows-sys 0.60.2", ] [[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "strum" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" [[package]] name = "strum_macros" version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", "syn", ] [[package]] name = "subtle" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" 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.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", "syn", ] [[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.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", "getrandom 0.3.4", "once_cell", "rustix", "windows-sys 0.61.2", ] [[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", ] [[package]] name = "time" version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", "serde", "time-core", "time-macros", ] [[package]] name = "time-core" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", ] [[package]] name = "tinystr" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", ] [[package]] name = "tokio" version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ "bytes", "libc", "mio", "pin-project-lite", "signal-hook-registry", "socket2 0.6.1", "tokio-macros", "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tokio-native-tls" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", ] [[package]] name = "tokio-util" version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", ] [[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-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "tracing-core" version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" 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 = "typed-builder" version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77739c880e00693faef3d65ea3aad725f196da38b22fdc7ea6ded6e1ce4d3add" dependencies = [ "typed-builder-macro", ] [[package]] name = "typed-builder-macro" version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f718dfaf347dcb5b983bfc87608144b0bad87970aebcbea5ce44d2a30c08e63" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "ulid" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe" dependencies = [ "rand 0.9.2", "web-time", ] [[package]] name = "unicase" version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-ident" version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] name = "untrusted" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99ba1025f18a4a3fc3e9b48c868e9beb4f24f4b4b1a325bada26bd4119f46537" dependencies = [ "base64 0.22.1", "cookie_store", "flate2", "log", "percent-encoding", "rustls", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", "serde_json", "ureq-proto", "utf-8", "webpki-roots", ] [[package]] name = "ureq-proto" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b4531c118335662134346048ddb0e54cc86bd7e81866757873055f0e38f5d2" dependencies = [ "base64 0.22.1", "http 1.3.1", "httparse", "log", ] [[package]] name = "url" version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", "percent-encoding", "serde", ] [[package]] name = "utf-8" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[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 = "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 = "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.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ "wit-bindgen", ] [[package]] name = "wasm-bindgen" version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.54" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" dependencies = [ "cfg-if", "js-sys", "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "web-time" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "webpki-roots" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b130c0d2d49f8b6889abc456e795e82525204f27c42cf767cf0d7734e089b8" dependencies = [ "rustls-pki-types", ] [[package]] name = "windows-core" version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", "windows-link", "windows-result", "windows-strings", ] [[package]] name = "windows-implement" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "windows-interface" version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] [[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-sys" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets 0.53.5", ] [[package]] name = "windows-sys" version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] [[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 0.52.6", "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-targets" version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ "windows-link", "windows_aarch64_gnullvm 0.53.1", "windows_aarch64_msvc 0.53.1", "windows_i686_gnu 0.53.1", "windows_i686_gnullvm 0.53.1", "windows_i686_msvc 0.53.1", "windows_x86_64_gnu 0.53.1", "windows_x86_64_gnullvm 0.53.1", "windows_x86_64_msvc 0.53.1", ] [[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_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[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_aarch64_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[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_gnu" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[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_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[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_i686_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[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_gnu" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[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_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[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 = "windows_x86_64_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[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" version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "yoke" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", "yoke-derive", "zerofrom", ] [[package]] name = "yoke-derive" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", "syn", "synstructure", ] [[package]] name = "zerocopy" version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", "syn", ] [[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", "synstructure", ] [[package]] name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" [[package]] name = "zerotrie" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" dependencies = [ "displaydoc", "yoke", "zerofrom", ] [[package]] name = "zerovec" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" dependencies = [ "yoke", "zerofrom", "zerovec-derive", ] [[package]] name = "zerovec-derive" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", "syn", ] nethsm-sdk-rs-3.0.0/Cargo.toml0000644000000037760000000000100115460ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" name = "nethsm-sdk-rs" version = "3.0.0" authors = ["Nitrokey "] build = false exclude = [ "generator/*", "docs/*", ".openapi-generator/*", ".openapi-generator-ignore", "generator_conf.yaml", "update_openapi.sh", ] autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "Rust SDK to communicate with Nitrokey NetHSM" homepage = "https://www.nitrokey.com/products/nethsm" documentation = "https://docs.nitrokey.com/nethsm/" readme = "README.md" license = "MIT" repository = "https://github.com/Nitrokey/nethsm-sdk-rs" [lib] name = "nethsm_sdk_rs" path = "src/lib.rs" [[test]] name = "basic" path = "tests/basic.rs" [dependencies.base64] version = "0.21" features = ["alloc"] default-features = false [dependencies.http] version = "1" [dependencies.mime] version = "0.3" [dependencies.multipart] version = "0.18" features = ["client"] default-features = false [dependencies.serde] version = "^1.0" default-features = false [dependencies.serde_derive] version = "^1.0" [dependencies.serde_json] version = "^1.0" default-features = false [dependencies.ureq] version = "3.0.3" features = [ "json", "rustls", ] default-features = false [dependencies.url] version = "^2.2" [dev-dependencies.chrono] version = "0.4.38" [dev-dependencies.env_logger] version = "0.11.3" [dev-dependencies.rustainers] version = "0.12.0" [dev-dependencies.tokio] version = "1.37.0" features = [ "rt", "macros", ] [dev-dependencies.ureq] version = "3.0.3" nethsm-sdk-rs-3.0.0/Cargo.toml.orig000064400000000000000000000021311046102023000152070ustar 00000000000000[package] name = "nethsm-sdk-rs" version = "3.0.0" authors = ["Nitrokey "] description = "Rust SDK to communicate with Nitrokey NetHSM" documentation = "https://docs.nitrokey.com/nethsm/" homepage = "https://www.nitrokey.com/products/nethsm" repository = "https://github.com/Nitrokey/nethsm-sdk-rs" readme = "README.md" license = "MIT" edition = "2021" exclude = [ "generator/*", "docs/*", ".openapi-generator/*", ".openapi-generator-ignore", "generator_conf.yaml", "update_openapi.sh", ] [dependencies] mime = "0.3" multipart = { version = "0.18", default-features = false, features = ["client"] } serde = { default-features = false, version = "^1.0" } serde_derive = "^1.0" serde_json = { default-features = false, version = "^1.0" } url = "^2.2" ureq = { version = "3.0.3", features = ["json", "rustls"], default-features = false } base64 = { version = "0.21", default-features = false, features = ["alloc"] } http = "1" [dev-dependencies] chrono = "0.4.38" env_logger = "0.11.3" rustainers = "0.12.0" tokio = { version = "1.37.0", features = ["rt", "macros"] } ureq = "3.0.3" nethsm-sdk-rs-3.0.0/LICENCE000064400000000000000000000020331046102023000133060ustar 00000000000000Copyright (c) 2023 Nitrokey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.nethsm-sdk-rs-3.0.0/Makefile000064400000000000000000000001531046102023000137620ustar 00000000000000nethsm-api.yaml: curl "https://nethsmdemo.nitrokey.com/api_docs/nethsm-api.yaml" --output nethsm-api.yaml nethsm-sdk-rs-3.0.0/README.md000064400000000000000000000023431046102023000136040ustar 00000000000000# Rust API client for NetHSM ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. - API version: v1 All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. ## Installation Put the package under your project folder in a directory named `nethsm-sdk` and add the following to `Cargo.toml` under `[dependencies]`: ```toml nethsm-sdk-rs = { git = "https://github.com/Nitrokey/nethsm-sdk-rs" } ``` To get access to the crate's generated documentation, use: ```sh cargo doc --open ``` ## Updating the Code Dependencies: Rust toolchain, Docker To update the code from the latest API definition, execute: ```sh ./update_openapi.sh ``` It will build the custom openapi-generator Docker image. Run it to generate the code from the online API definition and then format the generated code. ## Licence The Rust crate is licensed under the MIT license. The customized OpenAPI generator code is modified from the openapi-generator repository, licenced under Apache 2.0. nethsm-sdk-rs-3.0.0/nethsm-api.yaml000064400000000000000000003010571046102023000152620ustar 00000000000000openapi: 3.0.0 info: title: NetHSM version: v1 description: | All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. servers: - url: https://{host}/api/{version} variables: host: default: nethsmdemo.nitrokey.com version: default: v1 paths: /info: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/InfoData" "406": description: Content type in Accept header not supported. description: Information about the vendor and product. x-annotation-state: - Locked - Operational - Unprovisioned x-annotation-role: - Public x-annotation-caller-namespace: - Root - Namespaced /health/alive: get: responses: "200": description: NetHSM is fully started and in state *Locked* or *Unprovisioned*. "406": description: Content type in Accept header not supported. "412": description: NetHSM is not in state *Locked* or *Unprovisioned*. description: | Retrieve whether NetHSM is fully started but not ready to take traffic. This corresponds to the state *Locked* or *Unprovisioned*. x-annotation-role: - Public x-annotation-state: - Locked - Unprovisioned x-annotation-caller-namespace: - Root - Namespaced /health/ready: get: responses: "200": description: NetHSM is in state *Operational*. "406": description: Content type in Accept header not supported. "412": description: NetHSM is not in state *Operational*. description: | Retrieve whether NetHSM is in state *Operational* and thus ready to take traffic. x-annotation-role: - Public x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced /health/state: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/HealthStateData" "406": description: Content type in Accept header not supported. description: Retrieve the state of NetHSM. x-annotation-role: - Public x-annotation-state: - Locked - Operational - Unprovisioned x-annotation-caller-namespace: - Root - Namespaced /metrics: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/MetricsData" "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get metrics. Precondition: NetHSM is *Operational* and a **R-Metrics** can be authenticated. security: - basic: [] x-annotation-role: - Metrics x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced /provision: post: responses: "204": description: Provisioning was successful, NetHSM is *Operational* now. "400": description: Malformed request data (e.g. malformed time, weak passphrase). "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Unprovisioned*). description: |- Initial provisioning, only available in *Unprovisioned* state. *WARNING:* The unlock passphrase can't be reset by an admin user without knowing the current value, so if the unlock passphrase is lost, neither can it be reset to a new value nor can the NetHSM be unlocked. requestBody: content: application/json: schema: $ref: "#/components/schemas/ProvisionRequestData" required: true x-annotation-role: - Public x-annotation-state: - Unprovisioned x-annotation-caller-namespace: - Root - Namespaced /unlock: post: responses: "204": description: Unlock was successful, NetHSM is *Operational* now. "400": description: Bad request (invalid passphrase). "403": description: Unlock failed (access denied). "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Locked*). description: Brings a *Locked* NetHSM into *Operational* state. requestBody: content: application/json: schema: $ref: "#/components/schemas/UnlockRequestData" required: true x-annotation-role: - Public x-annotation-state: - Locked x-annotation-caller-namespace: - Root - Namespaced /lock: post: responses: "204": description: Lock was successful, NetHSM is *Locked* now. "401": description: Authentication required but none provided. "403": description: Lock failed (access denied, e.g. user is in a namespace). "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Brings an *Operational* NetHSM into *Locked* state. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /random: post: responses: "200": description: Successful request for *length* random bytes. content: application/json: schema: $ref: "#/components/schemas/RandomData" "400": description: Bad request (invalid length). "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Retrieve cryptographically strong random bytes from NetHSM. Precondition: NetHSM is *Operational* and a **R-Operator** can be authenticated. requestBody: content: application/json: schema: $ref: "#/components/schemas/RandomRequestData" required: true security: - basic: [] x-annotation-role: - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced /keys: get: responses: "200": description: Successful request for the list of keys. content: application/json: schema: $ref: "#/components/schemas/KeyList" "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get a list of the identifiers of all keys that are currently stored in NetHSM. If the caller is in a namespace, only keys in that namespace are returned. Separate requests need to be made to request the individual key data. To fetch only a subset of keys, consider using `/keys/pfx*`. parameters: - name: filter in: query description: Only return keys that are can be used by the requester, according to restrictions. schema: type: string security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced post: responses: "201": headers: location: description: Where to find the newly added key. schema: type: string content: application/json: schema: $ref: "#/components/schemas/CreateResourceId" description: | Successful import of a private key. The response contains a Location header, e.g. "https://nethsm.local/v1/keys/I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". "400": description: Bad request (specified properties are invalid). "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Import a private key into NetHSM and let NetHSM generate a KeyID. The public key will be automatically derived. The parameters of the key can be passed as a PEM file or a JSON object. The key is stored in the caller's namespace. requestBody: content: application/json: schema: $ref: "#/components/schemas/PrivateKey" multipart/form-data: schema: $ref: "#/components/schemas/PrivateKeyPem" encoding: key_file: contentType: application/x-pem-file required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced /keys/generate: post: responses: "201": description: | Successful creation of new public and private key pair. Set Location header to the new KeyID. headers: location: description: Where to find the newly added key. schema: type: string content: application/json: schema: $ref: "#/components/schemas/CreateResourceId" "400": description: Bad request (specified properties are invalid). "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Generate a pair of public and private key and store it in NetHSM. KeyID is optional as a parameter and will be generated by NetHSM if not present. The key is stored in the caller's namespace. requestBody: content: application/json: schema: $ref: "#/components/schemas/KeyGenerateRequestData" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced /keys/{KeyPrefix}*: get: responses: "200": description: Successful request for the list of keys. content: application/json: schema: $ref: "#/components/schemas/KeyList" "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get a list of the identifiers of all keys that have a KeyID that starts with KeyPrefix. If the caller is in a namespace, only keys in that namespace are returned. Separate requests need to be made to request the individual key data. parameters: - name: filter in: query description: Only return keys that are can be used by the requester, according to restrictions. schema: type: string security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyPrefix: myK parameters: - name: KeyPrefix in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}: get: responses: "200": description: | For response body with content type `application/json`: * *RSA* keys include `modulus` and `publicExponent` properties. * P* keys include the common format (0x04 followed by big-endian \ encoded affine coordinates x and y). * Curve25519 keys are 32 byte, and follow the RFC8032 5.1.2 encoding \ (little endian, x over y). content: application/json: schema: $ref: "#/components/schemas/PublicKey" examples: rsa: summary: "RSA" value: mechanisms: - RSA_Signature_PSS_SHA256 type: RSA restrictions: tags: - berlin public: modulus: FhJQl11CiY0ifRHXeAqFh4rdSl6 publicExponent: FhJQl11CiY0ifRHXeAqFh4rdSl6 operations: 242 ecdsa: summary: "P* Keys" value: mechanisms: - ECDSA_Signature type: EC_P256 operations: 242 restrictions: tags: - berlin public: data: BMKlPJ60PNFgsekRwg7n5mTIJkWWy6XLy0ORj14HumKi5qH63JaJzFOWLxYiaB6KH0NOgEKb7rUt eddsa: summary: "Curve25519" value: mechanisms: - EdDSA_Signature type: Curve25519 operations: 242 restrictions: tags: - berlin public: data: htnjTKRUz3XnLys5YD2+bKvzXZuu9cvXKwsCnWdzR+4= generic: summary: Generic value: mechanisms: - AES_Encryption_CBC - AES_Decryption_CBC type: Generic operations: 242 restrictions: tags: - berlin "400": description: Invalid character in the KeyID. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Retrieve a single public key. security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 put: responses: "204": description: Successful import of a private key. "400": description: Bad request (specified properties are invalid). "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "409": description: Conflict, key already exists for this keyID. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Import a private key into NetHSM and store it under the *KeyID* path. The public key will be automatically derived. The parameters of the key can be passed as a PEM file or a JSON object. The key is stored in the caller's namespace. requestBody: description: | For request body with content type `application/json`: * *RSA* includes `primeP`, `primeQ`, and `publicExponent` properties. The remaining properties `privateExponent`, `modulus`, ..) are computed. * *EC_P256*, *EC_P384*, *EC_P521* uses the `data` property. Keys are the raw (big endian) scalar. * *Curve25519* uses the `data` property. Keys are the raw (little endian) key. content: application/json: schema: $ref: "#/components/schemas/PrivateKey" examples: rsa: summary: RSA value: type: RSA mechanisms: - RSA_Signature_PSS_SHA256 private: primeP: AOnWFZ+JrI/xOXJU04uYCZOiPVUWd6CSbVseEYrYQYxc7dVroePshz29tc+VEOUP5T0O8lXMEkjFAwjW6C9QTAsPyl6jwyOQluMRIkdN4/7BAg3HAMuGd7VmkGyYrnZWW54sLWp1JD6XJG33kF+9OSar9ETPoVyBgK5punfiUFEL primeQ: ANT1kWDdP9hZoFKT49dwdM/S+3ZDnxQa7kZk9p+JKU5RaU9e8pS2GOJljHwkES1FH6CUGeIaUi81tRKe2XZhe/163sEyMcxkaaRbBbTc1v6ZDKILFKKt4eX7LAQfhL/iFlgi6pcyUM8QDrm1QeFgGz11ChM0JuQw1WwkX06lg8iv publicExponent: AQAB restrictions: tags: - berlin ecdsa: summary: P* Keys value: type: EC_P256 mechanisms: - ECDSA_Signature private: data: "BgcqhkjOPQIBBgUrgQQAIQM6AATZOhHS/Sed4w==" restrictions: tags: - berlin eddsa: summary: Curve25519 value: type: Curve25519 mechanisms: - EdDSA_Signature private: data: "m0o4HHT5tiwxxJ3hCzK6H9pXt9R854qyJ+q4Lmei/Kg=" restrictions: tags: - berlin multipart/form-data: schema: $ref: "#/components/schemas/PrivateKeyPem" encoding: key_file: contentType: application/x-pem-file required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: MyNewKey delete: responses: "204": description: Key was successfully deleted. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Delete a pair of public and private key. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}/public.pem: get: responses: "200": description: | For response body with content type `application/x-pem-file`: * Returns the PEM encoded public key, as specified in PKCS #8. content: application/x-pem-file: schema: $ref: "#/components/schemas/PemPublicKey" "400": description: Invalid character in the KeyID. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Retrieve public key in PEM format. security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-caller-namespace: - Root - Namespaced x-annotation-state: - Operational x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}/csr.pem: post: responses: "200": description: Successful generation of certificate signing request. content: application/x-pem-file: schema: $ref: "#/components/schemas/PemCSR" "400": description: Bad request (specified properties are invalid). "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Retrieve a certificate signing request in PEM format. requestBody: content: application/json: schema: $ref: "#/components/schemas/DistinguishedName" required: true security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-caller-namespace: - Root - Namespaced x-annotation-state: - Operational x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}/decrypt: post: responses: "200": description: | For response body with content type `application/json`: * Mode `RAW` returns the raw binary data. * Mode `PKCS1` returns the raw binary data. * Mode `OAEP_*` returns the raw binary data. content: application/json: schema: $ref: "#/components/schemas/DecryptData" "400": description: | Bad Request, e.g. invalid encryption mode. * Mode `RAW` returns failure if input is bigger than key size. * Mode `PKCS1` returns failure if input is bigger than key size. * Mode `OAEP_*` returns failure is input is bigger than key size. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Decrypt an encrypted message with the secret key. requestBody: description: | For request body with content type `application/json`: * Mode `RAW` expects raw binary data. * Mode `PKCS1` expects PKCS1-encoded and padded binary data. * Mode `OAEP_*` expects EME-OAEP-encoded and padded binary data. content: application/json: schema: $ref: "#/components/schemas/DecryptRequestData" required: true security: - basic: [] x-annotation-role: - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}/encrypt: post: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/EncryptData" "400": description: Bad Request, e.g. invalid mechanism. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Encrypt a message with the secret key. requestBody: content: application/json: schema: $ref: "#/components/schemas/EncryptRequestData" required: true security: - basic: [] x-annotation-role: - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: MyAESKey parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}/sign: post: responses: "200": description: | For response body with content type `application/json`: * Mode `PKCS1` returns the PKCS1 signature of the padded hash value prepended with the according DigestInfo header. * Mode `PSS_*` returns the EMSA-PSS encoded signature. * Mode `EdDSA` returns the RFC 8032 (5.1.6) encoding: r appened with s, in total 64 bytes (each 32 bytes). * Mode `ECDSA` returns the ASN.1 DER encoded signature (a SEQUENCE of INTEGER r INTEGER s). * Mode `BIP340` returns the BIP-340 encoded signature: r appened with s, in total 64 bytes (each 32 bytes). content: application/json: schema: $ref: "#/components/schemas/SignData" "400": description: | Bad Request, e.g. invalid signing mode. * Mode `PKCS1` returns failure if the input has not a known hash length or the private key is smaller than hash length. * Mode `PSS_*` returns failure if the input has not the hash length, or the private key is smaller than hash length. * Mode `ECDSA` returns failure if the input exceeds the group size in bits. The hash algorithm is not part of the encoding. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Sign a message with the secret key. requestBody: description: | For request body with content type `application/json`: * Mode `PKCS1` expects the already hashed data. * Mode `PSS_*` expects the already hashed data. * Mode `EdDSA` expects any message (ED25519 applies the SHA512 hash internally, also to derive the nonce). * Mode `ECDSA` expects the hashed data (using SHA256 for P256, SHA384 for P384 and SHA512 for P521). * Mode `BIP340` expects any message (BIP-340 applies the tagged SHA256 hash internally). content: application/json: schema: $ref: "#/components/schemas/SignRequestData" required: true security: - basic: [] x-annotation-role: - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /keys/{KeyID}/cert: get: responses: "200": description: "" content: application/octet-stream: schema: format: binary type: string "400": description: Invalid character in the KeyID. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content-Type in Accept header is not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Retrieve a stored certificate in the exact format it was stored. security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 put: responses: "201": description: Successful import of a certificate. "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "409": description: Conflict, certificate already exists for this KeyID. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Store a certificate. Maximum size 1MB. The Content-Type must be application/octet-stream. requestBody: content: application/octet-stream: schema: format: binary type: string required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 delete: responses: "204": description: Successful deletion of a certificate. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Delete the certificate. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" x-test-value: myKey1 /keys/{KeyID}/move: post: responses: "200": description: Key was successfully moved. content: application/json: schema: $ref: "#/components/schemas/CreateResourceId" "400": description: Bad request (invalid JSON or empty newId). "401": description: Authentication required but none provided. "403": description: Access denied (Administrator role required). "404": description: Key for KeyID not found in namespace. "409": description: A key with the new ID already exists. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Move a key by changing its identifier. The key content remains unchanged, but it will be accessible under the new identifier. The old identifier becomes invalid after successful move. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/MoveKeyRequest" security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 parameters: - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" x-test-value: myKey1 /keys/{KeyID}/restrictions/tags/{Tag}: put: responses: "204": description: Successful addition of the tag. "304": description: Tag is already present for this key. "400": description: Bad request, tag format is invalid. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Add a tag to the authorized set security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 x-test-value-Tag: MyNewTag delete: responses: "204": description: Successful deletion of the tag. "401": description: Authentication required but none provided. "403": description: Access denied. "404": description: Key for KeyID not found in namespace. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Delete a tag from the authorized set security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-KeyID: myKey1 x-test-value-Tag: MyTag parameters: - name: Tag in: path required: true schema: type: string - name: KeyID in: path required: true schema: $ref: "#/components/schemas/ID" /namespaces: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/NamespaceList" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. the caller is in a namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get a list of all created namespaces. Note that users may be assigned namespaces not present in this list, as long as the namespace has not been created. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /namespaces/{NamespaceID}: put: responses: "204": description: Successful creation of namespace. "400": description: | Bad request (specified properties are invalid, e.g. invalid namespace name or namespace already exists). "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user in a namespace or not an admin). "406": description: Content type in Accept header not supported. "409": description: Conflict - user already exists for this user-ID. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Create a namespace on keyfender. All users in that namespace can now be used, and all user management power is delegated to admins in that namespace. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root x-test-value-NamespaceID: namespace3 delete: responses: "204": description: Successful deletion of namespace. "400": description: Bad request. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user in a namespace or not an admin). "404": description: Namespace not found. "412": description: Precondition failed (NetHSM was not *Operational*). description: "Delete a namespace. **WARNING: all keys from that namespace are deleted.**" security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root x-test-value-NamespaceID: namespace1 parameters: - name: NamespaceID in: path required: true schema: $ref: "#/components/schemas/ID" /users: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/UserList" "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get a list of all user ids that have accounts on NetHSM. If the caller is in a namespace, return only users in that namespace. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced post: responses: "201": description: | Successful creation of user. The response contains a Location header, e.g. "https://nethsm.local/v1/users/I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". headers: location: description: Where to find the newly added user. schema: type: string content: application/json: schema: $ref: "#/components/schemas/CreateResourceId" "400": description: Bad request (specified properties are invalid, e.g. weak passphrase). "401": description: Authentication required but none provided. "403": description: Access denied (e.g. caller not administrator, or creating user in namespace not matching the caller's). "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Create a new user on NetHSM, inheriting the caller's namespace. The user-ID is generated by NetHSM. requestBody: content: application/json: schema: $ref: "#/components/schemas/UserPostData" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced /users/{UserID}: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/UserData" "400": description: Invalid character in the UserID. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user not in the same namespace) "404": description: User for UserID not found. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: "Get user info: name and role." security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-annotation-target-namespace: - SameAsCaller - CallerIsRoot x-test-value-UserID: operator put: responses: "201": description: Successful creation of user. "400": description: Bad request (specified properties are invalid, e.g. weak passphrase). "401": description: Authentication required but none provided. "403": description: Access denied (e.g. caller not administrator, or creating user in namespace not matching the caller's). "406": description: Content type in Accept header not supported. "409": description: Conflict - user already exists for this user-ID. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Create a user on keyfender. The new user must either be in the same namespace as the caller, or be in a namespace not created yet if the caller has no namespace. requestBody: content: application/json: schema: $ref: "#/components/schemas/UserPostData" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-test-value-UserID: newOperator post: responses: "201": description: | Successful creation of user. The response contains a Location header, e.g. "https://nethsm.local/v1/users/namespace1~I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". headers: location: description: Where to find the newly added user. schema: type: string content: application/json: schema: $ref: "#/components/schemas/CreateResourceId" "400": description: Bad request (specified properties are invalid, e.g. weak passphrase). "401": description: Authentication required but none provided. "403": description: Access denied (e.g. caller not administrator, or creating user in namespace not matching the caller's). "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Create a new user on NetHSM, in the namespace specified as a prefix in the path with the format 'namespace~'. For example, a POST request on "https://nethsm.local/v1/users/namespace1~" will generate a user-ID and create that user in "namespace1". The namespace prefix *must* be present: for creating users without a namespace, use a POST on "/v1/users". requestBody: content: application/json: schema: $ref: "#/components/schemas/UserPostData" required: true security: - basic: [] x-test-value-UserID: namespace3~ x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced delete: responses: "204": description: Successful deletion of user. "400": description: Bad request (cannot delete yourself) "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user not in the same namespace) "404": description: User not found for this user-ID. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Delete a user from keyfender. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-annotation-target-namespace: - SameAsCaller x-test-value-UserID: operator parameters: - name: UserID in: path required: true schema: $ref: "#/components/schemas/UserID" /users/{UserID}/passphrase: post: responses: "204": description: Successful change of passphrase. "400": description: Bad request - weak passphrase. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user not in the same namespace) "404": description: User not found for this user-ID. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Update the passphrase. requestBody: content: application/json: schema: $ref: "#/components/schemas/UserPassphrasePostData" required: true security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-annotation-target-namespace: - SameAsCaller x-test-value-UserID: operator parameters: - name: UserID in: path required: true schema: $ref: "#/components/schemas/UserID" /users/{UserID}/tags: get: responses: "200": description: "" content: application/json: schema: $ref: "#/components/schemas/TagList" "400": description: Invalid character in the UserID. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user not in the same namespace) "404": description: User not found for this user-ID. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Get the list of tags set to an Operator user. security: - basic: [] x-annotation-role: - Administrator - Operator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-annotation-target-namespace: - SameAsCaller - CallerIsRoot x-test-value-UserID: operator parameters: - name: UserID in: path required: true schema: $ref: "#/components/schemas/UserID" /users/{UserID}/tags/{Tag}: put: responses: "204": description: Successful addition of the tag. "304": description: Tag is already present for this UserID. "400": description: Bad request, tag format is invalid or user is not an operator. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user not in the same namespace) "404": description: UserID not found. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Add a tag to the Operator user. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-annotation-target-namespace: - SameAsCaller x-test-value-UserID: operator x-test-value-Tag: munich delete: responses: "204": description: Successful deletion of the tag. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user not in the same namespace) "404": description: Tag or user not found. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Delete a tag from the Operator user security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root - Namespaced x-annotation-target-namespace: - SameAsCaller x-test-value-UserID: operator x-test-value-Tag: berlin parameters: - name: UserID in: path required: true schema: $ref: "#/components/schemas/UserID" - name: Tag in: path required: true schema: type: string /config/unlock-passphrase: put: responses: "204": description: Successful change of passphrase. "400": description: Bad request - weak passphrase. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: |- Update the unlock passphrase. *WARNING:* The unlock passphrase can't be reset by an admin user without knowing the current value, so if the unlock passphrase is lost, neither can it be reset to a new value nor can the NetHSM be unlocked. requestBody: content: application/json: schema: $ref: "#/components/schemas/UnlockPassphraseConfig" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/unattended-boot: get: responses: "200": description: Successful read of unattended boot configuration. content: application/json: schema: $ref: "#/components/schemas/UnattendedBootConfig" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: "Read unattended boot configuration: is it on or off?" security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root put: responses: "204": description: Successful change of unattended boot mode. "400": description: Bad request - invalid status setting. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: "Configure unattended boot: switch it on or off (flip the switch)." requestBody: content: application/json: schema: $ref: "#/components/schemas/UnattendedBootConfig" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/tls/public.pem: get: responses: "200": description: Successful retrieval of public key. content: application/x-pem-file: schema: $ref: "#/components/schemas/PemPublicKey" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Get public key for NetHSMs https API. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/tls/cert.pem: get: responses: "200": description: Successful retrieval of certificate. content: application/x-pem-file: schema: $ref: "#/components/schemas/PemCert" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). "415": description: Content type in Accept header not supported or not present. description: Get certificate for NetHSMs https API. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root put: responses: "201": description: Successfully set certificate. "400": description: Certificate malformed. "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Set certificate for NetHSMs https API e.g. to replace self-signed intital certificate. requestBody: content: application/x-pem-file: schema: $ref: "#/components/schemas/PemCert" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational /config/tls/csr.pem: post: responses: "200": description: Successful generation of certificate signing request. content: application/x-pem-file: schema: $ref: "#/components/schemas/PemCSR" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Get NetHSM certificate signing request e.g. to replace self-signed intital certificate. requestBody: content: application/json: schema: $ref: "#/components/schemas/DistinguishedName" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/tls/generate: post: responses: "204": description: Successful creation of new public and private key pair for NetHSM's https API. "400": description: Bad request (specified properties are invalid). "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Generate a new pair of public and private key for NetHSM's https API. requestBody: content: application/json: schema: $ref: "#/components/schemas/TlsKeyGenerateRequestData" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/network: get: responses: "200": description: Successful retrieval of network configuration. content: application/json: schema: $ref: "#/components/schemas/NetworkConfig" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Get network configuration. IP address, netmask, router. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root put: responses: "204": description: Succesful update of network configuration. "400": description: Bad request - invalid input format. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Configure network. requestBody: content: application/json: schema: $ref: "#/components/schemas/NetworkConfig" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/logging: get: responses: "200": description: Successful retrieval of logging configuration. content: application/json: schema: $ref: "#/components/schemas/LoggingConfig" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get logging configuration. Protocol is always syslog over UDP. Configurable are IP adress and port, log level. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root put: responses: "204": description: Succesful update of logging configuration. "400": description: Bad request - invalid input format. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Configure log level and destination. requestBody: content: application/json: schema: $ref: "#/components/schemas/LoggingConfig" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/backup-passphrase: put: responses: "204": description: Successful change of passphrase. "400": description: Bad request - weak passphrase. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: |- Update the backup passphrase. If the backup passphrase is not set yet, use "" as currentPassphrase. *WARNING:* Like the unlock passphrase, this configuration can't be reset by an admin user without knowing the current value, so if the backup passphrase is lost, neither can it be reset to a new value nor can the created backups be restored. requestBody: content: application/json: schema: $ref: "#/components/schemas/BackupPassphraseConfig" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /config/time: get: responses: "200": description: Successful retrieval of system time. content: application/json: schema: $ref: "#/components/schemas/TimeConfig" "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Get system time. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root put: responses: "204": description: Succesful update of system time. "400": description: Bad request - invalid input format. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Configure system time. requestBody: content: application/json: schema: $ref: "#/components/schemas/TimeConfig" required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/info: get: responses: "200": description: Successful retrieval of system information. content: application/json: schema: $ref: "#/components/schemas/SystemInfo" "401": description: Authentication required but none provided. "403": description: Access denied. "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: | Get detailed system information, including firmware, system, and hardware version. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/reboot: post: responses: "204": description: About to reboot NetHSM. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Reboot NetHSM. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/shutdown: post: responses: "204": description: About to shut down NetHSM. "401": description: Authentication required but none provided (only in Operational state). "403": description: Access denied (e.g. user is in namespace, only in Operational state) "406": description: Content type in Accept header not supported. description: | Shut down NetHSM. Authentication behavior varies by NetHSM state: - **Operational**: Requires Administrator authentication - **Locked** or **Unprovisioned**: No authentication required security: - basic: [] # when Operational - {} # when Unprovisioned or Locked x-annotation-role: - Administrator - Public x-annotation-state: - Operational - Unprovisioned - Locked x-annotation-caller-namespace: - Root /system/factory-reset: post: responses: "204": description: About to reset NetHSM. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: Precondition failed (NetHSM was not *Operational*). description: Reset NetHSM to factory settings. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/update: post: responses: "200": description: Successfully verified update image (authenticity, integrity, and version number). content: application/json: schema: $ref: "#/components/schemas/SystemUpdateData" "400": description: Update malformed. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "409": description: Conflict - Major version downgrade is not allowed. "412": description: Precondition failed (NetHSM was not *Operational*). description: Update NetHSM software. requestBody: content: application/octet-stream: schema: format: binary type: string required: true security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/commit-update: post: responses: "204": description: About to update NetHSM. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: | Precondition failed (NetHSM was not *Operational* or update image is not present - call `/update` first). description: Commit update of NetHSM software. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/cancel-update: post: responses: "204": description: Update successfully cancelled. "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: | Precondition failed (NetHSM was not *Operational* or update image is not present - call `/update` first). description: Cancel update of NetHSM software. security: - basic: [] x-annotation-role: - Administrator x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/backup: post: responses: "200": description: Successful retrieval of backup data. content: application/octet-stream: schema: type: string format: binary "401": description: Authentication required but none provided. "403": description: Access denied (e.g. user is in namespace) "406": description: Content type in Accept header not supported. "412": description: | Precondition failed (NetHSM was not *Operational* or *Backup Passphrase* was not set). description: Back up the key store to a backup file. security: - basic: [] x-annotation-role: - Backup x-annotation-state: - Operational x-annotation-caller-namespace: - Root /system/restore: post: responses: "204": description: Successful restore from backup data. "400": description: Bad request - restore did not apply. "406": description: Content type in Accept header not supported. "412": description: | Precondition failed (NetHSM was not *Unprovisioned* or *Operational*). description: | Restore the key store and user store from a backup file. If NetHSM is *Unprovisioned*, then the configuration is restored. requestBody: content: multipart/form-data: schema: $ref: "#/components/schemas/RestoreRequest" security: - {} # for complete restore - basic: [] # for partial restore x-annotation-role: - Public x-annotation-state: - Unprovisioned - Operational x-annotation-caller-namespace: - Root - Namespaced components: schemas: AkPub: example: P256: MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEup7z8QYvkzkBuLryG1SgVQjlPhSFW3PzYn1l3uLNd+pSBxX0OBpslcbnmPFr5wSs/iP46+H8MFlEAYUkYv6uuQ== P384: MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEfQiurLvEmjsAmumRtIqu70HKehRo8A/nVrqQGiR8Rcr+SUujwgtQByORX5BoRtv4sZNJW4FyLGqvXCIF9IV1puob2+9Qq5oEjz4x4malLbFdyXDmQK8o2NpvcbgOr215 type: object properties: P256: type: string P384: type: string Pcr: example: 0: 0f6064779fba55b102a6ecc20498c2020deaf2aebef23716ec293b25873647f8 2: 2b0d25a4a92b4df5205742954243db9d306a4c3277a6b6958bcbaf3d47def26f type: object properties: 0: type: string 2: type: string Passphrase: minLength: 10 type: string ID: pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ minLength: 1 maxLength: 128 type: string UserID: pattern: ^([a-zA-Z0-9][a-zA-Z0-9_.-]*~)?[a-zA-Z0-9][a-zA-Z0-9_.-]*$ minLength: 1 maxLength: 128 type: string Base64: pattern: ^[a-zA-Z0-9+/]+={0,3}$ type: string Switch: enum: - "on" - "off" type: string SystemState: enum: - Unprovisioned - Locked - Operational type: string UserRole: enum: - Administrator - Operator - Metrics - Backup type: string LogLevel: enum: - debug - info - warning - error type: string CreateResourceId: example: id: ab0d5df406ddad1075ab type: object properties: id: type: string required: - id KeyType: enum: - RSA - Curve25519 - EC_P256 - EC_P384 - EC_P521 - EC_P256K1 - BrainpoolP256 - BrainpoolP384 - BrainpoolP512 - Generic type: string TlsKeyType: enum: - RSA - Curve25519 - EC_P256 - EC_P384 - EC_P521 - BrainpoolP256 - BrainpoolP384 - BrainpoolP512 type: string KeyMechanism: enum: - RSA_Decryption_RAW - RSA_Decryption_PKCS1 - RSA_Decryption_OAEP_MD5 - RSA_Decryption_OAEP_SHA1 - RSA_Decryption_OAEP_SHA224 - RSA_Decryption_OAEP_SHA256 - RSA_Decryption_OAEP_SHA384 - RSA_Decryption_OAEP_SHA512 - RSA_Signature_PKCS1 - RSA_Signature_PSS_MD5 - RSA_Signature_PSS_SHA1 - RSA_Signature_PSS_SHA224 - RSA_Signature_PSS_SHA256 - RSA_Signature_PSS_SHA384 - RSA_Signature_PSS_SHA512 - EdDSA_Signature - ECDSA_Signature - BIP340_Signature - AES_Encryption_CBC - AES_Decryption_CBC type: string EncryptMode: enum: - AES_CBC type: string DecryptMode: enum: - RAW - PKCS1 - OAEP_MD5 - OAEP_SHA1 - OAEP_SHA224 - OAEP_SHA256 - OAEP_SHA384 - OAEP_SHA512 - AES_CBC type: string SignMode: enum: - PKCS1 - PSS_MD5 - PSS_SHA1 - PSS_SHA224 - PSS_SHA256 - PSS_SHA384 - PSS_SHA512 - EdDSA - ECDSA - BIP340 type: string KeyList: example: - id: KeyID type: array items: $ref: "#/components/schemas/KeyItem" KeyItem: example: id: KeyID type: object properties: id: $ref: "#/components/schemas/ID" required: - id KeyRestrictions: type: object properties: tags: $ref: "#/components/schemas/TagList" UserList: example: - user: admin - user: backup - user: metrics - user: operator type: array items: $ref: "#/components/schemas/UserItem" UserItem: type: object properties: user: $ref: "#/components/schemas/UserID" required: - user NamespaceList: example: - id: namespace1 type: array items: $ref: "#/components/schemas/NamespaceItem" NamespaceItem: type: object properties: id: $ref: "#/components/schemas/ID" required: - id TagList: example: - berlin - frankfurt type: array items: $ref: "#/components/schemas/ID" KeyMechanisms: type: array items: $ref: "#/components/schemas/KeyMechanism" PrivateKey: example: mechanisms: - RSA_Signature_PSS_SHA256 type: RSA private: primeP: AOnWFZ+JrI/xOXJU04uYCZOiPVUWd6CSbVseEYrYQYxc7dVroePshz29tc+VEOUP5T0O8lXMEkjFAwjW6C9QTAsPyl6jwyOQluMRIkdN4/7BAg3HAMuGd7VmkGyYrnZWW54sLWp1JD6XJG33kF+9OSar9ETPoVyBgK5punfiUFEL primeQ: ANT1kWDdP9hZoFKT49dwdM/S+3ZDnxQa7kZk9p+JKU5RaU9e8pS2GOJljHwkES1FH6CUGeIaUi81tRKe2XZhe/163sEyMcxkaaRbBbTc1v6ZDKILFKKt4eX7LAQfhL/iFlgi6pcyUM8QDrm1QeFgGz11ChM0JuQw1WwkX06lg8iv publicExponent: AQAB restrictions: tags: - berlin type: object properties: mechanisms: $ref: "#/components/schemas/KeyMechanisms" type: $ref: "#/components/schemas/KeyType" private: $ref: "#/components/schemas/KeyPrivateData" restrictions: $ref: "#/components/schemas/KeyRestrictions" required: - mechanisms - type - private PrivateKeyPem: example: arguments: mechanisms: - RSA_Signature_PSS_SHA256 restrictions: tags: - munich key_file: privatekey.pem type: object properties: arguments: type: object properties: mechanisms: $ref: "#/components/schemas/KeyMechanisms" restrictions: $ref: "#/components/schemas/KeyRestrictions" key_file: $ref: "#/components/schemas/PemPrivateKey" KeyPrivateData: type: object properties: primeP: $ref: "#/components/schemas/Base64" primeQ: $ref: "#/components/schemas/Base64" publicExponent: $ref: "#/components/schemas/Base64" data: $ref: "#/components/schemas/Base64" PublicKey: example: mechanisms: - RSA_Signature_PSS_SHA256 type: RSA restrictions: tags: - berlin public: modulus: FhJQl11CiY0ifRHXeAqFh4rdSl6 publicExponent: FhJQl11CiY0ifRHXeAqFh4rdSl6 operations: 242 type: object properties: mechanisms: $ref: "#/components/schemas/KeyMechanisms" type: $ref: "#/components/schemas/KeyType" restrictions: $ref: "#/components/schemas/KeyRestrictions" public: $ref: "#/components/schemas/KeyPublicData" operations: type: integer required: - mechanisms - type - restrictions - operations KeyPublicData: description: | The public key data is either a *modulus* and a *publicExponent* or a *data* field. The *data* field is used for EC keys. This field is null for Generic keys. type: object properties: modulus: $ref: "#/components/schemas/Base64" publicExponent: $ref: "#/components/schemas/Base64" data: $ref: "#/components/schemas/Base64" DistinguishedName: description: | Data used for creation of CSRs. If subjectAltNames is omitted, it is set to the same value as commonName. If it is set to an empty list, no SAN Extension is added. example: countryName: DE stateOrProvinceName: "" localityName: Berlin organizationName: Nitrokey organizationalUnitName: "" commonName: nethsm.local emailAddress: info@nitrokey.com subjectAltNames: ["example.com", "www.example.com"] type: object properties: countryName: type: string stateOrProvinceName: type: string localityName: type: string organizationName: type: string organizationalUnitName: type: string commonName: type: string emailAddress: type: string subjectAltNames: type: array items: type: string required: - commonName InfoData: example: vendor: Nitrokey GmbH product: NetHSM type: object properties: vendor: type: string product: type: string required: - vendor - product HealthStateData: example: state: Unprovisioned type: object properties: state: $ref: "#/components/schemas/SystemState" required: - state MetricsData: example: keyOperations: 1132412 someOtherMetric: 2222 type: object ProvisionRequestData: example: unlockPassphrase: UnlockPassphrase adminPassphrase: Administrator systemTime: "2018-10-30T11:20:50Z" type: object properties: unlockPassphrase: $ref: "#/components/schemas/Passphrase" adminPassphrase: $ref: "#/components/schemas/Passphrase" systemTime: type: string format: date-time required: - unlockPassphrase - adminPassphrase - systemTime UnlockRequestData: example: passphrase: UnlockPassphrase type: object properties: passphrase: $ref: "#/components/schemas/Passphrase" required: - passphrase RandomRequestData: example: length: 5 type: object properties: length: minimum: 1 maximum: 1024 type: integer required: - length RandomData: example: random: VGhlIHE= type: object properties: random: $ref: "#/components/schemas/Base64" required: - random KeyGenerateRequestData: example: mechanisms: - RSA_Signature_PSS_SHA256 type: RSA length: 2048 id: myKey2 type: object properties: mechanisms: $ref: "#/components/schemas/KeyMechanisms" type: $ref: "#/components/schemas/KeyType" length: minimum: 128 maximum: 8192 type: integer id: $ref: "#/components/schemas/ID" restrictions: $ref: "#/components/schemas/KeyRestrictions" required: - mechanisms - type TlsKeyGenerateRequestData: example: type: RSA length: 2048 type: object properties: type: $ref: "#/components/schemas/TlsKeyType" length: minimum: 128 maximum: 8192 type: integer required: - type EncryptRequestData: example: mode: AES_CBC message: nhrfotu32409ru0rgert45z54z099u23r03498uhtrq= iv: aYlwUI4A9zL9tjs4dMAq+A== type: object properties: mode: $ref: "#/components/schemas/EncryptMode" message: $ref: "#/components/schemas/Base64" iv: $ref: "#/components/schemas/Base64" required: - mode - message EncryptData: example: encrypted: HQsTMBVvk19G9wrVQXPT0sDfjIglsJyZJl+VNWVSc0s= iv: aYlwUI4A9zL9tjs4dMAq+A== type: object properties: encrypted: $ref: "#/components/schemas/Base64" iv: $ref: "#/components/schemas/Base64" required: - encrypted - iv DecryptRequestData: example: mode: RAW encrypted: nhrfotu32409ru0rgert45z54z099u23r03498uhtr== type: object properties: mode: $ref: "#/components/schemas/DecryptMode" encrypted: $ref: "#/components/schemas/Base64" iv: $ref: "#/components/schemas/Base64" required: - mode - encrypted DecryptData: example: decrypted: IBCS8Sc4NkG/O+kqInz7mq/+Pr+5eJUJ/QpfwMp7pPjLn02U7ggyUrxJfN97MChHGekvGEK4Q1LCJ2juHTgjxJ94/QoEAN0dWZ7x3NxjlUgw7yBm7ylldVvToum3lWOVo3wPm5ozSGxpslrqgz2Rid9+uH5ytV8//CrkMOlqlUoj0DWMYbp/sUbYDGwG8lcfvKua67AxT3X/exSKCAwBuxPBr2p3DCTHepdmZCyexL809ZvBRopOQ41ve9X1jXqKzihrCPeoCwEok06EGYhPt3/EKFoer401S0MYtz5J1BvO1cv7ITDOYUCG4Ze8aXEjtnt6MMRx4jY7IqssYO8GrA== type: object properties: decrypted: $ref: "#/components/schemas/Base64" required: - decrypted SignRequestData: example: mode: PKCS1 message: 6JudPZqn7OtoL4alZE15Rw0CFIfND+RMmIjzdobLZMM= type: object properties: mode: $ref: "#/components/schemas/SignMode" message: $ref: "#/components/schemas/Base64" required: - mode - message SignData: example: signature: AFJpIZPl7UW1AVqD0BVvWnbn3sFVLmO+wEfoK6eEfkNIrD9D3urCpk8gzkdj4qEmhfxFA2LQ8QoAUOGAouaJ4WSIs7hiksqHntxVkrOgIcmVOE/DZAb7rW3rSnYOd5l31VyE6es0pjZhlI39isMDJ7iXfZ/Eln4mrxdC4opBguiO4AzR2xbkAczrT3YV22AaDcbAaKSLHm0XUnnK8ooAlWy34bmEBo0hQflOLuTagnL7TYKqz9oi6wjTwoT3CO1b0vnWu3pftCLZWzwMoqf0ZVJq6e3usFBL0yqPS6sjin3Gh85/duEv+wJhmGZrkpMpGCuvrFgQfG9pY4TR7YEMYA== type: object properties: signature: $ref: "#/components/schemas/Base64" required: - signature UserPostData: example: realName: Jane User role: Administrator passphrase: My cool passphrase type: object properties: realName: type: string role: $ref: "#/components/schemas/UserRole" passphrase: $ref: "#/components/schemas/Passphrase" required: - realName - role - passphrase UserData: example: realName: Jane User role: Administrator type: object properties: realName: type: string role: $ref: "#/components/schemas/UserRole" required: - realName - role UserPassphrasePostData: example: passphrase: Some cool new passphrase type: object properties: passphrase: $ref: "#/components/schemas/Passphrase" required: - passphrase UnlockPassphraseConfig: example: newPassphrase: This is my new unlock passphrase currentPassphrase: UnlockPassphrase type: object properties: newPassphrase: $ref: "#/components/schemas/Passphrase" currentPassphrase: type: string required: - newPassphrase - currentPassphrase UnattendedBootConfig: example: status: "off" type: object properties: status: $ref: "#/components/schemas/Switch" required: - status NetworkConfig: example: ipAddress: 192.168.1.1 netmask: 255.255.255.0 gateway: 0.0.0.0 type: object properties: ipAddress: type: string netmask: type: string gateway: type: string required: - ipAddress - netmask - gateway LoggingConfig: example: ipAddress: 0.0.0.0 port: 514 logLevel: info type: object properties: ipAddress: type: string port: type: integer logLevel: $ref: "#/components/schemas/LogLevel" required: - ipAddress - port - logLevel BackupPassphraseConfig: example: newPassphrase: This is my new backup passphrase currentPassphrase: backupPassphrase type: object properties: newPassphrase: $ref: "#/components/schemas/Passphrase" currentPassphrase: type: string required: - newPassphrase - currentPassphrase MoveKeyRequest: example: newId: ab0d5df406ddad1075ab type: object properties: newId: $ref: "#/components/schemas/ID" required: - newId RestoreRequest: type: object properties: arguments: type: object properties: backupPassphrase: $ref: "#/components/schemas/Passphrase" systemTime: type: string format: date-time backup_file: type: string format: binary TimeConfig: example: time: "2018-10-30T11:20:50Z" type: object properties: time: type: string format: date-time required: - time SystemInfo: example: softwareVersion: "1.7" softwareBuild: f3f6292 firmwareVersion: 1.0-devel hardwareVersion: prodrive-hermes-1 deviceId: 5UMIP364R2 akPub: P256: MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEup7z8QYvkzkBuLryG1SgVQjlPhSFW3PzYn1l3uLNd+pSBxX0OBpslcbnmPFr5wSs/iP46+H8MFlEAYUkYv6uuQ== P384: MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEfQiurLvEmjsAmumRtIqu70HKehRo8A/nVrqQGiR8Rcr+SUujwgtQByORX5BoRtv4sZNJW4FyLGqvXCIF9IV1puob2+9Qq5oEjz4x4malLbFdyXDmQK8o2NpvcbgOr215 pcr: 0: 0f6064779fba55b102a6ecc20498c2020deaf2aebef23716ec293b25873647f8 2: 2b0d25a4a92b4df5205742954243db9d306a4c3277a6b6958bcbaf3d47def26f type: object properties: softwareVersion: type: string softwareBuild: type: string firmwareVersion: type: string hardwareVersion: type: string deviceId: type: string akPub: $ref: "#/components/schemas/AkPub" pcr: $ref: "#/components/schemas/Pcr" required: - softwareVersion - softwareBuild - firmwareVersion - hardwareVersion - deviceId - akPub - pcr SystemUpdateData: example: releaseNotes: Some new feature is available. type: object properties: releaseNotes: type: string required: - releaseNotes PemPrivateKey: example: | -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAseU3o1Ix2euXUi50ht/mpDYnE2J4maJrIOLmDrmz+jv20hsR vPsWnKevYZqEYmvQFNO2Mv9DB5MZfnJ3jL3Aq71Ls1wqOnW9++bZAvqvEVUtlHh0 5Rz9k1Ga32/OaHHEZj+lG9PlKI8y63K+sKZLuDYiVy1/gzARjpf2hCmTyQSAvtcA 07WXAqorNI8mhcbIhnrGCeKfB8HYJ1T3uk2lXrwXehVaw9KZzg7KuRO0Qnk+IfR6 LZjiKiEB9malzqSx3N20vibI672bMR+fqID2oC+ovNOEdRhPlCnztaY1HsnDhJt8 MDTjlVGveCElvesuSVnNVHmVugDjEYTU1KV3TwIDAQABAoIBAQClSL5QDX9p5R28 apMz+XYW3oWh2h0JScHVVVvBFMNm3S3vet0ZRAV3Wcl2mxUjSN6Vazte2JKTyBWo yXvQFUGdj4x1Qk2t8VWqZYr93KKqLQTjbKPXd/8WUHzf2sbhfcqn4bxrRY4mCB6c aglIocm6hvmTHB/caN33KbQOiX7ZBbwoZG3AKgoJU3SMXnVUfQzl/xnVrWLKESqm 5kL0OTGLP091jZyMhcceh54RIuaJjPU4opL0bm46DLeQE4z20GfGCcRK/CUt4bNc c0wvuOyyzGI5p7QB/HCUJqR33m9ydwDkqC4vrORDxpMaSRNerpoGA+cNHREULh2P gaPydXq5AoGBAN3xIhci5LpIVvscNjPyxD6WQq5EZx251IzTnwQ/5E/+qxfYHvwe qAuLJ2+QvNQBuNKk85jwZsfUgPR6kku9dOt3n61lnrBRgGcqWnR0j8/NbpVe1qOe WArLeijpKKnCZ6uwpE6NND398dCmm3WLZZH64+1eLT8PbX/AIzId5zyzAoGBAM0x vWEsKi4pjNMBdaawJMbHEoDmMuib4t+FkbHDkqqSe/OIkHZ9tDQuHWpzDHmb30Na KNwQSNLwu3QK64z1NcjZUJFmu0+3NxSyI/EvNA9tiGCT5iSonsz04oa51AYt+IK5 7JjMjo128INrQwtRFSYHx3hoVVW06tZNE037NiD1AoGABqeNOx5bt04l9X+CDIqx 4aKFu03nvZdtzQ8nTGxR/ygGnz9mpm6Q4U+5zfmL/9tRXFd/yk0i98jiWPI34rd6 gvjiO8O5P1YiQHWforBAA54IO8hNLTi5MRGqxwE+q+BdVWOFeal4MIelsXjdXmfg ksDwBpT1TFe9E8CCDaWh4ksCgYAhHCiR2H2J61x04+RnHD8i8BZ1RC/sxtKp/LSQ uZ0d9vsXRe8Bn7EHRnWqqpvVt6gkBxVWxS3rE7s7s1Nk8GBYY3CTtb790vOJXGFe Vp6Q6ry50MOvIKJXMiCnWq7yvFJATd32nfNWsl2G5zTvS4sdEt5F+Jfkd4f5QoCd 8a4/TQKBgQDEdY3XTibkDt80zUFIP6RRAyfM6p2grk+o08De0BBZD/1GX9V9ARNT bC3+2qXXDYGxbMWgsoqsQTREJD78+sdD3q+IfIc1m7XvuIgyLMAalm+Kd1HlUF/J 7VCKjgchT0OKwmi0d52TEOiz6U35Jv4GWBstsh1KVpHYiTnwnhAwKg== -----END RSA PRIVATE KEY----- type: string PemPublicKey: example: | -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx7ghfro+VEepYmy2V7HP n5PSRdmGzxewcpmzxTtrZ10BygbEqhPsAr4fWI9pG7iRXzeza7DMjrQptzKsfSy6 dBFmSEZer+hJxuOdhBG/FX6pjwRrZpbOQxyr+aTlE3jm2XP12Cqx0wsYGIoJlWHb Gb90IAx9zpdYQgHoJZ4x5ims5vo7h3puPEyVycJH5fMBB9h+2Bxc4BxaPKMm15JR 1B7ToB3g16SJY2B1t/aqNmqSBZC4HP1fCuSbBm83OgqRhdk1P6r/vqOVKrxVupDq Kkdcf/dRBiQalJ9tQbVbs9OOYfQ6n25GvJTvGtqOEuggit32tV16JXCZjnYePAvt NwIDAQAB -----END PUBLIC KEY----- type: string PemCSR: example: | -----BEGIN CERTIFICATE REQUEST----- MIIC6TCCAdECAQAwajEVMBMGA1UEAwwMbmV0aHNtLmxvY2FsMQswCQYDVQQGEwJE RTEPMA0GA1UEBwwGQmVybGluMREwDwYDVQQKDAhOaXRyb2tleTEgMB4GCSqGSIb3 DQEJARYRaW5mb0BuaXRyb2tleS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw ggEKAoIBAQDHuCF+uj5UR6libLZXsc+fk9JF2YbPF7BymbPFO2tnXQHKBsSqE+wC vh9Yj2kbuJFfN7NrsMyOtCm3Mqx9LLp0EWZIRl6v6EnG452EEb8VfqmPBGtmls5D HKv5pOUTeObZc/XYKrHTCxgYigmVYdsZv3QgDH3Ol1hCAeglnjHmKazm+juHem48 TJXJwkfl8wEH2H7YHFzgHFo8oybXklHUHtOgHeDXpIljYHW39qo2apIFkLgc/V8K 5JsGbzc6CpGF2TU/qv++o5UqvFW6kOoqR1x/91EGJBqUn21BtVuz045h9Dqfbka8 lO8a2o4S6CCK3fa1XXolcJmOdh48C+03AgMBAAGgOjA4BgkqhkiG9w0BCQ4xKzAp MCcGA1UdEQQgMB6CC2V4YW1wbGUuY29tgg93d3cuZXhhbXBsZS5jb20wDQYJKoZI hvcNAQELBQADggEBABD92ZM2fDcq8hNl/SrHIXyFdZIV+uGWVultZ22isLRuJbuh jb+onDXT9F5mKa4JAoAWvBPnQZpO1d/tf2bPhg9F46Fd/1zd79dvStRrUTjmxdN3 6M2ExIRekBRyx5o5h5yjve6tmG1vWOqgcczJwQFG5GawiaBNVenXjJROBx1ad9ou W1cCAvKISOD9OTHsw/Amksu3HyPUW+/celAF4GOzlT2F41rNMoiW0rCTiiJfBotE FvTLWty55EECqoWbAOupRKutt/fu2zewTHINYAR+8NEZDOm8RxLoq4zqc+p1y5ax n9jM28FJC+nYGFwrOmfMV5P/CMxjpp/6pttAvVY= -----END CERTIFICATE REQUEST----- type: string PemCert: example: | -----BEGIN CERTIFICATE----- MIIEvDCCAqQCCQCZ9VKHZSKydDANBgkqhkiG9w0BAQsFADAgMQ4wDAYDVQQIDAVo ZWxsbzEOMAwGA1UEBwwFaGVsbG8wHhcNMTgxMDMwMTI0MDQ3WhcNMTkxMDMwMTI0 MDQ3WjAgMQ4wDAYDVQQIDAVoZWxsbzEOMAwGA1UEBwwFaGVsbG8wggIiMA0GCSqG SIb3DQEBAQUAA4ICDwAwggIKAoICAQC8WRImgeu4U6Yg5q0/SvoieQL5JwPHaCrN 6Cc0mj8pnzTBu/f0QYNentcnu0EclD99kla6/gdiJnt0b/IT23o37+t2n0BvEgVQ MJxJ/BjIqSZCykq4SWHKia1OS7tJKE2Q/hgGq/RQJ0zecWKA9SuafXDt0plw0saz P8ZosFyToMYnPB54SzXj4qeD5t2L2dOamTTyziw/GJDGdwssImEDfeWyMRRyHcIa u9HNGaTxjCdBGzCR+PEX3ZHhGzl5iMlgtZUICgXMgAvFZHHEYNtyCW9ZzUB2ZKE2 nMbu8hbl7GXRCdJaAqlJfKiGp/WvbmrLhCzcwqhu4UnqGXOxeEQryrkPAbiLafqb fPLHB7dr8OEGlUzp1SCHR1JxwdBVohuO2lL+O5nMD3ZVdVnh2F5Et6I9lO4w9+5n aI6pmO4oy9PsqKvUjxVnEeo1Ee1n9o/4T6fe6XBIQLPqEmy2IXynZP0eJn1Yu9SF TkTSmJ+jRiU7EMaagQrM4Ds5seVNVWKOvUjDQCV+QRZaaPcrkMoFtjLCVMhLgy7M /Dfl63qCcdVkPwdbI/apjfG8qMrez4k3qAZDYgS3fujyuq9wv7xbq2+o0Ck4Ono2 mMAA6JDSZr8XwR3ac/UK1KGv+weh1fOVO+c6mSN9M+W1MtkJS+i4/Aj2yDCJzVk3 GZpd5/E6WwIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQAB+8+1dk20P6R+RvDRs1mo e1CegaPH2bl9t1WVuXJIUkrIGDceVr5f19pcaNQRYwZuoQd8VQXCZUpWbo//TWxl ItS3prQgcrfcTi7gCzp1+q1bZk6H21tzESDJTXPFp019/ypdUB4Jsty7qQL73sE3 nj67DH+srPCknAhfFag0dPOOjAY19IrIomtBMlvYNpb5XupEUAQFCjk6VdLVAzzl M5Swj+kmLA0OUHTF2zAwj2k+B9RAkbetu/lXLwUiiQNG00j8YP03lErxDd29m2jl NFlSn8YYsgzmihF5fUFTJXP5tS7lF4FnLNbw9pfdeVZBT1uTOcckmFv6n6edttZS FhC70hBB8tFFtemGFquZ0N7w8O7DmIYI936n283rzxyuWdi+JqOUQ0KzpGbFOP3t AOdVcx/JW8kjDdWRcRDr85M4MnkG6HEzW4uzGBtxBplL7KH0L8LX+lx6ySjIrbRD QtwBxwZGtHZJAqskO6vobzzybCKuVUaQwkPrQsK5iLA6Nn1Yxu6XmtlvoPeNIc63 Pa3ix8vNFbBTtS6iBdbOPse5qgRV0DC94ocedzKw4QzQRa5REIniJ2X8hVoVAcBh 3nQKyZApl2I/pZMlbZ0Cg5yxjhBaxKwci7jyoMerMMo2EdbZN87gP+2x6tKuY1MO 35mqzHn+FjWq0eAtpzhO5Q== -----END CERTIFICATE----- type: string responses: {} parameters: {} examples: {} requestBodies: {} headers: {} securitySchemes: basic: description: | NetHSM supports Basic Authentication. type: http scheme: basic links: {} callbacks: {} nethsm-sdk-rs-3.0.0/src/apis/configuration.rs000064400000000000000000000027641046102023000172740ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, pub user_agent: Option, pub client: ureq::Agent, pub basic_auth: Option, pub oauth_access_token: Option, pub bearer_access_token: Option, pub api_key: Option, } pub type BasicAuth = (String, Option); #[derive(Debug, Clone)] pub struct ApiKey { pub prefix: Option, pub key: String, } impl Configuration { pub fn new() -> Configuration { Configuration::default() } } impl Default for Configuration { fn default() -> Self { Configuration { base_path: "https://nethsmdemo.nitrokey.com/api/v1".to_owned(), user_agent: Some("OpenAPI-Generator/v1/rust".to_owned()), client: ureq::config::Config::builder() .http_status_as_error(false) .build() .new_agent(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, api_key: None, } } } nethsm-sdk-rs-3.0.0/src/apis/default_api.rs000064400000000000000000005270531046102023000167050ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ use super::{configuration, Error}; use crate::apis::ResponseContent; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdPutBody { ApplicationJson(crate::models::PrivateKey), MultipartFormData(String), } impl KeysKeyIdPutBody { pub fn content_type(&self) -> &'static str { match self { Self::ApplicationJson(_) => "application/json", Self::MultipartFormData(_) => "multipart/form-data", } } pub fn is_json(&self) -> bool { match self { Self::ApplicationJson(_) => true, Self::MultipartFormData(_) => false, } } pub fn get_string(&self) -> String { match self { Self::ApplicationJson(_) => "".to_string(), Self::MultipartFormData(s) => s.clone(), } } } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysPostBody { ApplicationJson(crate::models::PrivateKey), MultipartFormData(String), } impl KeysPostBody { pub fn content_type(&self) -> &'static str { match self { Self::ApplicationJson(_) => "application/json", Self::MultipartFormData(_) => "multipart/form-data", } } pub fn is_json(&self) -> bool { match self { Self::ApplicationJson(_) => true, Self::MultipartFormData(_) => false, } } pub fn get_string(&self) -> String { match self { Self::ApplicationJson(_) => "".to_string(), Self::MultipartFormData(s) => s.clone(), } } } /// struct for typed errors of method [`config_backup_passphrase_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigBackupPassphrasePutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigBackupPassphrasePutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_logging_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigLoggingGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigLoggingGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_logging_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigLoggingPutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigLoggingPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_network_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigNetworkGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigNetworkGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_network_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigNetworkPutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigNetworkPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_time_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTimeGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigTimeGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_time_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTimePutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigTimePutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_tls_cert_pem_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTlsCertPemGetError { Status401(), Status403(), Status406(), Status412(), Status415(), UnknownValue(serde_json::Value), } impl ConfigTlsCertPemGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), 415 => Ok(Self::Status415()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_tls_cert_pem_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTlsCertPemPutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigTlsCertPemPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_tls_csr_pem_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTlsCsrPemPostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigTlsCsrPemPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_tls_generate_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTlsGeneratePostError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigTlsGeneratePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_tls_public_pem_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigTlsPublicPemGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigTlsPublicPemGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_unattended_boot_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigUnattendedBootGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigUnattendedBootGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_unattended_boot_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigUnattendedBootPutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigUnattendedBootPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`config_unlock_passphrase_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ConfigUnlockPassphrasePutError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ConfigUnlockPassphrasePutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`health_alive_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum HealthAliveGetError { Status406(), Status412(), UnknownValue(serde_json::Value), } impl HealthAliveGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`health_ready_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum HealthReadyGetError { Status406(), Status412(), UnknownValue(serde_json::Value), } impl HealthReadyGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`health_state_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum HealthStateGetError { Status406(), UnknownValue(serde_json::Value), } impl HealthStateGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 406 => Ok(Self::Status406()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`info_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum InfoGetError { Status406(), UnknownValue(serde_json::Value), } impl InfoGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 406 => Ok(Self::Status406()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_generate_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysGeneratePostError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysGeneratePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_cert_delete`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdCertDeleteError { Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdCertDeleteError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_cert_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdCertGetError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdCertGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_cert_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdCertPutError { Status401(), Status403(), Status406(), Status409(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdCertPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 409 => Ok(Self::Status409()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_csr_pem_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdCsrPemPostError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdCsrPemPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_decrypt_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdDecryptPostError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdDecryptPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_delete`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdDeleteError { Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdDeleteError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_encrypt_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdEncryptPostError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdEncryptPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdGetError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_move_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdMovePostError { Status400(), Status401(), Status403(), Status404(), Status409(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdMovePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 409 => Ok(Self::Status409()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_public_pem_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdPublicPemGetError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdPublicPemGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdPutError { Status400(), Status401(), Status403(), Status406(), Status409(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 409 => Ok(Self::Status409()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_restrictions_tags_tag_delete`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdRestrictionsTagsTagDeleteError { Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdRestrictionsTagsTagDeleteError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_restrictions_tags_tag_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdRestrictionsTagsTagPutError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdRestrictionsTagsTagPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_id_sign_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyIdSignPostError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyIdSignPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_key_prefix_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysKeyPrefixGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysKeyPrefixGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`keys_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum KeysPostError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl KeysPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`lock_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum LockPostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl LockPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`metrics_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum MetricsGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl MetricsGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`namespaces_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum NamespacesGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl NamespacesGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`namespaces_namespace_id_delete`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum NamespacesNamespaceIdDeleteError { Status400(), Status401(), Status403(), Status404(), Status412(), UnknownValue(serde_json::Value), } impl NamespacesNamespaceIdDeleteError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`namespaces_namespace_id_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum NamespacesNamespaceIdPutError { Status400(), Status401(), Status403(), Status406(), Status409(), Status412(), UnknownValue(serde_json::Value), } impl NamespacesNamespaceIdPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 409 => Ok(Self::Status409()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`provision_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum ProvisionPostError { Status400(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl ProvisionPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`random_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum RandomPostError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl RandomPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_backup_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemBackupPostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemBackupPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_cancel_update_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemCancelUpdatePostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemCancelUpdatePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_commit_update_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemCommitUpdatePostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemCommitUpdatePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_factory_reset_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemFactoryResetPostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemFactoryResetPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_info_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemInfoGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemInfoGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_reboot_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemRebootPostError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemRebootPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_restore_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemRestorePostError { Status400(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl SystemRestorePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_shutdown_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemShutdownPostError { Status401(), Status403(), Status406(), UnknownValue(serde_json::Value), } impl SystemShutdownPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`system_update_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SystemUpdatePostError { Status400(), Status401(), Status403(), Status406(), Status409(), Status412(), UnknownValue(serde_json::Value), } impl SystemUpdatePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 409 => Ok(Self::Status409()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`unlock_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UnlockPostError { Status400(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UnlockPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersGetError { Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersPostError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_delete`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdDeleteError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdDeleteError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdGetError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_passphrase_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdPassphrasePostError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdPassphrasePostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_post`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdPostError { Status400(), Status401(), Status403(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdPostError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdPutError { Status400(), Status401(), Status403(), Status406(), Status409(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 406 => Ok(Self::Status406()), 409 => Ok(Self::Status409()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_tags_get`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdTagsGetError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdTagsGetError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_tags_tag_delete`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdTagsTagDeleteError { Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdTagsTagDeleteError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// struct for typed errors of method [`users_user_id_tags_tag_put`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum UsersUserIdTagsTagPutError { Status400(), Status401(), Status403(), Status404(), Status406(), Status412(), UnknownValue(serde_json::Value), } impl UsersUserIdTagsTagPutError { fn new(status: u16, data: &[u8]) -> Result { // to do: support payloads once added to API spec match status { 400 => Ok(Self::Status400()), 401 => Ok(Self::Status401()), 403 => Ok(Self::Status403()), 404 => Ok(Self::Status404()), 406 => Ok(Self::Status406()), 412 => Ok(Self::Status412()), _ => { if data.is_empty() { Ok(Self::UnknownValue(serde_json::Value::Null)) } else { serde_json::from_slice(data).map(Self::UnknownValue) } } } } } /// Update the backup passphrase. If the backup passphrase is not set yet, use \"\" as currentPassphrase. *WARNING:* Like the unlock passphrase, this configuration can't be reset by an admin user without knowing the current value, so if the backup passphrase is lost, neither can it be reset to a new value nor can the created backups be restored. pub fn config_backup_passphrase_put( configuration: &configuration::Configuration, backup_passphrase_config: crate::models::BackupPassphraseConfig, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/config/backup-passphrase", local_var_configuration.base_path ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(backup_passphrase_config); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigBackupPassphrasePutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get logging configuration. Protocol is always syslog over UDP. Configurable are IP adress and port, log level. pub fn config_logging_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/logging", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigLoggingGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Configure log level and destination. pub fn config_logging_put( configuration: &configuration::Configuration, logging_config: crate::models::LoggingConfig, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/logging", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(logging_config); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigLoggingPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get network configuration. IP address, netmask, router. pub fn config_network_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/network", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigNetworkGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Configure network. pub fn config_network_put( configuration: &configuration::Configuration, network_config: crate::models::NetworkConfig, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/network", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(network_config); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigNetworkPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get system time. pub fn config_time_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/time", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTimeGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Configure system time. pub fn config_time_put( configuration: &configuration::Configuration, time_config: crate::models::TimeConfig, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/time", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(time_config); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTimePutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get certificate for NetHSMs https API. pub fn config_tls_cert_pem_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/tls/cert.pem", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/x-pem-file"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::string(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTlsCertPemGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Set certificate for NetHSMs https API e.g. to replace self-signed intital certificate. pub fn config_tls_cert_pem_put( configuration: &configuration::Configuration, body: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/tls/cert.pem", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/x-pem-file"); let local_var_result = local_var_req_builder.send(body); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTlsCertPemPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get NetHSM certificate signing request e.g. to replace self-signed intital certificate. pub fn config_tls_csr_pem_post( configuration: &configuration::Configuration, distinguished_name: crate::models::DistinguishedName, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/tls/csr.pem", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/x-pem-file"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(distinguished_name); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::string(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTlsCsrPemPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Generate a new pair of public and private key for NetHSM's https API. pub fn config_tls_generate_post( configuration: &configuration::Configuration, tls_key_generate_request_data: crate::models::TlsKeyGenerateRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config/tls/generate", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(tls_key_generate_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTlsGeneratePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get public key for NetHSMs https API. pub fn config_tls_public_pem_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/config/tls/public.pem", local_var_configuration.base_path ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/x-pem-file"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::string(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigTlsPublicPemGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Read unattended boot configuration: is it on or off? pub fn config_unattended_boot_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/config/unattended-boot", local_var_configuration.base_path ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigUnattendedBootGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Configure unattended boot: switch it on or off (flip the switch). pub fn config_unattended_boot_put( configuration: &configuration::Configuration, unattended_boot_config: crate::models::UnattendedBootConfig, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/config/unattended-boot", local_var_configuration.base_path ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(unattended_boot_config); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigUnattendedBootPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Update the unlock passphrase. *WARNING:* The unlock passphrase can't be reset by an admin user without knowing the current value, so if the unlock passphrase is lost, neither can it be reset to a new value nor can the NetHSM be unlocked. pub fn config_unlock_passphrase_put( configuration: &configuration::Configuration, unlock_passphrase_config: crate::models::UnlockPassphraseConfig, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/config/unlock-passphrase", local_var_configuration.base_path ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(unlock_passphrase_config); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ConfigUnlockPassphrasePutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve whether NetHSM is fully started but not ready to take traffic. This corresponds to the state *Locked* or *Unprovisioned*. pub fn health_alive_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health/alive", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { HealthAliveGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve whether NetHSM is in state *Operational* and thus ready to take traffic. pub fn health_ready_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health/ready", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { HealthReadyGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve the state of NetHSM. pub fn health_state_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health/state", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { HealthStateGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Information about the vendor and product. pub fn info_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/info", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { InfoGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Generate a pair of public and private key and store it in NetHSM. KeyID is optional as a parameter and will be generated by NetHSM if not present. The key is stored in the caller's namespace. pub fn keys_generate_post( configuration: &configuration::Configuration, key_generate_request_data: crate::models::KeyGenerateRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/keys/generate", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(key_generate_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysGeneratePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get a list of the identifiers of all keys that are currently stored in NetHSM. If the caller is in a namespace, only keys in that namespace are returned. Separate requests need to be made to request the individual key data. To fetch only a subset of keys, consider using `/keys/pfx*`. pub fn keys_get( configuration: &configuration::Configuration, filter: Option<&str>, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(local_var_str) = filter { local_var_req_builder = local_var_req_builder.query_pairs([("filter", local_var_str.to_string().as_str())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Delete the certificate. pub fn keys_key_id_cert_delete( configuration: &configuration::Configuration, key_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/cert", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, DELETE, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdCertDeleteError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve a stored certificate in the exact format it was stored. pub fn keys_key_id_cert_get( configuration: &configuration::Configuration, key_id: &str, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/cert", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/octet-stream"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::bytes(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdCertGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Store a certificate. Maximum size 1MB. The Content-Type must be application/octet-stream. pub fn keys_key_id_cert_put( configuration: &configuration::Configuration, key_id: &str, body: std::vec::Vec, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/cert", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/octet-stream"); let local_var_result = local_var_req_builder.send(body); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdCertPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve a certificate signing request in PEM format. pub fn keys_key_id_csr_pem_post( configuration: &configuration::Configuration, key_id: &str, distinguished_name: crate::models::DistinguishedName, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/csr.pem", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/x-pem-file"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(distinguished_name); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::string(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdCsrPemPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Decrypt an encrypted message with the secret key. pub fn keys_key_id_decrypt_post( configuration: &configuration::Configuration, key_id: &str, decrypt_request_data: crate::models::DecryptRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/decrypt", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(decrypt_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdDecryptPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Delete a pair of public and private key. pub fn keys_key_id_delete( configuration: &configuration::Configuration, key_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, DELETE, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdDeleteError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Encrypt a message with the secret key. pub fn keys_key_id_encrypt_post( configuration: &configuration::Configuration, key_id: &str, encrypt_request_data: crate::models::EncryptRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/encrypt", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(encrypt_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdEncryptPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve a single public key. pub fn keys_key_id_get( configuration: &configuration::Configuration, key_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Move a key by changing its identifier. The key content remains unchanged, but it will be accessible under the new identifier. The old identifier becomes invalid after successful move. pub fn keys_key_id_move_post( configuration: &configuration::Configuration, key_id: &str, move_key_request: crate::models::MoveKeyRequest, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/move", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(move_key_request); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdMovePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve public key in PEM format. pub fn keys_key_id_public_pem_get( configuration: &configuration::Configuration, key_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/public.pem", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/x-pem-file"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::string(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdPublicPemGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Import a private key into NetHSM and store it under the *KeyID* path. The public key will be automatically derived. The parameters of the key can be passed as a PEM file or a JSON object. The key is stored in the caller's namespace. pub fn keys_key_id_put( configuration: &configuration::Configuration, key_id: &str, body: KeysKeyIdPutBody, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let body_json = body.is_json(); local_var_req_builder = local_var_req_builder.header("content-type", body.content_type()); let local_var_result = if body_json { local_var_req_builder.send_json(body) } else { local_var_req_builder.send(body.get_string().as_str()) }; let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Delete a tag from the authorized set pub fn keys_key_id_restrictions_tags_tag_delete( configuration: &configuration::Configuration, tag: &str, key_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/restrictions/tags/{Tag}", local_var_configuration.base_path, Tag = crate::apis::urlencode(tag), KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, DELETE, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdRestrictionsTagsTagDeleteError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Add a tag to the authorized set pub fn keys_key_id_restrictions_tags_tag_put( configuration: &configuration::Configuration, tag: &str, key_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/restrictions/tags/{Tag}", local_var_configuration.base_path, Tag = crate::apis::urlencode(tag), KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdRestrictionsTagsTagPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Sign a message with the secret key. pub fn keys_key_id_sign_post( configuration: &configuration::Configuration, key_id: &str, sign_request_data: crate::models::SignRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyID}/sign", local_var_configuration.base_path, KeyID = crate::apis::urlencode(key_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(sign_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyIdSignPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get a list of the identifiers of all keys that have a KeyID that starts with KeyPrefix. If the caller is in a namespace, only keys in that namespace are returned. Separate requests need to be made to request the individual key data. pub fn keys_key_prefix_get( configuration: &configuration::Configuration, key_prefix: &str, filter: Option<&str>, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/keys/{KeyPrefix}*", local_var_configuration.base_path, KeyPrefix = crate::apis::urlencode(key_prefix) ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(local_var_str) = filter { local_var_req_builder = local_var_req_builder.query_pairs([("filter", local_var_str.to_string().as_str())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysKeyPrefixGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Import a private key into NetHSM and let NetHSM generate a KeyID. The public key will be automatically derived. The parameters of the key can be passed as a PEM file or a JSON object. The key is stored in the caller's namespace. pub fn keys_post( configuration: &configuration::Configuration, body: KeysPostBody, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let body_json = body.is_json(); local_var_req_builder = local_var_req_builder.header("content-type", body.content_type()); let local_var_result = if body_json { local_var_req_builder.send_json(body) } else { local_var_req_builder.send(body.get_string().as_str()) }; let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { KeysPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Brings an *Operational* NetHSM into *Locked* state. pub fn lock_post( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/lock", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { LockPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get metrics. Precondition: NetHSM is *Operational* and a **R-Metrics** can be authenticated. pub fn metrics_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/metrics", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { MetricsGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get a list of all created namespaces. Note that users may be assigned namespaces not present in this list, as long as the namespace has not been created. pub fn namespaces_get( configuration: &configuration::Configuration, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/namespaces", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { NamespacesGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Delete a namespace. **WARNING: all keys from that namespace are deleted.** pub fn namespaces_namespace_id_delete( configuration: &configuration::Configuration, namespace_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/namespaces/{NamespaceID}", local_var_configuration.base_path, NamespaceID = crate::apis::urlencode(namespace_id) ); let mut local_var_req_builder = create_request!(local_var_client, DELETE, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { NamespacesNamespaceIdDeleteError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Create a namespace on keyfender. All users in that namespace can now be used, and all user management power is delegated to admins in that namespace. pub fn namespaces_namespace_id_put( configuration: &configuration::Configuration, namespace_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/namespaces/{NamespaceID}", local_var_configuration.base_path, NamespaceID = crate::apis::urlencode(namespace_id) ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { NamespacesNamespaceIdPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Initial provisioning, only available in *Unprovisioned* state. *WARNING:* The unlock passphrase can't be reset by an admin user without knowing the current value, so if the unlock passphrase is lost, neither can it be reset to a new value nor can the NetHSM be unlocked. pub fn provision_post( configuration: &configuration::Configuration, provision_request_data: crate::models::ProvisionRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/provision", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(provision_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { ProvisionPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Retrieve cryptographically strong random bytes from NetHSM. Precondition: NetHSM is *Operational* and a **R-Operator** can be authenticated. pub fn random_post( configuration: &configuration::Configuration, random_request_data: crate::models::RandomRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/random", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(random_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { RandomPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Back up the key store to a backup file. pub fn system_backup_post( configuration: &configuration::Configuration, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/backup", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/octet-stream"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::bytes(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemBackupPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Cancel update of NetHSM software. pub fn system_cancel_update_post( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/cancel-update", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemCancelUpdatePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Commit update of NetHSM software. pub fn system_commit_update_post( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/commit-update", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemCommitUpdatePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Reset NetHSM to factory settings. pub fn system_factory_reset_post( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/factory-reset", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemFactoryResetPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get detailed system information, including firmware, system, and hardware version. pub fn system_info_get( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/info", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemInfoGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Reboot NetHSM. pub fn system_reboot_post( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/reboot", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemRebootPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Restore the key store and user store from a backup file. If NetHSM is *Unprovisioned*, then the configuration is restored. pub fn system_restore_post( configuration: &configuration::Configuration, arguments: Option, backup_file: Option>, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/restore", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let mut local_var_multipart = ::multipart::client::lazy::Multipart::new(); if let Some(backup_file) = backup_file { local_var_multipart.add_stream( "backup_file", ::std::io::Cursor::new(backup_file), None::<&str>, None, ); } if let Some(arguments) = arguments { let arguments = ::serde_json::to_vec(&arguments)?; local_var_multipart.add_stream( "arguments", ::std::io::Cursor::new(arguments), None::<&str>, None, ); } let mut local_var_multipart = local_var_multipart.prepare()?; local_var_req_builder = local_var_req_builder.header( "content-type", &format!( "multipart/form-data; boundary={}", local_var_multipart.boundary() ), ); let local_var_result = local_var_req_builder.send(ureq::SendBody::from_reader(&mut local_var_multipart)); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemRestorePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Shut down NetHSM. Authentication behavior varies by NetHSM state: - **Operational**: Requires Administrator authentication - **Locked** or **Unprovisioned**: No authentication required pub fn system_shutdown_post( configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/shutdown", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemShutdownPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Update NetHSM software. pub fn system_update_post( configuration: &configuration::Configuration, body: std::vec::Vec, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/system/update", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/octet-stream"); let local_var_result = local_var_req_builder.send(body); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { SystemUpdatePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Brings a *Locked* NetHSM into *Operational* state. pub fn unlock_post( configuration: &configuration::Configuration, unlock_request_data: crate::models::UnlockRequestData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/unlock", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(unlock_request_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UnlockPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get a list of all user ids that have accounts on NetHSM. If the caller is in a namespace, return only users in that namespace. pub fn users_get( configuration: &configuration::Configuration, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/users", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Create a new user on NetHSM, inheriting the caller's namespace. The user-ID is generated by NetHSM. pub fn users_post( configuration: &configuration::Configuration, user_post_data: crate::models::UserPostData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/users", local_var_configuration.base_path); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(user_post_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Delete a user from keyfender. pub fn users_user_id_delete( configuration: &configuration::Configuration, user_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id) ); let mut local_var_req_builder = create_request!(local_var_client, DELETE, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdDeleteError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get user info: name and role. pub fn users_user_id_get( configuration: &configuration::Configuration, user_id: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id) ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Update the passphrase. pub fn users_user_id_passphrase_post( configuration: &configuration::Configuration, user_id: &str, user_passphrase_post_data: crate::models::UserPassphrasePostData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}/passphrase", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(user_passphrase_post_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdPassphrasePostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Create a new user on NetHSM, in the namespace specified as a prefix in the path with the format 'namespace~'. For example, a POST request on \"https://nethsm.local/v1/users/namespace1~\" will generate a user-ID and create that user in \"namespace1\". The namespace prefix *must* be present: for creating users without a namespace, use a POST on \"/v1/users\". pub fn users_user_id_post( configuration: &configuration::Configuration, user_id: &str, user_post_data: crate::models::UserPostData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id) ); let mut local_var_req_builder = create_request!(local_var_client, POST, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(user_post_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdPostError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Create a user on keyfender. The new user must either be in the same namespace as the caller, or be in a namespace not created yet if the caller has no namespace. pub fn users_user_id_put( configuration: &configuration::Configuration, user_id: &str, user_post_data: crate::models::UserPostData, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id) ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; local_var_req_builder = local_var_req_builder.header("content-type", "application/json"); let local_var_result = local_var_req_builder.send_json(user_post_data); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Get the list of tags set to an Operator user. pub fn users_user_id_tags_get( configuration: &configuration::Configuration, user_id: &str, ) -> Result>, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}/tags", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id) ); let mut local_var_req_builder = create_request!(local_var_client, GET, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let accept_str = "application/json"; local_var_req_builder = local_var_req_builder.header("accept", accept_str); let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::deserialized(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdTagsGetError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Delete a tag from the Operator user pub fn users_user_id_tags_tag_delete( configuration: &configuration::Configuration, user_id: &str, tag: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}/tags/{Tag}", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id), Tag = crate::apis::urlencode(tag) ); let mut local_var_req_builder = create_request!(local_var_client, DELETE, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdTagsTagDeleteError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } /// Add a tag to the Operator user. pub fn users_user_id_tags_tag_put( configuration: &configuration::Configuration, user_id: &str, tag: &str, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!( "{}/users/{UserID}/tags/{Tag}", local_var_configuration.base_path, UserID = crate::apis::urlencode(user_id), Tag = crate::apis::urlencode(tag) ); let mut local_var_req_builder = create_request!(local_var_client, PUT, local_var_uri_str.as_str()); local_var_req_builder = local_var_req_builder .config() .http_status_as_error(false) .build(); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { let value = super::basic_auth(local_var_auth_conf); local_var_req_builder = local_var_req_builder.header("authorization", &value); }; let local_var_result = local_var_req_builder.send_empty(); let local_var_resp = local_var_result?; let local_var_status = local_var_resp.status().as_u16(); if local_var_status < 400 { ResponseContent::unit(local_var_resp) } else { ResponseContent::new(local_var_resp, |data| { UsersUserIdTagsTagPutError::new(local_var_status, data).map_err(From::from) }) .and_then(|content| Err(Error::ResponseError(content))) } } nethsm-sdk-rs-3.0.0/src/apis/mod.rs000064400000000000000000000142271046102023000152010ustar 00000000000000use std::collections::HashMap; use std::error; use std::fmt; use base64::{engine::general_purpose, Engine}; use serde::de::DeserializeOwned; macro_rules! create_request { ($agent:expr, GET, $uri:expr) => { $agent.get($uri).force_send_body() }; ($agent:expr, POST, $uri:expr) => { $agent.post($uri) }; ($agent:expr, PUT, $uri:expr) => { $agent.put($uri) }; ($agent:expr, DELETE, $uri:expr) => { $agent.delete($uri).force_send_body() }; } fn get_header_map(response: &http::Response) -> HashMap { let mut headers = HashMap::new(); let names = response.headers(); for (name, value) in names { if let Ok(value) = value.to_str() { headers.insert(name.as_str().into(), value.into()); } } headers } #[derive(Debug, Clone)] pub struct ResponseContent { pub status: u16, pub content: Vec, pub entity: T, pub headers: HashMap, } impl ResponseContent { fn new(response: http::Response, f: F) -> Result> where F: FnOnce(&[u8]) -> Result>, { use std::io::Read; let status = response.status().as_u16(); let headers = get_header_map(&response); let mut content = Vec::new(); response .into_body() .into_reader() .read_to_end(&mut content)?; let entity = f(&content)?; Ok(Self { status, content, entity, headers, }) } } impl ResponseContent<()> { fn unit(response: http::Response) -> Result> { Self::new(response, |_| Ok(())) } } impl ResponseContent> { fn bytes(response: http::Response) -> Result> { Self::new(response, |content| Ok(content.into())) } } impl ResponseContent { fn string(response: http::Response) -> Result> { Self::new(response, |content| { String::from_utf8(content.into()).map_err(From::from) }) } } impl ResponseContent { fn deserialized(response: http::Response) -> Result> { Self::new(response, |content| { serde_json::from_slice(content).map_err(From::from) }) } } #[derive(Debug)] pub enum Error { Multipart { field: Option, error: std::io::Error, }, Ureq(ureq::Error), Serde(serde_json::Error), Io(std::io::Error), ResponseError(ResponseContent), StringParse(std::string::FromUtf8Error), } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Multipart { field, error } => { let error = match field { Some(field) => format!("failed to encode {field}: {error}"), None => error.to_string(), }; ("multipart", error) } Error::Ureq(e) => ("ureq", e.to_string()), Error::Serde(e) => ("serde", e.to_string()), Error::Io(e) => ("IO", e.to_string()), Error::ResponseError(e) => ("response", format!("status code {}", e.status)), Error::StringParse(e) => ("string", e.to_string()), }; write!(f, "error in {}: {}", module, e) } } impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Multipart { error, .. } => error, Error::Ureq(e) => e, Error::Serde(e) => e, Error::Io(e) => e, Error::ResponseError(_) => return None, Error::StringParse(e) => e, }) } } impl From> for Error { fn from(e: multipart::client::lazy::LazyError<'_, std::io::Error>) -> Self { Self::Multipart { field: e.field_name.map(|s| s.into_owned()), error: e.error, } } } impl From for Error { fn from(e: ureq::Error) -> Self { Error::Ureq(e) } } impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } } impl From for Error { fn from(e: std::string::FromUtf8Error) -> Self { Error::StringParse(e) } } pub fn urlencode>(s: T) -> String { ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() } pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { if let serde_json::Value::Object(object) = value { let mut params = vec![]; for (key, value) in object { match value { serde_json::Value::Object(_) => params.append(&mut parse_deep_object( &format!("{}[{}]", prefix, key), value, )), serde_json::Value::Array(array) => { for (i, value) in array.iter().enumerate() { params.append(&mut parse_deep_object( &format!("{}[{}][{}]", prefix, key, i), value, )); } } serde_json::Value::String(s) => { params.push((format!("{}[{}]", prefix, key), s.clone())) } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } return params; } unimplemented!("Only objects are supported with style=deepObject") } pub(crate) fn basic_auth(auth: &configuration::BasicAuth) -> String { let string = format!("{}:{}", auth.0, auth.1.as_ref().unwrap_or(&"".to_string())); format!("Basic {}", general_purpose::STANDARD.encode(string)).to_string() } pub mod default_api; pub mod configuration; nethsm-sdk-rs-3.0.0/src/lib.rs000064400000000000000000000001261046102023000142250ustar 00000000000000#[macro_use] extern crate serde_derive; pub use ureq; pub mod apis; pub mod models; nethsm-sdk-rs-3.0.0/src/models/ak_pub.rs000064400000000000000000000015451046102023000162110ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct AkPub { #[serde(rename = "P256", skip_serializing_if = "Option::is_none")] pub p256: Option, #[serde(rename = "P384", skip_serializing_if = "Option::is_none")] pub p384: Option, } impl AkPub { pub fn new() -> AkPub { AkPub { p256: None, p384: None, } } } nethsm-sdk-rs-3.0.0/src/models/backup_passphrase_config.rs000064400000000000000000000016521046102023000217720ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct BackupPassphraseConfig { #[serde(rename = "newPassphrase")] pub new_passphrase: String, #[serde(rename = "currentPassphrase")] pub current_passphrase: String, } impl BackupPassphraseConfig { pub fn new(new_passphrase: String, current_passphrase: String) -> BackupPassphraseConfig { BackupPassphraseConfig { new_passphrase, current_passphrase, } } } nethsm-sdk-rs-3.0.0/src/models/create_resource_id.rs000064400000000000000000000013031046102023000205660ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct CreateResourceId { #[serde(rename = "id")] pub id: String, } impl CreateResourceId { pub fn new(id: String) -> CreateResourceId { CreateResourceId { id } } } nethsm-sdk-rs-3.0.0/src/models/decrypt_data.rs000064400000000000000000000013131046102023000174040ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct DecryptData { #[serde(rename = "decrypted")] pub decrypted: String, } impl DecryptData { pub fn new(decrypted: String) -> DecryptData { DecryptData { decrypted } } } nethsm-sdk-rs-3.0.0/src/models/decrypt_mode.rs000064400000000000000000000033041046102023000174210ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum DecryptMode { #[serde(rename = "RAW")] Raw, #[serde(rename = "PKCS1")] Pkcs1, #[serde(rename = "OAEP_MD5")] OaepMd5, #[serde(rename = "OAEP_SHA1")] OaepSha1, #[serde(rename = "OAEP_SHA224")] OaepSha224, #[serde(rename = "OAEP_SHA256")] OaepSha256, #[serde(rename = "OAEP_SHA384")] OaepSha384, #[serde(rename = "OAEP_SHA512")] OaepSha512, #[serde(rename = "AES_CBC")] AesCbc, } impl std::fmt::Display for DecryptMode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Raw => "RAW", Self::Pkcs1 => "PKCS1", Self::OaepMd5 => "OAEP_MD5", Self::OaepSha1 => "OAEP_SHA1", Self::OaepSha224 => "OAEP_SHA224", Self::OaepSha256 => "OAEP_SHA256", Self::OaepSha384 => "OAEP_SHA384", Self::OaepSha512 => "OAEP_SHA512", Self::AesCbc => "AES_CBC", } ) } } impl Default for DecryptMode { fn default() -> DecryptMode { Self::Raw } } nethsm-sdk-rs-3.0.0/src/models/decrypt_request_data.rs000064400000000000000000000017571046102023000211700ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct DecryptRequestData { #[serde(rename = "mode")] pub mode: crate::models::DecryptMode, #[serde(rename = "encrypted")] pub encrypted: String, #[serde(rename = "iv", skip_serializing_if = "Option::is_none")] pub iv: Option, } impl DecryptRequestData { pub fn new(mode: crate::models::DecryptMode, encrypted: String) -> DecryptRequestData { DecryptRequestData { mode, encrypted, iv: None, } } } nethsm-sdk-rs-3.0.0/src/models/distinguished_name.rs000064400000000000000000000044071046102023000206130ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ /// DistinguishedName : Data used for creation of CSRs. If subjectAltNames is omitted, it is set to the same value as commonName. If it is set to an empty list, no SAN Extension is added. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct DistinguishedName { #[serde(rename = "countryName", skip_serializing_if = "Option::is_none")] pub country_name: Option, #[serde( rename = "stateOrProvinceName", skip_serializing_if = "Option::is_none" )] pub state_or_province_name: Option, #[serde(rename = "localityName", skip_serializing_if = "Option::is_none")] pub locality_name: Option, #[serde(rename = "organizationName", skip_serializing_if = "Option::is_none")] pub organization_name: Option, #[serde( rename = "organizationalUnitName", skip_serializing_if = "Option::is_none" )] pub organizational_unit_name: Option, #[serde(rename = "commonName")] pub common_name: String, #[serde(rename = "emailAddress", skip_serializing_if = "Option::is_none")] pub email_address: Option, #[serde(rename = "subjectAltNames", skip_serializing_if = "Option::is_none")] pub subject_alt_names: Option>, } impl DistinguishedName { /// Data used for creation of CSRs. If subjectAltNames is omitted, it is set to the same value as commonName. If it is set to an empty list, no SAN Extension is added. pub fn new(common_name: String) -> DistinguishedName { DistinguishedName { country_name: None, state_or_province_name: None, locality_name: None, organization_name: None, organizational_unit_name: None, common_name, email_address: None, subject_alt_names: None, } } } nethsm-sdk-rs-3.0.0/src/models/encrypt_data.rs000064400000000000000000000014131046102023000174170ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct EncryptData { #[serde(rename = "encrypted")] pub encrypted: String, #[serde(rename = "iv")] pub iv: String, } impl EncryptData { pub fn new(encrypted: String, iv: String) -> EncryptData { EncryptData { encrypted, iv } } } nethsm-sdk-rs-3.0.0/src/models/encrypt_mode.rs000064400000000000000000000017171046102023000174410ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum EncryptMode { #[serde(rename = "AES_CBC")] AesCbc, } impl std::fmt::Display for EncryptMode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::AesCbc => "AES_CBC", } ) } } impl Default for EncryptMode { fn default() -> EncryptMode { Self::AesCbc } } nethsm-sdk-rs-3.0.0/src/models/encrypt_request_data.rs000064400000000000000000000017471046102023000212010ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct EncryptRequestData { #[serde(rename = "mode")] pub mode: crate::models::EncryptMode, #[serde(rename = "message")] pub message: String, #[serde(rename = "iv", skip_serializing_if = "Option::is_none")] pub iv: Option, } impl EncryptRequestData { pub fn new(mode: crate::models::EncryptMode, message: String) -> EncryptRequestData { EncryptRequestData { mode, message, iv: None, } } } nethsm-sdk-rs-3.0.0/src/models/health_state_data.rs000064400000000000000000000013631046102023000204040ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct HealthStateData { #[serde(rename = "state")] pub state: crate::models::SystemState, } impl HealthStateData { pub fn new(state: crate::models::SystemState) -> HealthStateData { HealthStateData { state } } } nethsm-sdk-rs-3.0.0/src/models/info_data.rs000064400000000000000000000014071046102023000166710ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct InfoData { #[serde(rename = "vendor")] pub vendor: String, #[serde(rename = "product")] pub product: String, } impl InfoData { pub fn new(vendor: String, product: String) -> InfoData { InfoData { vendor, product } } } nethsm-sdk-rs-3.0.0/src/models/key_generate_request_data.rs000064400000000000000000000025761046102023000221600ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KeyGenerateRequestData { #[serde(rename = "mechanisms")] pub mechanisms: Vec, #[serde(rename = "type")] pub r#type: crate::models::KeyType, #[serde(rename = "length", skip_serializing_if = "Option::is_none")] pub length: Option, #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(rename = "restrictions", skip_serializing_if = "Option::is_none")] pub restrictions: Option>, } impl KeyGenerateRequestData { pub fn new( mechanisms: Vec, r#type: crate::models::KeyType, ) -> KeyGenerateRequestData { KeyGenerateRequestData { mechanisms, r#type, length: None, id: None, restrictions: None, } } } nethsm-sdk-rs-3.0.0/src/models/key_item.rs000064400000000000000000000012371046102023000165540ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct KeyItem { #[serde(rename = "id")] pub id: String, } impl KeyItem { pub fn new(id: String) -> KeyItem { KeyItem { id } } } nethsm-sdk-rs-3.0.0/src/models/key_mechanism.rs000064400000000000000000000072571046102023000175720ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum KeyMechanism { #[serde(rename = "RSA_Decryption_RAW")] RsaDecryptionRaw, #[serde(rename = "RSA_Decryption_PKCS1")] RsaDecryptionPkcs1, #[serde(rename = "RSA_Decryption_OAEP_MD5")] RsaDecryptionOaepMd5, #[serde(rename = "RSA_Decryption_OAEP_SHA1")] RsaDecryptionOaepSha1, #[serde(rename = "RSA_Decryption_OAEP_SHA224")] RsaDecryptionOaepSha224, #[serde(rename = "RSA_Decryption_OAEP_SHA256")] RsaDecryptionOaepSha256, #[serde(rename = "RSA_Decryption_OAEP_SHA384")] RsaDecryptionOaepSha384, #[serde(rename = "RSA_Decryption_OAEP_SHA512")] RsaDecryptionOaepSha512, #[serde(rename = "RSA_Signature_PKCS1")] RsaSignaturePkcs1, #[serde(rename = "RSA_Signature_PSS_MD5")] RsaSignaturePssMd5, #[serde(rename = "RSA_Signature_PSS_SHA1")] RsaSignaturePssSha1, #[serde(rename = "RSA_Signature_PSS_SHA224")] RsaSignaturePssSha224, #[serde(rename = "RSA_Signature_PSS_SHA256")] RsaSignaturePssSha256, #[serde(rename = "RSA_Signature_PSS_SHA384")] RsaSignaturePssSha384, #[serde(rename = "RSA_Signature_PSS_SHA512")] RsaSignaturePssSha512, #[serde(rename = "EdDSA_Signature")] EdDsaSignature, #[serde(rename = "ECDSA_Signature")] EcdsaSignature, #[serde(rename = "BIP340_Signature")] Bip340Signature, #[serde(rename = "AES_Encryption_CBC")] AesEncryptionCbc, #[serde(rename = "AES_Decryption_CBC")] AesDecryptionCbc, } impl std::fmt::Display for KeyMechanism { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::RsaDecryptionRaw => "RSA_Decryption_RAW", Self::RsaDecryptionPkcs1 => "RSA_Decryption_PKCS1", Self::RsaDecryptionOaepMd5 => "RSA_Decryption_OAEP_MD5", Self::RsaDecryptionOaepSha1 => "RSA_Decryption_OAEP_SHA1", Self::RsaDecryptionOaepSha224 => "RSA_Decryption_OAEP_SHA224", Self::RsaDecryptionOaepSha256 => "RSA_Decryption_OAEP_SHA256", Self::RsaDecryptionOaepSha384 => "RSA_Decryption_OAEP_SHA384", Self::RsaDecryptionOaepSha512 => "RSA_Decryption_OAEP_SHA512", Self::RsaSignaturePkcs1 => "RSA_Signature_PKCS1", Self::RsaSignaturePssMd5 => "RSA_Signature_PSS_MD5", Self::RsaSignaturePssSha1 => "RSA_Signature_PSS_SHA1", Self::RsaSignaturePssSha224 => "RSA_Signature_PSS_SHA224", Self::RsaSignaturePssSha256 => "RSA_Signature_PSS_SHA256", Self::RsaSignaturePssSha384 => "RSA_Signature_PSS_SHA384", Self::RsaSignaturePssSha512 => "RSA_Signature_PSS_SHA512", Self::EdDsaSignature => "EdDSA_Signature", Self::EcdsaSignature => "ECDSA_Signature", Self::Bip340Signature => "BIP340_Signature", Self::AesEncryptionCbc => "AES_Encryption_CBC", Self::AesDecryptionCbc => "AES_Decryption_CBC", } ) } } impl Default for KeyMechanism { fn default() -> KeyMechanism { Self::RsaDecryptionRaw } } nethsm-sdk-rs-3.0.0/src/models/key_private_data.rs000064400000000000000000000022631046102023000202610ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct KeyPrivateData { #[serde(rename = "primeP", skip_serializing_if = "Option::is_none")] pub prime_p: Option, #[serde(rename = "primeQ", skip_serializing_if = "Option::is_none")] pub prime_q: Option, #[serde(rename = "publicExponent", skip_serializing_if = "Option::is_none")] pub public_exponent: Option, #[serde(rename = "data", skip_serializing_if = "Option::is_none")] pub data: Option, } impl KeyPrivateData { pub fn new() -> KeyPrivateData { KeyPrivateData { prime_p: None, prime_q: None, public_exponent: None, data: None, } } } nethsm-sdk-rs-3.0.0/src/models/key_public_data.rs000064400000000000000000000026061046102023000200660ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ /// KeyPublicData : The public key data is either a *modulus* and a *publicExponent* or a *data* field. The *data* field is used for EC keys. This field is null for Generic keys. #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct KeyPublicData { #[serde(rename = "modulus", skip_serializing_if = "Option::is_none")] pub modulus: Option, #[serde(rename = "publicExponent", skip_serializing_if = "Option::is_none")] pub public_exponent: Option, #[serde(rename = "data", skip_serializing_if = "Option::is_none")] pub data: Option, } impl KeyPublicData { /// The public key data is either a *modulus* and a *publicExponent* or a *data* field. The *data* field is used for EC keys. This field is null for Generic keys. pub fn new() -> KeyPublicData { KeyPublicData { modulus: None, public_exponent: None, data: None, } } } nethsm-sdk-rs-3.0.0/src/models/key_restrictions.rs000064400000000000000000000014001046102023000203360ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct KeyRestrictions { #[serde(rename = "tags", skip_serializing_if = "Option::is_none")] pub tags: Option>, } impl KeyRestrictions { pub fn new() -> KeyRestrictions { KeyRestrictions { tags: None } } } nethsm-sdk-rs-3.0.0/src/models/key_type.rs000064400000000000000000000034541046102023000166020ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum KeyType { #[serde(rename = "RSA")] Rsa, #[serde(rename = "Curve25519")] Curve25519, #[serde(rename = "EC_P256")] EcP256, #[serde(rename = "EC_P384")] EcP384, #[serde(rename = "EC_P521")] EcP521, #[serde(rename = "EC_P256K1")] EcP256K1, #[serde(rename = "BrainpoolP256")] BrainpoolP256, #[serde(rename = "BrainpoolP384")] BrainpoolP384, #[serde(rename = "BrainpoolP512")] BrainpoolP512, #[serde(rename = "Generic")] Generic, } impl std::fmt::Display for KeyType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Rsa => "RSA", Self::Curve25519 => "Curve25519", Self::EcP256 => "EC_P256", Self::EcP384 => "EC_P384", Self::EcP521 => "EC_P521", Self::EcP256K1 => "EC_P256K1", Self::BrainpoolP256 => "BrainpoolP256", Self::BrainpoolP384 => "BrainpoolP384", Self::BrainpoolP512 => "BrainpoolP512", Self::Generic => "Generic", } ) } } impl Default for KeyType { fn default() -> KeyType { Self::Rsa } } nethsm-sdk-rs-3.0.0/src/models/log_level.rs000064400000000000000000000022661046102023000167210ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum LogLevel { #[serde(rename = "debug")] Debug, #[serde(rename = "info")] Info, #[serde(rename = "warning")] Warning, #[serde(rename = "error")] Error, } impl std::fmt::Display for LogLevel { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Debug => "debug", Self::Info => "info", Self::Warning => "warning", Self::Error => "error", } ) } } impl Default for LogLevel { fn default() -> LogLevel { Self::Debug } } nethsm-sdk-rs-3.0.0/src/models/logging_config.rs000064400000000000000000000017021046102023000177160ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct LoggingConfig { #[serde(rename = "ipAddress")] pub ip_address: String, #[serde(rename = "port")] pub port: i32, #[serde(rename = "logLevel")] pub log_level: crate::models::LogLevel, } impl LoggingConfig { pub fn new(ip_address: String, port: i32, log_level: crate::models::LogLevel) -> LoggingConfig { LoggingConfig { ip_address, port, log_level, } } } nethsm-sdk-rs-3.0.0/src/models/mod.rs000064400000000000000000000064161046102023000155310ustar 00000000000000mod ak_pub; pub use self::ak_pub::AkPub; mod backup_passphrase_config; pub use self::backup_passphrase_config::BackupPassphraseConfig; mod create_resource_id; pub use self::create_resource_id::CreateResourceId; mod decrypt_data; pub use self::decrypt_data::DecryptData; mod decrypt_mode; pub use self::decrypt_mode::DecryptMode; mod decrypt_request_data; pub use self::decrypt_request_data::DecryptRequestData; mod distinguished_name; pub use self::distinguished_name::DistinguishedName; mod encrypt_data; pub use self::encrypt_data::EncryptData; mod encrypt_mode; pub use self::encrypt_mode::EncryptMode; mod encrypt_request_data; pub use self::encrypt_request_data::EncryptRequestData; mod health_state_data; pub use self::health_state_data::HealthStateData; mod info_data; pub use self::info_data::InfoData; mod key_generate_request_data; pub use self::key_generate_request_data::KeyGenerateRequestData; mod key_item; pub use self::key_item::KeyItem; mod key_mechanism; pub use self::key_mechanism::KeyMechanism; mod key_private_data; pub use self::key_private_data::KeyPrivateData; mod key_public_data; pub use self::key_public_data::KeyPublicData; mod key_restrictions; pub use self::key_restrictions::KeyRestrictions; mod key_type; pub use self::key_type::KeyType; mod log_level; pub use self::log_level::LogLevel; mod logging_config; pub use self::logging_config::LoggingConfig; mod move_key_request; pub use self::move_key_request::MoveKeyRequest; mod namespace_item; pub use self::namespace_item::NamespaceItem; mod network_config; pub use self::network_config::NetworkConfig; mod pcr; pub use self::pcr::Pcr; mod private_key; pub use self::private_key::PrivateKey; mod private_key_pem_arguments; pub use self::private_key_pem_arguments::PrivateKeyPemArguments; mod provision_request_data; pub use self::provision_request_data::ProvisionRequestData; mod public_key; pub use self::public_key::PublicKey; mod random_data; pub use self::random_data::RandomData; mod random_request_data; pub use self::random_request_data::RandomRequestData; mod restore_request_arguments; pub use self::restore_request_arguments::RestoreRequestArguments; mod sign_data; pub use self::sign_data::SignData; mod sign_mode; pub use self::sign_mode::SignMode; mod sign_request_data; pub use self::sign_request_data::SignRequestData; mod switch; pub use self::switch::Switch; mod system_info; pub use self::system_info::SystemInfo; mod system_state; pub use self::system_state::SystemState; mod system_update_data; pub use self::system_update_data::SystemUpdateData; mod time_config; pub use self::time_config::TimeConfig; mod tls_key_generate_request_data; pub use self::tls_key_generate_request_data::TlsKeyGenerateRequestData; mod tls_key_type; pub use self::tls_key_type::TlsKeyType; mod unattended_boot_config; pub use self::unattended_boot_config::UnattendedBootConfig; mod unlock_passphrase_config; pub use self::unlock_passphrase_config::UnlockPassphraseConfig; mod unlock_request_data; pub use self::unlock_request_data::UnlockRequestData; mod user_data; pub use self::user_data::UserData; mod user_item; pub use self::user_item::UserItem; mod user_passphrase_post_data; pub use self::user_passphrase_post_data::UserPassphrasePostData; mod user_post_data; pub use self::user_post_data::UserPostData; mod user_role; pub use self::user_role::UserRole; nethsm-sdk-rs-3.0.0/src/models/move_key_request.rs000064400000000000000000000013121046102023000203260ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MoveKeyRequest { #[serde(rename = "newId")] pub new_id: String, } impl MoveKeyRequest { pub fn new(new_id: String) -> MoveKeyRequest { MoveKeyRequest { new_id } } } nethsm-sdk-rs-3.0.0/src/models/namespace_item.rs000064400000000000000000000012671046102023000177230ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct NamespaceItem { #[serde(rename = "id")] pub id: String, } impl NamespaceItem { pub fn new(id: String) -> NamespaceItem { NamespaceItem { id } } } nethsm-sdk-rs-3.0.0/src/models/network_config.rs000064400000000000000000000016531046102023000177660ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct NetworkConfig { #[serde(rename = "ipAddress")] pub ip_address: String, #[serde(rename = "netmask")] pub netmask: String, #[serde(rename = "gateway")] pub gateway: String, } impl NetworkConfig { pub fn new(ip_address: String, netmask: String, gateway: String) -> NetworkConfig { NetworkConfig { ip_address, netmask, gateway, } } } nethsm-sdk-rs-3.0.0/src/models/pcr.rs000064400000000000000000000015431046102023000155320ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct Pcr { #[serde(rename = "0", skip_serializing_if = "Option::is_none")] pub param_0: Option, #[serde(rename = "2", skip_serializing_if = "Option::is_none")] pub param_2: Option, } impl Pcr { pub fn new() -> Pcr { Pcr { param_0: None, param_2: None, } } } nethsm-sdk-rs-3.0.0/src/models/private_key.rs000064400000000000000000000024051046102023000172660ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct PrivateKey { #[serde(rename = "mechanisms")] pub mechanisms: Vec, #[serde(rename = "type")] pub r#type: crate::models::KeyType, #[serde(rename = "private")] pub private: Box, #[serde(rename = "restrictions", skip_serializing_if = "Option::is_none")] pub restrictions: Option>, } impl PrivateKey { pub fn new( mechanisms: Vec, r#type: crate::models::KeyType, private: crate::models::KeyPrivateData, ) -> PrivateKey { PrivateKey { mechanisms, r#type, private: Box::new(private), restrictions: None, } } } nethsm-sdk-rs-3.0.0/src/models/private_key_pem_arguments.rs000064400000000000000000000020121046102023000222060ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct PrivateKeyPemArguments { #[serde(rename = "mechanisms", skip_serializing_if = "Option::is_none")] pub mechanisms: Option>, #[serde(rename = "restrictions", skip_serializing_if = "Option::is_none")] pub restrictions: Option>, } impl PrivateKeyPemArguments { pub fn new() -> PrivateKeyPemArguments { PrivateKeyPemArguments { mechanisms: None, restrictions: None, } } } nethsm-sdk-rs-3.0.0/src/models/provision_request_data.rs000064400000000000000000000020641046102023000215360ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ProvisionRequestData { #[serde(rename = "unlockPassphrase")] pub unlock_passphrase: String, #[serde(rename = "adminPassphrase")] pub admin_passphrase: String, #[serde(rename = "systemTime")] pub system_time: String, } impl ProvisionRequestData { pub fn new( unlock_passphrase: String, admin_passphrase: String, system_time: String, ) -> ProvisionRequestData { ProvisionRequestData { unlock_passphrase, admin_passphrase, system_time, } } } nethsm-sdk-rs-3.0.0/src/models/public_key.rs000064400000000000000000000025661046102023000171020ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct PublicKey { #[serde(rename = "mechanisms")] pub mechanisms: Vec, #[serde(rename = "type")] pub r#type: crate::models::KeyType, #[serde(rename = "restrictions")] pub restrictions: Box, #[serde(rename = "public", skip_serializing_if = "Option::is_none")] pub public: Option>, #[serde(rename = "operations")] pub operations: i32, } impl PublicKey { pub fn new( mechanisms: Vec, r#type: crate::models::KeyType, restrictions: crate::models::KeyRestrictions, operations: i32, ) -> PublicKey { PublicKey { mechanisms, r#type, restrictions: Box::new(restrictions), public: None, operations, } } } nethsm-sdk-rs-3.0.0/src/models/random_data.rs000064400000000000000000000012731046102023000172170ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct RandomData { #[serde(rename = "random")] pub random: String, } impl RandomData { pub fn new(random: String) -> RandomData { RandomData { random } } } nethsm-sdk-rs-3.0.0/src/models/random_request_data.rs000064400000000000000000000013211046102023000207610ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct RandomRequestData { #[serde(rename = "length")] pub length: i32, } impl RandomRequestData { pub fn new(length: i32) -> RandomRequestData { RandomRequestData { length } } } nethsm-sdk-rs-3.0.0/src/models/restore_request_arguments.rs000064400000000000000000000017471046102023000222740ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] #[non_exhaustive] pub struct RestoreRequestArguments { #[serde(rename = "backupPassphrase", skip_serializing_if = "Option::is_none")] pub backup_passphrase: Option, #[serde(rename = "systemTime", skip_serializing_if = "Option::is_none")] pub system_time: Option, } impl RestoreRequestArguments { pub fn new() -> RestoreRequestArguments { RestoreRequestArguments { backup_passphrase: None, system_time: None, } } } nethsm-sdk-rs-3.0.0/src/models/sign_data.rs000064400000000000000000000012771046102023000167030ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SignData { #[serde(rename = "signature")] pub signature: String, } impl SignData { pub fn new(signature: String) -> SignData { SignData { signature } } } nethsm-sdk-rs-3.0.0/src/models/sign_mode.rs000064400000000000000000000033721046102023000167140ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum SignMode { #[serde(rename = "PKCS1")] Pkcs1, #[serde(rename = "PSS_MD5")] PssMd5, #[serde(rename = "PSS_SHA1")] PssSha1, #[serde(rename = "PSS_SHA224")] PssSha224, #[serde(rename = "PSS_SHA256")] PssSha256, #[serde(rename = "PSS_SHA384")] PssSha384, #[serde(rename = "PSS_SHA512")] PssSha512, #[serde(rename = "EdDSA")] EdDsa, #[serde(rename = "ECDSA")] Ecdsa, #[serde(rename = "BIP340")] Bip340, } impl std::fmt::Display for SignMode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Pkcs1 => "PKCS1", Self::PssMd5 => "PSS_MD5", Self::PssSha1 => "PSS_SHA1", Self::PssSha224 => "PSS_SHA224", Self::PssSha256 => "PSS_SHA256", Self::PssSha384 => "PSS_SHA384", Self::PssSha512 => "PSS_SHA512", Self::EdDsa => "EdDSA", Self::Ecdsa => "ECDSA", Self::Bip340 => "BIP340", } ) } } impl Default for SignMode { fn default() -> SignMode { Self::Pkcs1 } } nethsm-sdk-rs-3.0.0/src/models/sign_request_data.rs000064400000000000000000000014751046102023000204530ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SignRequestData { #[serde(rename = "mode")] pub mode: crate::models::SignMode, #[serde(rename = "message")] pub message: String, } impl SignRequestData { pub fn new(mode: crate::models::SignMode, message: String) -> SignRequestData { SignRequestData { mode, message } } } nethsm-sdk-rs-3.0.0/src/models/switch.rs000064400000000000000000000017571046102023000162560ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum Switch { #[serde(rename = "on")] On, #[serde(rename = "off")] Off, } impl std::fmt::Display for Switch { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::On => "on", Self::Off => "off", } ) } } impl Default for Switch { fn default() -> Switch { Self::On } } nethsm-sdk-rs-3.0.0/src/models/system_info.rs000064400000000000000000000030501046102023000173000ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SystemInfo { #[serde(rename = "softwareVersion")] pub software_version: String, #[serde(rename = "softwareBuild")] pub software_build: String, #[serde(rename = "firmwareVersion")] pub firmware_version: String, #[serde(rename = "hardwareVersion")] pub hardware_version: String, #[serde(rename = "deviceId")] pub device_id: String, #[serde(rename = "akPub")] pub ak_pub: Box, #[serde(rename = "pcr")] pub pcr: Box, } impl SystemInfo { pub fn new( software_version: String, software_build: String, firmware_version: String, hardware_version: String, device_id: String, ak_pub: crate::models::AkPub, pcr: crate::models::Pcr, ) -> SystemInfo { SystemInfo { software_version, software_build, firmware_version, hardware_version, device_id, ak_pub: Box::new(ak_pub), pcr: Box::new(pcr), } } } nethsm-sdk-rs-3.0.0/src/models/system_state.rs000064400000000000000000000022601046102023000174670ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum SystemState { #[serde(rename = "Unprovisioned")] Unprovisioned, #[serde(rename = "Locked")] Locked, #[serde(rename = "Operational")] Operational, } impl std::fmt::Display for SystemState { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Unprovisioned => "Unprovisioned", Self::Locked => "Locked", Self::Operational => "Operational", } ) } } impl Default for SystemState { fn default() -> SystemState { Self::Unprovisioned } } nethsm-sdk-rs-3.0.0/src/models/system_update_data.rs000064400000000000000000000013561046102023000206270ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct SystemUpdateData { #[serde(rename = "releaseNotes")] pub release_notes: String, } impl SystemUpdateData { pub fn new(release_notes: String) -> SystemUpdateData { SystemUpdateData { release_notes } } } nethsm-sdk-rs-3.0.0/src/models/time_config.rs000064400000000000000000000012631046102023000172300ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TimeConfig { #[serde(rename = "time")] pub time: String, } impl TimeConfig { pub fn new(time: String) -> TimeConfig { TimeConfig { time } } } nethsm-sdk-rs-3.0.0/src/models/tls_key_generate_request_data.rs000064400000000000000000000016601046102023000230330ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct TlsKeyGenerateRequestData { #[serde(rename = "type")] pub r#type: crate::models::TlsKeyType, #[serde(rename = "length", skip_serializing_if = "Option::is_none")] pub length: Option, } impl TlsKeyGenerateRequestData { pub fn new(r#type: crate::models::TlsKeyType) -> TlsKeyGenerateRequestData { TlsKeyGenerateRequestData { r#type, length: None, } } } nethsm-sdk-rs-3.0.0/src/models/tls_key_type.rs000064400000000000000000000031761046102023000174650ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum TlsKeyType { #[serde(rename = "RSA")] Rsa, #[serde(rename = "Curve25519")] Curve25519, #[serde(rename = "EC_P256")] EcP256, #[serde(rename = "EC_P384")] EcP384, #[serde(rename = "EC_P521")] EcP521, #[serde(rename = "BrainpoolP256")] BrainpoolP256, #[serde(rename = "BrainpoolP384")] BrainpoolP384, #[serde(rename = "BrainpoolP512")] BrainpoolP512, } impl std::fmt::Display for TlsKeyType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Rsa => "RSA", Self::Curve25519 => "Curve25519", Self::EcP256 => "EC_P256", Self::EcP384 => "EC_P384", Self::EcP521 => "EC_P521", Self::BrainpoolP256 => "BrainpoolP256", Self::BrainpoolP384 => "BrainpoolP384", Self::BrainpoolP512 => "BrainpoolP512", } ) } } impl Default for TlsKeyType { fn default() -> TlsKeyType { Self::Rsa } } nethsm-sdk-rs-3.0.0/src/models/unattended_boot_config.rs000064400000000000000000000014011046102023000214420ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UnattendedBootConfig { #[serde(rename = "status")] pub status: crate::models::Switch, } impl UnattendedBootConfig { pub fn new(status: crate::models::Switch) -> UnattendedBootConfig { UnattendedBootConfig { status } } } nethsm-sdk-rs-3.0.0/src/models/unlock_passphrase_config.rs000064400000000000000000000016521046102023000220200ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UnlockPassphraseConfig { #[serde(rename = "newPassphrase")] pub new_passphrase: String, #[serde(rename = "currentPassphrase")] pub current_passphrase: String, } impl UnlockPassphraseConfig { pub fn new(new_passphrase: String, current_passphrase: String) -> UnlockPassphraseConfig { UnlockPassphraseConfig { new_passphrase, current_passphrase, } } } nethsm-sdk-rs-3.0.0/src/models/unlock_request_data.rs000064400000000000000000000013471046102023000210040ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UnlockRequestData { #[serde(rename = "passphrase")] pub passphrase: String, } impl UnlockRequestData { pub fn new(passphrase: String) -> UnlockRequestData { UnlockRequestData { passphrase } } } nethsm-sdk-rs-3.0.0/src/models/user_data.rs000064400000000000000000000014501046102023000167120ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UserData { #[serde(rename = "realName")] pub real_name: String, #[serde(rename = "role")] pub role: crate::models::UserRole, } impl UserData { pub fn new(real_name: String, role: crate::models::UserRole) -> UserData { UserData { real_name, role } } } nethsm-sdk-rs-3.0.0/src/models/user_item.rs000064400000000000000000000012531046102023000167400ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UserItem { #[serde(rename = "user")] pub user: String, } impl UserItem { pub fn new(user: String) -> UserItem { UserItem { user } } } nethsm-sdk-rs-3.0.0/src/models/user_passphrase_post_data.rs000064400000000000000000000013731046102023000222140ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UserPassphrasePostData { #[serde(rename = "passphrase")] pub passphrase: String, } impl UserPassphrasePostData { pub fn new(passphrase: String) -> UserPassphrasePostData { UserPassphrasePostData { passphrase } } } nethsm-sdk-rs-3.0.0/src/models/user_post_data.rs000064400000000000000000000017441046102023000177650ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct UserPostData { #[serde(rename = "realName")] pub real_name: String, #[serde(rename = "role")] pub role: crate::models::UserRole, #[serde(rename = "passphrase")] pub passphrase: String, } impl UserPostData { pub fn new( real_name: String, role: crate::models::UserRole, passphrase: String, ) -> UserPostData { UserPostData { real_name, role, passphrase, } } } nethsm-sdk-rs-3.0.0/src/models/user_role.rs000064400000000000000000000023621046102023000167450ustar 00000000000000/* * NetHSM * * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian. * * The version of the OpenAPI document: v1 * Contact: Nitrokey * Generated by: https://openapi-generator.tech */ #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] #[non_exhaustive] pub enum UserRole { #[serde(rename = "Administrator")] Administrator, #[serde(rename = "Operator")] Operator, #[serde(rename = "Metrics")] Metrics, #[serde(rename = "Backup")] Backup, } impl std::fmt::Display for UserRole { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { Self::Administrator => "Administrator", Self::Operator => "Operator", Self::Metrics => "Metrics", Self::Backup => "Backup", } ) } } impl Default for UserRole { fn default() -> UserRole { Self::Administrator } } nethsm-sdk-rs-3.0.0/tests/basic.rs000064400000000000000000000154011046102023000151150ustar 00000000000000mod utils; use std::collections::BTreeSet; use chrono::Utc; use nethsm_sdk_rs::{ apis::{configuration::Configuration, default_api, Error}, models::{ BackupPassphraseConfig, KeyGenerateRequestData, KeyMechanism, KeyType, ProvisionRequestData, RestoreRequestArguments, SystemState, UnlockRequestData, UserPostData, UserRole, }, }; #[tokio::test] async fn test_health_state() { utils::with_container(|config| { let result = default_api::health_state_get(&config); assert!(result.is_ok(), "{result:?}"); }) .await } #[tokio::test] async fn test_error_with_body() { utils::with_container(|config| { let err = default_api::keys_get(&config, None).err().unwrap(); match err { Error::ResponseError(content) => { assert_eq!(content.status, 412); let err = String::from_utf8_lossy(&content.content); assert!( err.contains("Service not available"), "unexpected error message: {err}" ); match content.entity { default_api::KeysGetError::Status412() => {} err => panic!("Unexpected error variant: {err:?}"), } } _ => { panic!("Unexpected error variant: {err:?}"); } } }) .await } #[tokio::test] async fn test_namespaces() { let admin_passphrase = "adminadmin"; let n_admin_passphrase = "admin2admin2"; let unlock_passphrase = "unlockunlock"; utils::with_container(|mut config| { let request = ProvisionRequestData::new( unlock_passphrase.to_owned(), admin_passphrase.to_owned(), Utc::now().to_rfc3339(), ); default_api::provision_post(&config, request).unwrap(); config.basic_auth = Some(("admin".to_owned(), Some(admin_passphrase.to_owned()))); let request = UserPostData::new( "N-Admin".to_owned(), UserRole::Administrator, n_admin_passphrase.to_owned(), ); let user_id = default_api::users_user_id_post(&config, "mynamespace~", request) .unwrap() .entity .id; assert!(user_id.starts_with("mynamespace~")); assert_eq!(list_namespaces(&config), BTreeSet::new()); default_api::namespaces_namespace_id_put(&config, "mynamespace").unwrap(); assert_eq!( list_namespaces(&config), ["mynamespace".to_owned()].into_iter().collect() ); config.basic_auth = Some((user_id, Some(n_admin_passphrase.to_owned()))); let mut request = KeyGenerateRequestData::new(vec![KeyMechanism::RsaDecryptionRaw], KeyType::Rsa); request.length = Some(2048); let key_id = default_api::keys_generate_post(&config, request) .unwrap() .entity .id; let keys = BTreeSet::from([key_id.clone()]); assert_eq!(list_keys(&config), keys); config.basic_auth = Some(("admin".to_owned(), Some(admin_passphrase.to_owned()))); assert_eq!(list_keys(&config), BTreeSet::new()); default_api::namespaces_namespace_id_delete(&config, "mynamespace").unwrap(); assert_eq!(list_namespaces(&config), BTreeSet::new()); }) .await } #[tokio::test] async fn test_restore() { let admin_passphrase = "adminadmin"; let backup_passphrase = "backupbackup"; let unlock_passphrase = "unlockunlock"; let (generated_keys, backup) = utils::with_container(|mut config| { let request = ProvisionRequestData::new( unlock_passphrase.to_owned(), admin_passphrase.to_owned(), Utc::now().to_rfc3339(), ); default_api::provision_post(&config, request).unwrap(); config.basic_auth = Some(("admin".to_owned(), Some(admin_passphrase.to_owned()))); let mut request = KeyGenerateRequestData::new(vec![KeyMechanism::RsaDecryptionRaw], KeyType::Rsa); request.length = Some(2048); let key_id = default_api::keys_generate_post(&config, request) .unwrap() .entity .id; let keys = BTreeSet::from([key_id.clone()]); assert_eq!(list_keys(&config), keys); let request = BackupPassphraseConfig::new(backup_passphrase.to_owned(), String::new()); default_api::config_backup_passphrase_put(&config, request).unwrap(); let request = UserPostData::new( "Backup User".to_owned(), UserRole::Backup, backup_passphrase.to_owned(), ); default_api::users_user_id_put(&config, "backup", request).unwrap(); config.basic_auth = Some(("backup".to_owned(), Some(backup_passphrase.to_owned()))); let backup = default_api::system_backup_post(&config).unwrap().entity; config.basic_auth = Some(("admin".to_owned(), Some(admin_passphrase.to_owned()))); default_api::keys_key_id_delete(&config, &key_id).unwrap(); assert_eq!(list_keys(&config), BTreeSet::default()); let mut request = RestoreRequestArguments::new(); request.backup_passphrase = Some(backup_passphrase.to_owned()); request.system_time = Some(Utc::now().to_rfc3339()); default_api::system_restore_post(&config, Some(request), Some(backup.clone())).unwrap(); assert_eq!(list_keys(&config), keys); (keys, backup) }) .await; let restored_keys = utils::with_container(|mut config| { let state = default_api::health_state_get(&config).unwrap().entity.state; assert_eq!(state, SystemState::Unprovisioned); let mut request = RestoreRequestArguments::new(); request.backup_passphrase = Some(backup_passphrase.to_owned()); request.system_time = Some(Utc::now().to_rfc3339()); default_api::system_restore_post(&config, Some(request), Some(backup)).unwrap(); let state = default_api::health_state_get(&config).unwrap().entity.state; assert_eq!(state, SystemState::Locked); let request = UnlockRequestData::new(unlock_passphrase.to_owned()); default_api::unlock_post(&config, request).unwrap(); config.basic_auth = Some(("admin".to_owned(), Some(admin_passphrase.to_owned()))); list_keys(&config) }) .await; assert_eq!(generated_keys, restored_keys); } fn list_keys(config: &Configuration) -> BTreeSet { default_api::keys_get(config, None) .unwrap() .entity .into_iter() .map(|item| item.id) .collect() } fn list_namespaces(config: &Configuration) -> BTreeSet { default_api::namespaces_get(config) .unwrap() .entity .into_iter() .map(|item| item.id) .collect() } nethsm-sdk-rs-3.0.0/tests/utils/mod.rs000064400000000000000000000037261046102023000157620ustar 00000000000000// Based on: // https://gitlab.archlinux.org/archlinux/signstar/-/blob/579131fe6b9db9b8fe1b9ffd3ad6d5e98afae816/nethsm/tests/common/container.rs // Author: David Runge // License: Apache-2.0 OR MIT use nethsm_sdk_rs::apis::configuration::Configuration; use rustainers::{ runner::{RunOption, Runner}, ExposedPort, ImageName, RunnableContainer, RunnableContainerBuilder, ToRunnableContainer, WaitStrategy, }; use ureq::tls::TlsConfig; pub async fn with_container T, T>(f: F) -> T { let _ = env_logger::builder().is_test(true).try_init(); let runner = Runner::auto().unwrap(); let options = RunOption::builder().with_remove(true).build(); let container = runner .start_with_options(Image::new(), options) .await .unwrap(); let config = Configuration { base_path: container.api().await, client: ureq::Agent::new_with_config( ureq::Agent::config_builder() .tls_config(TlsConfig::builder().disable_verification(true).build()) .build(), ), ..Default::default() }; let result = f(config); drop(container); result } struct Image { name: ImageName, port: ExposedPort, } impl Image { fn new() -> Self { Self { name: ImageName::new_with_tag("nitrokey/nethsm", "testing"), port: ExposedPort::new(8443), } } async fn api(&self) -> String { let port = self.port.host_port().await.unwrap(); format!("https://localhost:{port}/api/v1") } } impl ToRunnableContainer for Image { fn to_runnable(&self, builder: RunnableContainerBuilder) -> RunnableContainer { builder .with_image(self.name.clone()) .with_wait_strategy(WaitStrategy::stderr_contains( "listening on 8443/TCP for HTTPS", )) .with_port_mappings([self.port.clone()]) .build() } }