diff --git a/.vscode/cspell.json b/.vscode/cspell.json index e39eb5c7e6..9280b7e4d3 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -72,6 +72,7 @@ "macpool", "macvmimage", "markdownlintrc", + "mgmt", "msrc", "msrv", "multibyte", diff --git a/Cargo.lock b/Cargo.lock index 697f1656fc..932a3219eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -430,7 +430,7 @@ version = "1.2.0-beta.3" dependencies = [ "async-trait", "azure_core 1.2.0-beta.2", - "fe2o3-amqp 0.18.3", + "fe2o3-amqp 0.18.4", "fe2o3-amqp-cbs 0.18.0", "fe2o3-amqp-ext 0.18.0", "fe2o3-amqp-management 0.18.0", @@ -805,7 +805,7 @@ dependencies = [ "azure_storage_blob", "base64", "criterion", - "fe2o3-amqp 0.18.3", + "fe2o3-amqp 0.18.4", "futures", "hmac", "include-file", @@ -865,6 +865,22 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "azure_resourcemanager_keyvault" +version = "0.1.0" +dependencies = [ + "async-trait", + "azure_core 1.2.0-beta.2", + "azure_core_test 0.2.0", + "azure_identity 1.1.0-beta.2", + "azure_security_keyvault_test", + "futures", + "include-file", + "serde", + "serde_json", + "tokio", +] + [[package]] name = "azure_security_keyvault_certificates" version = "1.1.0-beta.3" @@ -1719,9 +1735,9 @@ dependencies = [ [[package]] name = "fe2o3-amqp" -version = "0.18.3" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5474a3b580e12b716a34cfef7f2857fa3aca70751e96c85a477549ac3179dfe0" +checksum = "b1866e0bb2dae6f9481296b2350270bc964d2d2473ca58dc9d1434af820f670c" dependencies = [ "bytes", "fe2o3-amqp-types 0.18.0", @@ -1762,7 +1778,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aba27aa79b79e44a0365b7e30b232276efb3297253368bd303a9f19eea2e184f" dependencies = [ - "fe2o3-amqp 0.18.3", + "fe2o3-amqp 0.18.4", "fe2o3-amqp-management 0.18.0", "trait-variant", ] @@ -1805,7 +1821,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7141df54f8a0d418bc102b5aa0dd0b3dfcac6520f4a59fa393e1faaed8e38d1b" dependencies = [ - "fe2o3-amqp 0.18.3", + "fe2o3-amqp 0.18.4", "fe2o3-amqp-types 0.18.0", "serde", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index b7fe2c199e..35119a9e34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ members = [ "sdk/identity/azure_identity", "sdk/eventhubs/azure_messaging_eventhubs", "sdk/eventhubs/azure_messaging_eventhubs_checkpointstore_blob", + "sdk/keyvault/azure_resourcemanager_keyvault", "sdk/keyvault/azure_security_keyvault_certificates", "sdk/keyvault/azure_security_keyvault_keys", "sdk/keyvault/azure_security_keyvault_secrets", diff --git a/sdk/core/AGENTS.md b/sdk/core/AGENTS.md index a8dcebd950..cd743a7f1d 100644 --- a/sdk/core/AGENTS.md +++ b/sdk/core/AGENTS.md @@ -42,10 +42,13 @@ These rules apply in addition to the repository root [AGENTS.md](../../AGENTS.md - For markdown compile tests, alias helper modules to the public crate names used in docs (for example `use azure_core_examples::identity as azure_identity;`). - If a compile-only test needs just one or two service types and would otherwise mix published and local `azure_core` graphs, prefer a tiny local stub in that test module over broad dependency rewiring. -## Resource Manager functionality +## Resource Manager +- Use "Resource Manager", not "ARM", in public documentation. "ARM" is acceptable in code. - Put Resource Manager (ARM)-specific functionality in existing `azure_core` modules where appropriate. - Use `resource_manager` in module, field, function, method, and feature names; retain `azure_resourcemanager_*` crate names. - When names collide, prefer a `resource_manager` submodule gated by the `resource_manager` feature, such as `azure_core::http::poller::resource_manager`, over `ResourceManager` type or variant prefixes; do not re-export its items from parent modules. - Use `azure_core::cloud::resource_manager::Audience` in all ARM crates for audience registration, audience lookup, and default credential scopes; do not define crate-specific ARM audience markers. - Keep each ARM crate's first README client-configuration example as the normal case. Add a second example configuring and using a custom cloud: set `CustomConfiguration::authority_host` and `endpoint`, register the ARM audience in `Audiences` with the shared marker, and use that cloud to configure the credential and client. +- Read the caller's `CloudConfiguration` from client options in Resource Manager constructors; use `unwrap_or_default()` when omitted. +- Resolve built-in service endpoints and authentication audiences in the library; honor supplied custom-cloud values. diff --git a/sdk/keyvault/.cspell.json b/sdk/keyvault/.cspell.json index 790949360f..bf9b96cb4a 100644 --- a/sdk/keyvault/.cspell.json +++ b/sdk/keyvault/.cspell.json @@ -39,8 +39,9 @@ "secureunwrapkey", "securewrapkey", "setissuers", + "undercounted", "unwrapkey", "upns", "wrapkey" ] -} \ No newline at end of file +} diff --git a/sdk/keyvault/assets.json b/sdk/keyvault/assets.json index 6295dcae74..a41b060b79 100644 --- a/sdk/keyvault/assets.json +++ b/sdk/keyvault/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "rust", "TagPrefix": "rust/keyvault", - "Tag": "rust/keyvault_c9303ec620" + "Tag": "rust/keyvault_db67ec2132" } diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/.cspell.json b/sdk/keyvault/azure_resourcemanager_keyvault/.cspell.json new file mode 100644 index 0000000000..ca696f9e55 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/.cspell.json @@ -0,0 +1,22 @@ +{ + "import": [ + "../.cspell.json" + ], + "ignoreWords": [ + "byok", + "deletesas", + "getrotationpolicy", + "getsas", + "listissuers", + "listsas", + "mhsm", + "mhsmip", + "preprovisioning", + "regeneratekey", + "setrotationpolicy", + "setsas", + "subid", + "vnet", + "westus" + ] +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/CHANGELOG.md b/sdk/keyvault/azure_resourcemanager_keyvault/CHANGELOG.md new file mode 100644 index 0000000000..3a1dc45644 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (Unreleased) + +### Features Added + +- Initial Azure Key Vault Resource Manager client library using service API version `2026-05-15`. diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/CONTRIBUTING.md b/sdk/keyvault/azure_resourcemanager_keyvault/CONTRIBUTING.md new file mode 100644 index 0000000000..f355e76cdc --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/CONTRIBUTING.md @@ -0,0 +1,144 @@ +# Contributing to the Key Vault Resource Manager library + +Follow the [repository contributing guide](https://github.com/Azure/azure-sdk-for-rust/blob/main/CONTRIBUTING.md) for shared +development, provisioning, and test-proxy workflows. This guide describes +crate-specific generation, tests, and resource requirements. + +## Regenerating the library + +This library targets stable API version `2026-05-15`. Its source specification +and commit are pinned in [tsp-location.yaml](https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/keyvault/azure_resourcemanager_keyvault/tsp-location.yaml). The specification +does not yet include Rust emitter configuration. + +From the repository root, install the pinned generator: + +```sh +npm ci --prefix eng/common/tsp-client +``` + +Then, from this crate's directory, set `TSP_CLIENT_DIR` to the absolute path of +`eng/common/tsp-client` in your checkout and run: + +```sh +npm exec --prefix "$TSP_CLIENT_DIR" --no -- tsp-client update \ + --emitter-options 'crate-name=azure_resourcemanager_keyvault;crate-version=0.1.0;api-version=2026-05-15;emitter-output-dir={output-dir}/sdk/keyvault/azure_resourcemanager_keyvault' +``` + +Generated constructors, polling methods, polling options, empty-result formats, +and key rotation action wire values currently contain prototype edits. +Regeneration overwrites those edits. [TODO.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/keyvault/azure_resourcemanager_keyvault/TODO.md) tracks the specification +and emitter changes needed to remove these patches. + +After the upstream changes land, update `tsp-location.yaml` and the pinned +emitter as appropriate. Regenerate without overrides, verify that the manual +patches are no longer necessary, export the API, and run package analysis. +Remove obsolete prototype warnings once generation is reproducible. + +The proposed upstream SKU enum renames will change Rust references from +`ManagedHsmSkuNameV2` to `ManagedHsmSkuName`, including managed HSM tests. Update +these references after regenerating against that specification change. + +## Offline checks + +Run these commands from the repository root: + +```sh +cargo test -p azure_resourcemanager_keyvault --all-features --lib +cargo test -p azure_resourcemanager_keyvault --all-features --tests --no-run +cargo test -p azure_resourcemanager_keyvault --all-features --doc +``` + +`tests/readme.rs` also compiles both client-construction examples without running +their credentials or making network requests. + +The library has 23 offline tests. Eleven enum-family tests cover all 29 generated +enum types and 155 known wire values, including serialization, deserialization, +unknown values, wrong-case behavior, and representative nested models. These +tests create no Azure resources. + +Passing offline enum tests is not evidence of a service/specification mismatch +or a need for additional `client.tsp` customizations. They verify the declared +contract, with the documented rotation-action workaround. Recorded tests compare +actual service wire values with named variants so that extensible enums do not +hide a casing mismatch as `UnknownValue`. Optional fields absent from a response +are not claimed as live coverage. + +The service's `CustomizedRecoverable+Purgeable` recovery level is not declared +in the current specification. The seven-day-retention key tests verify its exact +preserved `UnknownValue`, not named-enum compatibility. The name-availability test +remains ignored because the service returns undeclared reason `Invalid`. +[TODO.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/keyvault/azure_resourcemanager_keyvault/TODO.md) tracks both shared contract corrections. + +## Recorded vault tests + +Provision the shared Key Vault test resources and configure the test environment +using the repository guide before recording. The tests use the provisioned +subscription, resource group, location, tenant, and test principal values. +When enabled, name-availability coverage also reads `AZURE_KEYVAULT_URL`; it does +not modify that shared fixture. + +Vault scenarios are in `tests/vaults.rs`. Each mutating test owns its vault; +multiple key cases within one test reuse that vault. Tests must not depend on +execution order or share mutable vaults. + +| Test | Scenarios | New Standard vault names | +| --- | --- | ---: | +| `key_lifecycle` | RSA operations, list/get, and key versions | 1 | +| `ec_key_lifecycle` | Four curves, signing operations, and key versions | 1 | +| `key_rotation_policy` | Notification and rotation actions on the key-level GET; versioned key retrieval | 1 | +| `secret_lifecycle` | Create, list, update with value, and get | 1 | +| `vault_network_rules` | ACL actions and bypass options | 1 | +| `vault_access_policies` | Add/replace/remove; key, secret, certificate, and storage permissions | 1 | +| `vault_recovery` | Create, delete, recover the same name, and delete again | 1 | +| `vault_name_availability` (ignored) | Invalid and already-existing names; pending the specification correction | 0 | + +The vault target creates seven unique Standard vaults, six keys, and one secret. +The recovery scenario uses one vault name through two provisioning cycles. +The separate `tests/readme.rs` target creates one more vault. A full live run +therefore creates eight unique Standard vaults with nine provisioning cycles. +Deletion is soft deletion, not purge. Premium vaults, real private endpoints, +multi-region deployments, and purge coverage are not included. + +Run recording and playback explicitly: + +```sh +AZURE_TEST_MODE=record cargo test -p azure_resourcemanager_keyvault --all-features --test vaults +AZURE_TEST_MODE=playback cargo test -p azure_resourcemanager_keyvault --all-features --test vaults +``` + +Recording creates resources; playback does not. Limit the test filter when +investigating one scenario, and inspect a new service failure before rerunning +or changing expected wire values. + +Test setup removes `SANITIZE_BODY_NAME` because its recursive path also replaces +SKU enum values. This preserves the generated test resource names and exact SKU +spellings needed by playback assertions. Other default sanitizers remain active. + +### Recording migration + +Moving from `tests/lifecycle.rs` changes recording identifiers to `vaults/...` +and `managed_hsms/...`. Record and play back new or expanded scenarios before +replacing usable old recordings; do not fabricate recordings or assume the old +request sequence matches the expanded tests. After recording and playback +succeed, update the recording assets through the repository test-proxy workflow. + +## Managed HSM tests + +All three tests in `tests/managed_hsms.rs` remain ignored: + +| Test | Prerequisites and resource use | +| --- | --- | +| `managed_hsm_lifecycle` | Creates one HSM; verifies SKU and returned lifecycle metadata, then deletes it | +| `managed_hsm_network_rules` | Creates one HSM; exercises ACL and public-network settings, then deletes it | +| `managed_hsm_key_lifecycle` | Requires a third, dedicated activated disposable HSM; creates two keys | + +The first two tests require service availability, regional quota, and the +provisioned test principal. The key test additionally requires +`KEYVAULT_MANAGED_HSM_NAME` and `KEYVAULT_MANAGED_HSM_DISPOSABLE=true`. +Its provisioning owner must dispose of that fixture and its keys after use. +These management clients do not provide a key-delete operation; the test must +not run against a shared or user-owned HSM. + +No security-domain activation, private networking, or multi-region provisioning +is performed by these tests. Their service behavior remains unverified until +the dedicated provisioning and recording requirements are met. diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/Cargo.toml b/sdk/keyvault/azure_resourcemanager_keyvault/Cargo.toml new file mode 100644 index 0000000000..af41153dba --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "azure_resourcemanager_keyvault" +version = "0.1.0" +description = "Azure Resource Manager client library for Azure Key Vault" +readme = "README.md" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +homepage = "https://github.com/azure/azure-sdk-for-rust" +documentation = "https://docs.rs/azure_resourcemanager_keyvault" +keywords = ["sdk", "cloud", "mgmt"] +categories = ["api-bindings"] +exclude.workspace = true + +[features] +default = ["azure_core/default"] + +[dependencies] +async-trait = { workspace = true } +azure_core = { path = "../../core/azure_core", version = "1.2.0-beta.2", default-features = false, features = [ + "resource_manager", +] } +serde = { workspace = true } + +[dev-dependencies] +azure_core_test = { path = "../../core/azure_core_test", features = ["tracing"] } +azure_identity = { path = "../../identity/azure_identity" } +azure_security_keyvault_test = { path = "../azure_security_keyvault_test" } +futures.workspace = true +include-file.workspace = true +serde_json.workspace = true +tokio.workspace = true + +[lints] +workspace = true + +[package.metadata.docs.rs] +all-features = true diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/README.md b/sdk/keyvault/azure_resourcemanager_keyvault/README.md new file mode 100644 index 0000000000..101661b637 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/README.md @@ -0,0 +1,238 @@ +# Azure Key Vault Resource Manager client library for Rust + +Manage resources provided by `Microsoft.KeyVault`, including vaults, managed HSMs, +keys, secrets, and private endpoint connections. For applications that read secret +values or perform cryptographic operations, use the Key Vault data-plane libraries +instead. + +[Source code] | [Package (crates.io)] | [API reference documentation] | [Product documentation] + +## Getting started + +### Install the package + +```sh +cargo add azure_resourcemanager_keyvault azure_identity azure_core futures +cargo add tokio --features macros,rt-multi-thread +``` + +### Prerequisites + +- An Azure subscription and an existing resource group. +- Permission to manage Key Vault resources in that resource group. +- An authenticated Azure CLI session for local development: + +```azurecli +az login +``` + +### Authenticate the client + +Use `DeveloperToolsCredential` during local development. Use a managed identity in +production. The client defaults to Public cloud. Use cloud configuration to +select Government, China, or a custom cloud. + +```rust no_run create_client +use azure_identity::DeveloperToolsCredential; +use azure_resourcemanager_keyvault::KeyVaultClient; + +#[tokio::main] +async fn main() -> azure_core::Result<()> { + let credential = DeveloperToolsCredential::new(None)?; + let client = KeyVaultClient::new( + "".into(), + credential, + None, + )?; + let vaults = client.get_key_vault_vaults_client(); + Ok(()) +} +``` + +Custom cloud configuration is passed through `KeyVaultClientOptions.client_options.cloud`. +Set the management endpoint separately from the authentication audience. Use +`azure_core::cloud::resource_manager::Audience`, which is shared by all Resource +Manager clients. Configure your developer tool for the custom cloud and sign in +before using `DeveloperToolsCredential`. + +```rust no_run create_custom_cloud_client +use azure_core::{ + cloud::{resource_manager::Audience, Audiences, CustomConfiguration}, + http::ClientOptions, +}; +use azure_identity::DeveloperToolsCredential; +use azure_resourcemanager_keyvault::{KeyVaultClient, KeyVaultClientOptions}; +use std::sync::Arc; + +#[tokio::main] +async fn main() -> azure_core::Result<()> { + let mut custom = CustomConfiguration::default(); + custom.authority_host = "https://login.example.com".into(); + custom.endpoint = Some("https://management.example.com".into()); + custom.audiences = Audiences::new() + .with::("https://resource.example.com".into()); + let cloud = Arc::new(custom.into()); + let credential = DeveloperToolsCredential::new(None)?; + let client = KeyVaultClient::new( + "".into(), + credential, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + cloud: Some(cloud), + ..Default::default() + }, + ..Default::default() + }), + )?; + let vaults = client.get_key_vault_vaults_client(); + Ok(()) +} +``` + +## Key concepts + +`KeyVaultClient` is scoped to a subscription. Its specialized clients manage individual +resource kinds. Creation and other long-running operations return a poller: +await it to receive the final response, or stream operation-status responses +before awaiting the result. The initial request is sent when the poller is first +polled or awaited. + +## Examples + +The following examples use `vaults` from the client above, a resource group named +by `resource_group`, a unique `vault_name`, and your subscription's `location` and +`tenant_id`. + +- [Create a vault](#create-a-vault) +- [List vaults](#list-vaults) +- [Update a vault](#update-a-vault) +- [Handle errors](#handle-errors) +- [Delete a vault](#delete-a-vault) + +### Create a vault + +```rust ignore create_vault +use azure_resourcemanager_keyvault::models::{ + Sku, SkuFamily, SkuName, VaultCreateOrUpdateParameters, VaultProperties, +}; + +let parameters = VaultCreateOrUpdateParameters { + location: Some(location.clone()), + properties: Some(VaultProperties { + tenant_id: Some(tenant_id.parse()?), + sku: Some(Sku { + family: Some(SkuFamily::A), + name: Some(SkuName::Standard), + }), + access_policies: Some(vec![]), + enable_rbac_authorization: Some(true), + ..Default::default() + }), + ..Default::default() +}; +let vault = vaults + .begin_create_or_update( + &resource_group, + &vault_name, + parameters.try_into()?, + None, + )? + .await? + .into_model()?; +assert_eq!(vault.name.as_deref(), Some(vault_name.as_str())); +``` + +### List vaults + +List resources in the resource group rather than enumerating other resource groups. + +```rust ignore list_vaults +use futures::TryStreamExt as _; + +let mut pages = vaults + .list_by_resource_group(&resource_group, None)? + .into_stream(); +let mut found = false; +while let Some(vault) = pages.try_next().await? { + found |= vault.name.as_deref() == Some(vault_name.as_str()); +} +assert!(found); +``` + +### Update a vault + +```rust ignore update_vault +use azure_resourcemanager_keyvault::models::VaultPatchParameters; +use std::collections::HashMap; + +let vault = vaults + .update( + &resource_group, + &vault_name, + VaultPatchParameters { + tags: Some(HashMap::from([("purpose".into(), "example".into())])), + ..Default::default() + } + .try_into()?, + None, + ) + .await? + .into_model()?; +assert_eq!( + vault.tags.as_ref().and_then(|tags| tags.get("purpose")).map(String::as_str), + Some("example"), +); +``` + +### Handle errors + +Inspect an error's HTTP status instead of matching its message. + +```rust ignore errors +use azure_core::http::StatusCode; + +let error = vaults + .get(&resource_group, &missing_vault_name, None) + .await + .expect_err("the vault does not exist"); +assert_eq!(error.http_status(), Some(StatusCode::NotFound)); +``` + +### Delete a vault + +Deleting a vault does not purge a soft-deleted vault. + +```rust ignore delete_vault +vaults.delete(&resource_group, &vault_name, None).await?; +``` + +## Troubleshooting + +### General + +Verify that the credential belongs to the correct tenant, the subscription and +resource group exist, and the identity has the necessary Resource Manager +permissions. Data-plane access requires separate permissions. + +Managed HSM operations require service availability and subscription quota. +For custom clouds, supply both the management endpoint and the shared Resource +Manager audience, and ensure the credential authenticates against the correct cloud. + +## Contributing + +See the [CONTRIBUTING.md] for details on building, testing, and contributing to these libraries. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct]. For more information see the [Code of Conduct FAQ] or contact with any additional questions or comments. + + +[API reference documentation]: https://docs.rs/azure_resourcemanager_keyvault/latest/azure_resourcemanager_keyvault +[Microsoft Open Source Code of Conduct]: https://opensource.microsoft.com/codeofconduct/ +[Product documentation]: https://learn.microsoft.com/azure/key-vault/ +[Package (crates.io)]: https://crates.io/crates/azure_resourcemanager_keyvault +[Source code]: https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/keyvault/azure_resourcemanager_keyvault/src +[CONTRIBUTING.md]: https://github.com/Azure/azure-sdk-for-rust/blob/main/CONTRIBUTING.md +[Code of Conduct FAQ]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/TODO.md b/sdk/keyvault/azure_resourcemanager_keyvault/TODO.md new file mode 100644 index 0000000000..063d03843a --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/TODO.md @@ -0,0 +1,275 @@ +# Resource Manager generation follow-up + + + +Track changes needed in the specification and Rust emitter to regenerate +`azure_resourcemanager_keyvault` without manual generated-source patches. +Local development, test coverage, and recording instructions belong in +[CONTRIBUTING.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/keyvault/azure_resourcemanager_keyvault/CONTRIBUTING.md), not this checklist. + +## Azure/azure-rest-api-specs + +Repository: + +TypeSpec folder: +[`specification/keyvault/resource-manager/Microsoft.KeyVault/KeyVault`](https://github.com/Azure/azure-rest-api-specs/tree/e35ce3d9e784cc6c298ae85608b9f79e7c833d28/specification/keyvault/resource-manager/Microsoft.KeyVault/KeyVault) + +Current source commit: `e35ce3d9e784cc6c298ae85608b9f79e7c833d28`. +The Rust prototype targets stable API version `2026-05-15`. + +### Emitter configuration + +- [ ] Add Rust configuration to **`tspconfig.yaml`** (the existing filename is not + `tspconfig.yml`). Retain the other languages' options and existing `emit` list; + `tsp-client` selects the Rust emitter explicitly. Add the following options: + + ```yaml + options: + "@azure-tools/typespec-rust": + crate-name: "azure_resourcemanager_keyvault" + crate-version: "0.1.0" + api-version: "2026-05-15" + emitter-output-dir: "{output-dir}/{service-dir}/{crate-name}" + ``` + +- [ ] Retain the existing `service-dir` default of `sdk/keyvault`, and verify + `tsp-client init` and `tsp-client update` discover the Rust output directory + without command-line emitter overrides. The prototype needed overrides because + the pinned configuration has no Rust options. + +### Existing client customizations to extend + +- [ ] Add `rust` to the language list on **both** managed HSM SKU enum renames + in `client.tsp`. This aligns Rust with the shared SDK names, not with Go's + acronym spelling. Update the two existing declarations to: + + ```typespec + @@clientName( + ManagedHsmSkuNameV2, + "ManagedHsmSkuName", + "csharp,java,python,javascript,rust" + ); + @@clientName( + ManagedHsmSkuName, + "ManagedHsmLegacySkuName", + "csharp,java,python,javascript,rust" + ); + ``` + +Apply the legacy enum rename together with the current enum rename to avoid +name collisions when both types are generated. These are naming improvements, +not fixes for the observed service failures. + +The complete pinned `client.tsp` has no existing customization for rotation +action wire values, required secret PATCH fields, polling generation, or cloud +configuration. Adding `rust` to existing language lists cannot supply those fixes. + +No other existing language-list extension is required for this prototype. +The `!csharp` scopes already include Rust. Other languages' compatibility +customizations do not need to be copied. + +### Model contract corrections requiring new changes + +- [ ] Add the observed `CustomizedRecoverable+Purgeable` value to the shared + `DeletionRecoveryLevel` wire contract. Vaults configured with seven-day soft + deletion return this value; the generated extensible enum currently preserves + it as `UnknownValue`. Confirm any additional customized-retention values and + managed HSM behavior before extending the enum further. +- [ ] Reconcile the vault name-availability `Reason` wire values with the + service. An invalid name returned `Invalid`, while the specification declares + `AccountNameInvalid`; the live test is ignored pending a contract correction. + Confirm the existing-name reason and managed HSM behavior before changing the + shared enum. Do not hide this mismatch with general casing normalization. +- [ ] Reconcile `KeyRotationPolicyActionType` in `models.tsp` with the service. + The specification and its generated OpenAPI declare `notify` and `rotate`; + a recorded successful key GET returned `Notify`. Confirm the service's accepted + and returned casing for **both** actions, including managed HSM keys. +- [ ] Prefer fixing an incorrect shared wire contract in `models.tsp`. If a + compatibility customization is necessary in `client.tsp`, make it affect the + serialized values, not merely the generated member names. A `clientName` + override alone cannot fix this mismatch. Decide whether lowercase values must + remain accepted for compatibility before choosing the final representation. + The local generated-code workaround uses `Notify` and `Rotate`; both have now + been observed in recorded vault key policy responses. Managed HSM casing + remains unverified. +- [ ] Verify the secret PATCH contract. A tags-only `SecretPatchParameters` + request failed with `ParameterNotSpecified`: `properties` was missing. + Including `properties.contentType` then failed because `value` was missing. + Determine whether the specification should require both `properties` and + `properties.value`, or whether the service should accept metadata-only updates. + The local lifecycle test now sends the test value and content type alongside + tags; this is a test correction, not a reason to silently inject properties + or values into generated requests. +- [ ] Regenerate the affected OpenAPI artifacts and run the specification's + validation after changing shared models or operation metadata. + +## Azure/typespec-rust + +Repository: + +The prototype used `@azure-tools/typespec-rust` version `0.41.5`. + +### Emitter configuration + +- [ ] Document and test support for the common `api-version` option used by the + specification configuration. The prototype generated `2026-05-15` with that + option, but the Rust emitter's own schema does not explicitly declare it. + Do not introduce an unimplemented Resource Manager mode or `flavor` option. + +### Resource Manager polling + +- [ ] Detect Resource Manager operations from TypeSpec/client metadata and emit + `azure_core::http::poller::resource_manager::new_poller` instead of duplicating polling + state machines or introducing a separate poller type. Keep returning the + existing `Poller` and preserve lazy initial-request execution. +- [ ] Migrate every applicable operation, including these eight prototype cases: + vault create/update and purge; managed HSM create/update, update, delete, and + purge; vault private endpoint connection delete; and managed HSM private + endpoint connection delete. +- [ ] Map operation metadata to `Option>`. The prototype passes + `Some(FinalStateVia::Location)` for six operations and `None` for managed HSM + delete and purge. Preserve omission as method/response-based fallback, not an + `Automatic` variant or an implicit Location selector. +- [ ] Support all helper selectors: `AzureAsyncOperation`, `Location`, `OriginalUrl`, + and `OperationLocation`. For inline Operation-Location results, generate + the extraction callback from result-path metadata. Preserve response status + and headers and extract the original JSON bytes without serializing the + complete model again. No Key Vault operation currently exercises this callback. +- [ ] Generate Resource Manager `PollerOptions` in long-running method options + from `azure_core::http::poller::resource_manager`, along with `FinalStateVia` + in clients, and preserve caller context and polling frequency. Leave ordinary + method and pager options unchanged. +- [ ] Generate `StatusMonitor::Output = ()` with `StatusMonitor::Format = NoFormat` + for empty final results. The prototype corrected managed HSM delete, managed + HSM purge, and vault purge. Retain JSON formats for resource results. +- [ ] Delegate protocol selection, polling URLs, provisioning states, API-version + handling, final GET decisions, and empty responses to the helper. Do not emit + a competing implementation of those rules. The runtime already removes request + bodies from polling GETs and retains the initial `Accept` header on every + subsequent GET. It uses only `properties.provisioningState` for resource + responses, defaults a missing provisioning state to success, and reads + top-level `status` only from operation-monitor responses. Polling and final + GET requests always use the initial request's API version, replacing any + service-supplied version and adding it when absent. +- [ ] Clean up imports after removing inline polling logic, but retain `json` + and `RawResponse` wherever pagination still uses them. + +### Client constructors, authentication, and package generation + +- [ ] Generate Resource Manager constructors that read + `options.client_options.cloud` and default to Public cloud when omitted. + Emit the prototype's borrowed-default pattern: + + ```rust + use azure_core::cloud::resource_manager::CloudConfigurationExt as _; + + let options = options.unwrap_or_default(); + let cloud = options.client_options.cloud.as_deref().unwrap_or_default(); + let endpoint = cloud + .endpoint() + .ok_or_else(|| Error::new(ErrorKind::Other, "missing Resource Manager endpoint"))?; + let endpoint = Url::parse(endpoint)?; + let scope = cloud.default_scope()?.into_owned(); + ``` + + Keep `options.client_options` available to move into `Pipeline::new`. + Import `azure_core::cloud::resource_manager::CloudConfigurationExt as _` in + generated and hand-written constructors. Resolve the management endpoint with + `cloud.endpoint()` and the token scope with `cloud.default_scope()`. These + trait methods take no audience type parameter; core uses the shared + `azure_core::cloud::resource_manager::Audience` marker internally. +- [ ] For every crate whose name starts with `azure_resourcemanager_`, do not + define or re-export a per-crate `Audience`. Continue generating per-crate + audience markers for data-plane crates without that prefix. + Use `azure_core::cloud::resource_manager::Audience` to register custom audiences + in examples and tests; constructors import `CloudConfigurationExt` instead. + A single custom audience entry must work across Resource Manager crates. +- [ ] Parse the returned endpoint with `Url::parse`, return an explicit + configuration error when `endpoint()` returns `None`, and propagate errors + from `default_scope()`. Pass the scope's `into_owned()` result to + `BearerTokenAuthorizationPolicy`; do not generate endpoint tables, cloud + matches, or manual `/.default` concatenation. +- [ ] Keep the identity authority, service endpoint, authentication audience, and + token scope conceptually distinct. Never use the login authority as the + Resource Manager endpoint, and never derive the endpoint from a token scope. +- [ ] Honor `CustomConfiguration::endpoint` independently of the shared ARM + `Audience`. A custom cloud must supply both an endpoint and an audience; + they need not be the same URL. Configure the credential's identity authority + separately. Replace the prototype's audience-as-endpoint coupling. +- [ ] Delegate Public, Government, and China cloud mappings to core. Remove the + prototype's Government, China, and future-cloud `todo!()` branches rather than + generating a competing list of supported clouds. +- [ ] Generate accurate constructor documentation for the default cloud, + custom-cloud endpoint and audience requirements, and configuration/URL errors. + Fully qualify the shared audience link as + ``[`Audience`](azure_core::cloud::resource_manager::Audience)``; importing only + `CloudConfigurationExt as _` does not bring `Audience` into rustdoc scope. + Remove the obsolete unsupported-cloud panic documentation. + Use "Resource Manager" in public documentation and `resource_manager` in + module, field, function, method, and feature names. Retain the + `azure_resourcemanager_*` crate prefix. Prefer nested `resource_manager` + modules over `ResourceManager` type or variant prefixes when disambiguating + from data-plane APIs; retain short names such as `PollerOptions` and `Audience` + within those modules. +- [ ] Generate two client-construction examples in each Resource Manager README: + the normal default-cloud case first, then a custom-cloud case using the shared + `azure_core::cloud::resource_manager::Audience`. Configure + `CustomConfiguration::authority_host` and `endpoint`, register the audience, + and pass the same cloud to a cloud-aware credential and the service client. + `DeveloperToolsCredential` uses the developer tools' cloud settings and has + no cloud option; use a credential such as `ClientSecretCredential` for the + explicit custom-cloud example. Keep endpoint and authentication audience URLs + distinct and load secrets from a secure source, not generated literals. + Caller examples do not need `CloudConfigurationExt`: configuring + `CloudConfiguration`, `CustomConfiguration`, and `Audiences` is unchanged. + Keep the shared `Audience` import for custom audience registration. +- [ ] Generate a manifest dependency enabling `azure_core`'s `resource_manager` + feature, preserve `default-features = false`, and forward default transport + features consistently. Require a core version containing both the polling + helper and `cloud::resource_manager::CloudConfigurationExt` and `Audience`, + which are all gated by that feature. + The prototype temporarily uses local `azure_core` path plus version + `1.2.0-beta.2`; do not hard-code local paths into published service generation. + +### Generation regression coverage + +- [ ] Port the prototype's constructor and polling cases into emitter fixtures: + omitted/Public/Government/China/custom clouds, distinct custom endpoint and + audience URLs, missing custom endpoint, missing custom audience, invalid + endpoint URLs, borrowed context, every long-running method, streamed monitors + followed by awaiting, explicit final-state metadata, and failure propagation. +- [ ] Verify generated constructors delegate endpoint and scope resolution to + core and preserve its errors. Assert that fixtures emit + `cloud.as_deref().unwrap_or_default()` rather than cloning the configured + cloud, allocating a default `Arc`, or hard-coding `AzurePublic`. + Verify that ARM crates do not emit an `Audience` declaration and import + `azure_core::cloud::resource_manager::CloudConfigurationExt as _` in constructors. + Verify that generated imports, rustdoc links, and manifest features use + `resource_manager`, while the crate name remains `azure_resourcemanager_keyvault`. + Call `endpoint()`, `audience()`, and `default_scope()` without audience type + parameters rather than emitting inline cloud mappings, custom audience + lookups, or scope construction. + Keep cloud mappings and scope normalization + semantics tested in `azure_core`, not reimplemented in emitter fixtures. + The core API in `dfc31db6e1` appends `/.default` to custom audiences verbatim; + do not retain the prototype's trailing-slash normalization as an emitter rule. +- [ ] Verify both README client-construction examples compile against generated + APIs, including the credential's cloud options. Register custom audiences only + with the core Resource Manager marker in fixtures so that a mistakenly emitted + per-crate marker fails the custom-cloud test. Verify data-plane generation + retains its per-crate audience marker. Verify caller examples configure clouds + without importing `CloudConfigurationExt`; only constructor implementations + need the trait. +- [ ] Cover all polling protocols, repeated GETs without bodies preserving `Accept`, + resource and empty final results, and Operation-Location inline extraction. + Use operation-monitor responses when testing streamed top-level `status`; + Location resource responses use `properties.provisioningState` or HTTP status. + Verify failed operations expose service error details through `ErrorResponse` + even when the HTTP response is 200. + Keep protocol semantics tested in `azure_core`; emitter tests should verify + metadata selection and generated integration with that runtime. +- [ ] Add a generation fixture for key action wire-value fidelity and a secret + PATCH containing tags, explicit properties, and a value. Keep service + recordings as evidence, not as a source of private payloads in emitter tests. + Verify that PascalCase Rust identifiers preserve specified wire values; + do not fix the service mismatch with a global enum-casing transformation. diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/api.md b/sdk/keyvault/azure_resourcemanager_keyvault/api.md new file mode 100644 index 0000000000..d419e5babb --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/api.md @@ -0,0 +1,2696 @@ +# azure_resourcemanager_keyvault + +- **Description**: Azure Resource Manager client library for Azure Key Vault +- **Edition**: 2021 +- **Rust version**: 1.88 + +## Features + +- `default` + - `azure_core/default` + +```rust +#![crate_name = "azure_resourcemanager_keyvault"] +#![crate_type = "lib"] +#![cfg_attr(docsrs, feature(doc_cfg))] +pub struct KeyVaultClient { +} +impl KeyVaultClient { + pub fn endpoint(&self) -> &Url; + pub fn get_key_vault_keys_client(&self) -> KeyVaultKeysClient; + pub fn get_key_vault_managed_hsm_keys_client(&self) -> KeyVaultManagedHsmKeysClient; + pub fn get_key_vault_managed_hsms_client(&self) -> KeyVaultManagedHsmsClient; + pub fn get_key_vault_mhsm_private_endpoint_connections_client(&self) -> KeyVaultMHSMPrivateEndpointConnectionsClient; + pub fn get_key_vault_mhsm_private_link_resources_client(&self) -> KeyVaultMHSMPrivateLinkResourcesClient; + pub fn get_key_vault_mhsm_regions_client(&self) -> KeyVaultMHSMRegionsClient; + pub fn get_key_vault_operations_client(&self) -> KeyVaultOperationsClient; + pub fn get_key_vault_private_endpoint_connections_client(&self) -> KeyVaultPrivateEndpointConnectionsClient; + pub fn get_key_vault_private_link_resources_client(&self) -> KeyVaultPrivateLinkResourcesClient; + pub fn get_key_vault_secrets_client(&self) -> KeyVaultSecretsClient; + pub fn get_key_vault_vaults_client(&self) -> KeyVaultVaultsClient; + pub fn new(subscription_id: String, credential: Arc, options: Option) -> Result; +} +#[derive(Clone, Debug)] +pub struct KeyVaultClientOptions { + pub api_version: String, + pub client_options: azure_core::http::ClientOptions, +} +impl Default for KeyVaultClientOptions { + fn default() -> Self; +} +pub mod clients { + pub struct KeyVaultClient { + } + impl KeyVaultClient { + pub fn endpoint(&self) -> &Url; + pub fn get_key_vault_keys_client(&self) -> KeyVaultKeysClient; + pub fn get_key_vault_managed_hsm_keys_client(&self) -> KeyVaultManagedHsmKeysClient; + pub fn get_key_vault_managed_hsms_client(&self) -> KeyVaultManagedHsmsClient; + pub fn get_key_vault_mhsm_private_endpoint_connections_client(&self) -> KeyVaultMHSMPrivateEndpointConnectionsClient; + pub fn get_key_vault_mhsm_private_link_resources_client(&self) -> KeyVaultMHSMPrivateLinkResourcesClient; + pub fn get_key_vault_mhsm_regions_client(&self) -> KeyVaultMHSMRegionsClient; + pub fn get_key_vault_operations_client(&self) -> KeyVaultOperationsClient; + pub fn get_key_vault_private_endpoint_connections_client(&self) -> KeyVaultPrivateEndpointConnectionsClient; + pub fn get_key_vault_private_link_resources_client(&self) -> KeyVaultPrivateLinkResourcesClient; + pub fn get_key_vault_secrets_client(&self) -> KeyVaultSecretsClient; + pub fn get_key_vault_vaults_client(&self) -> KeyVaultVaultsClient; + pub fn new(subscription_id: String, credential: Arc, options: Option) -> Result; + } + #[derive(Clone, Debug)] + pub struct KeyVaultClientOptions { + pub api_version: String, + pub client_options: azure_core::http::ClientOptions, + } + impl Default for KeyVaultClientOptions { + fn default() -> Self; + } + pub struct KeyVaultKeysClient { + } + impl KeyVaultKeysClient { + pub async fn create_if_not_exist(&self, resource_group_name: &str, vault_name: &str, key_name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, vault_name: &str, key_name: &str, options: Option>) -> Result>; + pub async fn get_version(&self, resource_group_name: &str, vault_name: &str, key_name: &str, key_version: &str, options: Option>) -> Result>; + pub fn list(&self, resource_group_name: &str, vault_name: &str, options: Option>) -> Result>; + pub fn list_versions(&self, resource_group_name: &str, vault_name: &str, key_name: &str, options: Option>) -> Result>; + } + pub struct KeyVaultMHSMPrivateEndpointConnectionsClient { + } + impl KeyVaultMHSMPrivateEndpointConnectionsClient { + pub fn begin_delete(&self, resource_group_name: &str, name: &str, private_endpoint_connection_name: &str, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, name: &str, private_endpoint_connection_name: &str, options: Option>) -> Result>; + pub fn list_by_resource(&self, resource_group_name: &str, name: &str, options: Option>) -> Result>; + pub async fn put(&self, resource_group_name: &str, name: &str, private_endpoint_connection_name: &str, properties: RequestContent, options: Option>) -> Result>; + } + pub struct KeyVaultMHSMPrivateLinkResourcesClient { + } + impl KeyVaultMHSMPrivateLinkResourcesClient { + pub fn endpoint(&self) -> &Url; + pub async fn list_by_mhsm_resource(&self, resource_group_name: &str, name: &str, options: Option>) -> Result>; + } + pub struct KeyVaultMHSMRegionsClient { + } + impl KeyVaultMHSMRegionsClient { + pub fn endpoint(&self) -> &Url; + pub fn list_by_resource(&self, resource_group_name: &str, name: &str, options: Option>) -> Result>; + } + pub struct KeyVaultManagedHsmKeysClient { + } + impl KeyVaultManagedHsmKeysClient { + pub async fn create_if_not_exist(&self, resource_group_name: &str, name: &str, key_name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, name: &str, key_name: &str, options: Option>) -> Result>; + pub async fn get_version(&self, resource_group_name: &str, name: &str, key_name: &str, key_version: &str, options: Option>) -> Result>; + pub fn list(&self, resource_group_name: &str, name: &str, options: Option>) -> Result>; + pub fn list_versions(&self, resource_group_name: &str, name: &str, key_name: &str, options: Option>) -> Result>; + } + pub struct KeyVaultManagedHsmsClient { + } + impl KeyVaultManagedHsmsClient { + pub fn begin_create_or_update(&self, resource_group_name: &str, name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub fn begin_delete(&self, resource_group_name: &str, name: &str, options: Option>) -> Result>; + pub fn begin_purge_deleted(&self, location: &str, name: &str, options: Option>) -> Result>; + pub fn begin_update(&self, resource_group_name: &str, name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub async fn check_mhsm_name_availability(&self, mhsm_name: RequestContent, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, name: &str, options: Option>) -> Result>; + pub async fn get_deleted(&self, location: &str, name: &str, options: Option>) -> Result>; + pub fn list_by_resource_group(&self, resource_group_name: &str, options: Option>) -> Result>; + pub fn list_by_subscription(&self, options: Option>) -> Result>; + pub fn list_deleted(&self, options: Option>) -> Result>; + } + pub struct KeyVaultOperationsClient { + } + impl KeyVaultOperationsClient { + pub fn endpoint(&self) -> &Url; + pub fn list(&self, options: Option>) -> Result>; + } + pub struct KeyVaultPrivateEndpointConnectionsClient { + } + impl KeyVaultPrivateEndpointConnectionsClient { + pub fn begin_delete(&self, resource_group_name: &str, vault_name: &str, private_endpoint_connection_name: &str, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, vault_name: &str, private_endpoint_connection_name: &str, options: Option>) -> Result>; + pub fn list_by_resource(&self, resource_group_name: &str, vault_name: &str, options: Option>) -> Result>; + pub async fn put(&self, resource_group_name: &str, vault_name: &str, private_endpoint_connection_name: &str, properties: RequestContent, options: Option>) -> Result>; + } + pub struct KeyVaultPrivateLinkResourcesClient { + } + impl KeyVaultPrivateLinkResourcesClient { + pub fn endpoint(&self) -> &Url; + pub async fn list_by_vault(&self, resource_group_name: &str, vault_name: &str, options: Option>) -> Result>; + } + pub struct KeyVaultSecretsClient { + } + impl KeyVaultSecretsClient { + pub async fn create_or_update(&self, resource_group_name: &str, vault_name: &str, secret_name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, vault_name: &str, secret_name: &str, options: Option>) -> Result>; + pub fn list(&self, resource_group_name: &str, vault_name: &str, options: Option>) -> Result>; + pub async fn update(&self, resource_group_name: &str, vault_name: &str, secret_name: &str, parameters: RequestContent, options: Option>) -> Result>; + } + pub struct KeyVaultVaultsClient { + } + impl KeyVaultVaultsClient { + pub fn begin_create_or_update(&self, resource_group_name: &str, vault_name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub fn begin_purge_deleted(&self, location: &str, vault_name: &str, options: Option>) -> Result>; + pub async fn check_name_availability(&self, vault_name: RequestContent, options: Option>) -> Result>; + pub async fn delete(&self, resource_group_name: &str, vault_name: &str, options: Option>) -> Result>; + pub fn endpoint(&self) -> &Url; + pub async fn get(&self, resource_group_name: &str, vault_name: &str, options: Option>) -> Result>; + pub async fn get_deleted(&self, location: &str, vault_name: &str, options: Option>) -> Result>; + pub fn list(&self, options: Option>) -> Result>; + pub fn list_by_resource_group(&self, resource_group_name: &str, options: Option>) -> Result>; + pub fn list_by_subscription(&self, options: Option>) -> Result>; + pub fn list_deleted(&self, options: Option>) -> Result>; + pub async fn update(&self, resource_group_name: &str, vault_name: &str, parameters: RequestContent, options: Option>) -> Result>; + pub async fn update_access_policy(&self, resource_group_name: &str, vault_name: &str, operation_kind: AccessPolicyUpdateKind, parameters: RequestContent, options: Option>) -> Result>; + } +} +pub mod models { + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct AccessPolicyEntry { + #[serde(rename = "applicationId", skip_serializing_if = "Option::is_none")] + pub application_id: Option, + #[serde(rename = "objectId", skip_serializing_if = "Option::is_none")] + pub object_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub permissions: Option, + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct Action { + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct CheckMhsmNameAvailabilityParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: CheckMhsmNameAvailabilityParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct CheckMhsmNameAvailabilityResult { + #[serde(skip_serializing)] + pub message: Option, + #[serde(rename = "nameAvailable", skip_serializing)] + pub name_available: Option, + #[serde(skip_serializing)] + pub reason: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct CheckNameAvailabilityResult { + #[serde(skip_serializing)] + pub message: Option, + #[serde(rename = "nameAvailable", skip_serializing)] + pub name_available: Option, + #[serde(skip_serializing)] + pub reason: Option, + } + #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] + pub struct CloudError { + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + } + #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] + pub struct CloudErrorBody { + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DeletedManagedHsm { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DeletedManagedHsmListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::DeletedManagedHsmListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = DeletedManagedHsm; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DeletedManagedHsmProperties { + #[serde(default, rename = "deletionDate", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub deletion_date: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(rename = "mhsmId", skip_serializing)] + pub mhsm_id: Option, + #[serde(rename = "purgeProtectionEnabled", skip_serializing)] + pub purge_protection_enabled: Option, + #[serde(default, rename = "scheduledPurgeDate", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub scheduled_purge_date: Option, + #[serde(skip_serializing)] + pub tags: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DeletedVault { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DeletedVaultListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::DeletedVaultListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = DeletedVault; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DeletedVaultProperties { + #[serde(default, rename = "deletionDate", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub deletion_date: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(rename = "purgeProtectionEnabled", skip_serializing)] + pub purge_protection_enabled: Option, + #[serde(default, rename = "scheduledPurgeDate", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub scheduled_purge_date: Option, + #[serde(skip_serializing)] + pub tags: Option>, + #[serde(rename = "vaultId", skip_serializing)] + pub vault_id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct DimensionProperties { + #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "toBeExportedForShoebox", skip_serializing_if = "Option::is_none")] + pub to_be_exported_for_shoebox: Option, + } + #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] + pub struct Error { + #[serde(skip_serializing)] + pub code: Option, + #[serde(rename = "innererror", skip_serializing)] + pub inner_error: Option>, + #[serde(skip_serializing)] + pub message: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ErrorAdditionalInfo { + #[serde(skip_serializing)] + pub info: Option, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ErrorDetail { + #[serde(rename = "additionalInfo", skip_serializing)] + pub additional_info: Option>, + #[serde(skip_serializing)] + pub code: Option, + #[serde(skip_serializing)] + pub details: Option>, + #[serde(skip_serializing)] + pub message: Option, + #[serde(skip_serializing)] + pub target: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct IPRule { + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct Key { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing)] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct KeyAttributes { + #[serde(skip_serializing)] + pub created: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "exp", skip_serializing_if = "Option::is_none")] + pub expires: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub exportable: Option, + #[serde(rename = "nbf", skip_serializing_if = "Option::is_none")] + pub not_before: Option, + #[serde(rename = "recoveryLevel", skip_serializing)] + pub recovery_level: Option, + #[serde(skip_serializing)] + pub updated: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct KeyCreateParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: KeyCreateParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::KeyListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = Key; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct KeyProperties { + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[serde(rename = "curveName", skip_serializing_if = "Option::is_none")] + pub curve_name: Option, + #[serde(rename = "keyOps", skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + #[serde(rename = "keySize", skip_serializing_if = "Option::is_none")] + pub key_size: Option, + #[serde(rename = "keyUri", skip_serializing)] + pub key_uri: Option, + #[serde(rename = "keyUriWithVersion", skip_serializing)] + pub key_uri_with_version: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + #[serde(rename = "rotationPolicy", skip_serializing_if = "Option::is_none")] + pub rotation_policy: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct KeyReleasePolicy { + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + #[serde(default, deserialize_with = "base64::option::deserialize_url_safe", serialize_with = "base64::option::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub data: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct KeyRotationPolicyAttributes { + #[serde(skip_serializing)] + pub created: Option, + #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + #[serde(skip_serializing)] + pub updated: Option, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultKeysClientCreateIfNotExistOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultKeysClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultKeysClientGetVersionOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultKeysClientListOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultKeysClientListOptions<'_> { + pub fn into_owned(self) -> KeyVaultKeysClientListOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultKeysClientListVersionsOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultKeysClientListVersionsOptions<'_> { + pub fn into_owned(self) -> KeyVaultKeysClientListVersionsOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + type Format = JsonFormat; + type Output = MHSMPrivateEndpointConnection; + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions<'_> { + pub fn into_owned(self) -> KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultMHSMPrivateEndpointConnectionsClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions<'_> { + pub fn into_owned(self) -> KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultMHSMPrivateEndpointConnectionsClientPutOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultMHSMPrivateLinkResourcesClientListByMhsmResourceOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultMHSMRegionsClientListByResourceOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultMHSMRegionsClientListByResourceOptions<'_> { + pub fn into_owned(self) -> KeyVaultMHSMRegionsClientListByResourceOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmKeysClientCreateIfNotExistOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmKeysClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmKeysClientGetVersionOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmKeysClientListOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultManagedHsmKeysClientListOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmKeysClientListOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmKeysClientListVersionsOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultManagedHsmKeysClientListVersionsOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmKeysClientListVersionsOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus { + type Format = JsonFormat; + type Output = ManagedHsm; + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultManagedHsmsClientBeginDeleteOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultManagedHsmsClientBeginDeleteOperationStatus { + type Format = NoFormat; + type Output = (); + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientBeginDeleteOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultManagedHsmsClientBeginDeleteOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginDeleteOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus { + type Format = NoFormat; + type Output = (); + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientBeginPurgeDeletedOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultManagedHsmsClientBeginPurgeDeletedOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginPurgeDeletedOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultManagedHsmsClientBeginUpdateOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultManagedHsmsClientBeginUpdateOperationStatus { + type Format = JsonFormat; + type Output = ManagedHsm; + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientBeginUpdateOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultManagedHsmsClientBeginUpdateOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginUpdateOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientCheckMhsmNameAvailabilityOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientGetDeletedOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientListByResourceGroupOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + pub top: Option, + } + impl KeyVaultManagedHsmsClientListByResourceGroupOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientListByResourceGroupOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientListBySubscriptionOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + pub top: Option, + } + impl KeyVaultManagedHsmsClientListBySubscriptionOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientListBySubscriptionOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultManagedHsmsClientListDeletedOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultManagedHsmsClientListDeletedOptions<'_> { + pub fn into_owned(self) -> KeyVaultManagedHsmsClientListDeletedOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultOperationsClientListOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultOperationsClientListOptions<'_> { + pub fn into_owned(self) -> KeyVaultOperationsClientListOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + type Format = JsonFormat; + type Output = PrivateEndpointConnection; + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions<'_> { + pub fn into_owned(self) -> KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultPrivateEndpointConnectionsClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultPrivateEndpointConnectionsClientListByResourceOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultPrivateEndpointConnectionsClientListByResourceOptions<'_> { + pub fn into_owned(self) -> KeyVaultPrivateEndpointConnectionsClientListByResourceOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultPrivateEndpointConnectionsClientPutOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultPrivateLinkResourcesClientListByVaultOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultSecretsClientCreateOrUpdateOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultSecretsClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultSecretsClientListOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + pub top: Option, + } + impl KeyVaultSecretsClientListOptions<'_> { + pub fn into_owned(self) -> KeyVaultSecretsClientListOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultSecretsClientUpdateOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus { + type Format = JsonFormat; + type Output = Vault; + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientBeginCreateOrUpdateOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultVaultsClientBeginCreateOrUpdateOptions<'_> { + pub fn into_owned(self) -> KeyVaultVaultsClientBeginCreateOrUpdateOptions<'static>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct KeyVaultVaultsClientBeginPurgeDeletedOperationStatus { + #[serde(default, rename = "endTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub end_time: Option, + #[serde(skip_serializing)] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + #[serde(default, rename = "startTime", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub start_time: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + impl StatusMonitor for super::KeyVaultVaultsClientBeginPurgeDeletedOperationStatus { + type Format = NoFormat; + type Output = (); + fn status(&self) -> PollerStatus; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientBeginPurgeDeletedOptions<'a> { + pub method_options: azure_core::http::poller::resource_manager::PollerOptions<'a>, + } + impl KeyVaultVaultsClientBeginPurgeDeletedOptions<'_> { + pub fn into_owned(self) -> KeyVaultVaultsClientBeginPurgeDeletedOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientCheckNameAvailabilityOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientDeleteOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientGetDeletedOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientGetOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientListByResourceGroupOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + pub top: Option, + } + impl KeyVaultVaultsClientListByResourceGroupOptions<'_> { + pub fn into_owned(self) -> KeyVaultVaultsClientListByResourceGroupOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientListBySubscriptionOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + pub top: Option, + } + impl KeyVaultVaultsClientListBySubscriptionOptions<'_> { + pub fn into_owned(self) -> KeyVaultVaultsClientListBySubscriptionOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientListDeletedOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + } + impl KeyVaultVaultsClientListDeletedOptions<'_> { + pub fn into_owned(self) -> KeyVaultVaultsClientListDeletedOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientListOptions<'a> { + pub method_options: azure_core::http::pager::PagerOptions<'a>, + pub top: Option, + } + impl KeyVaultVaultsClientListOptions<'_> { + pub fn into_owned(self) -> KeyVaultVaultsClientListOptions<'static>; + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientUpdateAccessPolicyOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default)] + pub struct KeyVaultVaultsClientUpdateOptions<'a> { + pub method_options: azure_core::http::ClientMethodOptions<'a>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct LifetimeAction { + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub trigger: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct LogSpecification { + #[serde(rename = "blobDuration", skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, + #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMGeoReplicatedRegion { + #[serde(rename = "isPrimary", skip_serializing_if = "Option::is_none")] + pub is_primary: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMIPRule { + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMNetworkRuleSet { + #[serde(skip_serializing_if = "Option::is_none")] + pub bypass: Option, + #[serde(rename = "defaultAction", skip_serializing_if = "Option::is_none")] + pub default_action: Option, + #[serde(rename = "ipRules", skip_serializing_if = "Option::is_none")] + pub ip_rules: Option>, + #[serde(rename = "serviceTags", skip_serializing_if = "Option::is_none")] + pub service_tags: Option>, + #[serde(rename = "virtualNetworkRules", skip_serializing_if = "Option::is_none")] + pub virtual_network_rules: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMPrivateEndpoint { + #[serde(skip_serializing)] + pub id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMPrivateEndpointConnection { + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: MHSMPrivateEndpointConnection) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MHSMPrivateEndpointConnectionItem { + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMPrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MHSMPrivateEndpointConnectionsListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::MHSMPrivateEndpointConnectionsListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = MHSMPrivateEndpointConnection; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MHSMPrivateLinkResource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MHSMPrivateLinkResourceListResult { + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MHSMPrivateLinkResourceProperties { + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + #[serde(rename = "requiredMembers", skip_serializing)] + pub required_members: Option>, + #[serde(rename = "requiredZoneNames", skip_serializing_if = "Option::is_none")] + pub required_zone_names: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMPrivateLinkServiceConnectionState { + #[serde(rename = "actionsRequired", skip_serializing_if = "Option::is_none")] + pub actions_required: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MHSMRegionsListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::MHSMRegionsListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = MHSMGeoReplicatedRegion; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMServiceTagRule { + #[serde(skip_serializing_if = "Option::is_none")] + pub tag: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct MHSMVirtualNetworkRule { + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ManagedHSMSecurityDomainProperties { + #[serde(rename = "activationStatus", skip_serializing)] + pub activation_status: Option, + #[serde(rename = "activationStatusMessage", skip_serializing)] + pub activation_status_message: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsm { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: ManagedHsm) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmAction { + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, + } + #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmError { + #[serde(skip_serializing)] + pub error: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ManagedHsmKey { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmKeyAttributes { + #[serde(skip_serializing)] + pub created: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "exp", skip_serializing_if = "Option::is_none")] + pub expires: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub exportable: Option, + #[serde(rename = "nbf", skip_serializing_if = "Option::is_none")] + pub not_before: Option, + #[serde(rename = "recoveryLevel", skip_serializing)] + pub recovery_level: Option, + #[serde(skip_serializing)] + pub updated: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmKeyCreateParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: ManagedHsmKeyCreateParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ManagedHsmKeyListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::ManagedHsmKeyListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = ManagedHsmKey; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmKeyProperties { + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[serde(rename = "curveName", skip_serializing_if = "Option::is_none")] + pub curve_name: Option, + #[serde(rename = "keyOps", skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + #[serde(rename = "keySize", skip_serializing_if = "Option::is_none")] + pub key_size: Option, + #[serde(rename = "keyUri", skip_serializing)] + pub key_uri: Option, + #[serde(rename = "keyUriWithVersion", skip_serializing)] + pub key_uri_with_version: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + #[serde(rename = "rotationPolicy", skip_serializing_if = "Option::is_none")] + pub rotation_policy: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmKeyReleasePolicy { + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + #[serde(default, deserialize_with = "base64::option::deserialize_url_safe", serialize_with = "base64::option::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub data: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmKeyRotationPolicyAttributes { + #[serde(skip_serializing)] + pub created: Option, + #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + #[serde(skip_serializing)] + pub updated: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmLifetimeAction { + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub trigger: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ManagedHsmListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::ManagedHsmListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = ManagedHsm; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmProperties { + #[serde(rename = "createMode", skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[serde(rename = "enablePurgeProtection", skip_serializing_if = "Option::is_none")] + pub enable_purge_protection: Option, + #[serde(rename = "enableSoftDelete", skip_serializing_if = "Option::is_none")] + pub enable_soft_delete: Option, + #[serde(rename = "hsmUri", skip_serializing)] + pub hsm_uri: Option, + #[serde(rename = "initialAdminObjectIds", skip_serializing_if = "Option::is_none")] + pub initial_admin_object_ids: Option>, + #[serde(rename = "networkAcls", skip_serializing_if = "Option::is_none")] + pub network_acls: Option, + #[serde(rename = "privateEndpointConnections", skip_serializing)] + pub private_endpoint_connections: Option>, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + #[serde(rename = "publicNetworkAccess", skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub regions: Option>, + #[serde(default, rename = "scheduledPurgeDate", skip_serializing, with = "azure_core::time::rfc3339::option")] + pub scheduled_purge_date: Option, + #[serde(rename = "securityDomainProperties", skip_serializing)] + pub security_domain_properties: Option, + #[serde(rename = "softDeleteRetentionInDays", skip_serializing_if = "Option::is_none")] + pub soft_delete_retention_in_days: Option, + #[serde(rename = "statusMessage", skip_serializing)] + pub status_message: Option, + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmRotationPolicy { + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] + pub lifetime_actions: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmSku { + #[serde(skip_serializing_if = "Option::is_none")] + pub family: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedHsmTrigger { + #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] + pub time_after_create: Option, + #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] + pub time_before_expiry: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct ManagedServiceIdentity { + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, + #[serde(rename = "tenantId", skip_serializing)] + pub tenant_id: Option, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, + #[serde(rename = "userAssignedIdentities", skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct MetricSpecification { + #[serde(rename = "aggregationType", skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub dimensions: Option>, + #[serde(rename = "displayDescription", skip_serializing_if = "Option::is_none")] + pub display_description: Option, + #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "fillGapWithZero", skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + #[serde(rename = "internalMetricName", skip_serializing_if = "Option::is_none")] + pub internal_metric_name: Option, + #[serde(rename = "lockAggregationType", skip_serializing_if = "Option::is_none")] + pub lock_aggregation_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "supportedAggregationTypes", skip_serializing_if = "Option::is_none")] + pub supported_aggregation_types: Option>, + #[serde(rename = "supportedTimeGrainTypes", skip_serializing_if = "Option::is_none")] + pub supported_time_grain_types: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub unit: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct NetworkRuleSet { + #[serde(skip_serializing_if = "Option::is_none")] + pub bypass: Option, + #[serde(rename = "defaultAction", skip_serializing_if = "Option::is_none")] + pub default_action: Option, + #[serde(rename = "ipRules", skip_serializing_if = "Option::is_none")] + pub ip_rules: Option>, + #[serde(rename = "virtualNetworkRules", skip_serializing_if = "Option::is_none")] + pub virtual_network_rules: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct Operation { + #[serde(skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(rename = "isDataAction", skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "properties", skip_serializing_if = "Option::is_none")] + pub operation_properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub origin: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct OperationDisplay { + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub resource: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct OperationListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::OperationListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = Operation; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct OperationProperties { + #[serde(rename = "serviceSpecification", skip_serializing_if = "Option::is_none")] + pub service_specification: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct Permissions { + #[serde(skip_serializing_if = "Option::is_none")] + pub certificates: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub keys: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub secrets: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub storage: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct PrivateEndpoint { + #[serde(skip_serializing)] + pub id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct PrivateEndpointConnection { + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing)] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: PrivateEndpointConnection) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct PrivateEndpointConnectionItem { + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct PrivateEndpointConnectionListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::PrivateEndpointConnectionListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = PrivateEndpointConnection; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct PrivateLinkResource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing)] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct PrivateLinkResourceListResult { + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + #[serde(rename = "requiredMembers", skip_serializing)] + pub required_members: Option>, + #[serde(rename = "requiredZoneNames", skip_serializing_if = "Option::is_none")] + pub required_zone_names: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct PrivateLinkServiceConnectionState { + #[serde(rename = "actionsRequired", skip_serializing_if = "Option::is_none")] + pub actions_required: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ResourceListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::ResourceListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = TrackedResource; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct RotationPolicy { + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] + pub lifetime_actions: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct Secret { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing)] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct SecretAttributes { + #[serde(default, skip_serializing, with = "azure_core::time::unix_time::option")] + pub created: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(default, rename = "exp", skip_serializing_if = "Option::is_none", with = "azure_core::time::unix_time::option")] + pub expires: Option, + #[serde(default, rename = "nbf", skip_serializing_if = "Option::is_none", with = "azure_core::time::unix_time::option")] + pub not_before: Option, + #[serde(default, skip_serializing, with = "azure_core::time::unix_time::option")] + pub updated: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct SecretCreateOrUpdateParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: SecretCreateOrUpdateParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct SecretListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::SecretListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = Secret; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct SecretPatchParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: SecretPatchParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct SecretPatchProperties { + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct SecretProperties { + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + #[serde(rename = "secretUri", skip_serializing)] + pub secret_uri: Option, + #[serde(rename = "secretUriWithVersion", skip_serializing)] + pub secret_uri_with_version: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct ServiceSpecification { + #[serde(rename = "logSpecifications", skip_serializing_if = "Option::is_none")] + pub log_specifications: Option>, + #[serde(rename = "metricSpecifications", skip_serializing_if = "Option::is_none")] + pub metric_specifications: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct Sku { + #[serde(skip_serializing_if = "Option::is_none")] + pub family: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct SystemData { + #[serde(default, rename = "createdAt", skip_serializing_if = "Option::is_none", with = "azure_core::time::rfc3339::option")] + pub created_at: Option, + #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(default, rename = "lastModifiedAt", skip_serializing_if = "Option::is_none", with = "azure_core::time::rfc3339::option")] + pub last_modified_at: Option, + #[serde(rename = "lastModifiedBy", skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct TrackedResource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct Trigger { + #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] + pub time_after_create: Option, + #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] + pub time_before_expiry: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct UserAssignedIdentity { + #[serde(rename = "clientId", skip_serializing)] + pub client_id: Option, + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct Vault { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultAccessPolicyParameters { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub location: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: VaultAccessPolicyParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultAccessPolicyProperties { + #[serde(rename = "accessPolicies", skip_serializing_if = "Option::is_none")] + pub access_policies: Option>, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultCheckNameAvailabilityParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", serialize_with = "models_serde::serialize_string_literal_Microsoft_KeyVault_vaults")] + pub type_prop: Option, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: VaultCheckNameAvailabilityParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultCreateOrUpdateParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: VaultCreateOrUpdateParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + #[non_exhaustive] + pub struct VaultListResult { + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default)] + pub value: Vec, + } + #[async_trait] + impl Page for super::VaultListResult { + type IntoIter = as IntoIterator>::IntoIter; + type Item = Vault; + async fn into_items(self) -> Result<::IntoIter>; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultPatchParameters { + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + } + impl TryFrom for azure_core::http::RequestContent { + type Error = Error; + fn try_from(value: VaultPatchParameters) -> Result; + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultPatchProperties { + #[serde(rename = "accessPolicies", skip_serializing_if = "Option::is_none")] + pub access_policies: Option>, + #[serde(rename = "createMode", skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[serde(rename = "enablePurgeProtection", skip_serializing_if = "Option::is_none")] + pub enable_purge_protection: Option, + #[serde(rename = "enableRbacAuthorization", skip_serializing_if = "Option::is_none")] + pub enable_rbac_authorization: Option, + #[serde(rename = "enableSoftDelete", skip_serializing_if = "Option::is_none")] + pub enable_soft_delete: Option, + #[serde(rename = "enabledForDeployment", skip_serializing_if = "Option::is_none")] + pub enabled_for_deployment: Option, + #[serde(rename = "enabledForDiskEncryption", skip_serializing_if = "Option::is_none")] + pub enabled_for_disk_encryption: Option, + #[serde(rename = "enabledForTemplateDeployment", skip_serializing_if = "Option::is_none")] + pub enabled_for_template_deployment: Option, + #[serde(rename = "networkAcls", skip_serializing_if = "Option::is_none")] + pub network_acls: Option, + #[serde(rename = "publicNetworkAccess", skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "softDeleteRetentionInDays", skip_serializing_if = "Option::is_none")] + pub soft_delete_retention_in_days: Option, + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VaultProperties { + #[serde(rename = "accessPolicies", skip_serializing_if = "Option::is_none")] + pub access_policies: Option>, + #[serde(rename = "createMode", skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + #[serde(rename = "enablePurgeProtection", skip_serializing_if = "Option::is_none")] + pub enable_purge_protection: Option, + #[serde(rename = "enableRbacAuthorization", skip_serializing_if = "Option::is_none")] + pub enable_rbac_authorization: Option, + #[serde(rename = "enableSoftDelete", skip_serializing_if = "Option::is_none")] + pub enable_soft_delete: Option, + #[serde(rename = "enabledForDeployment", skip_serializing_if = "Option::is_none")] + pub enabled_for_deployment: Option, + #[serde(rename = "enabledForDiskEncryption", skip_serializing_if = "Option::is_none")] + pub enabled_for_disk_encryption: Option, + #[serde(rename = "enabledForTemplateDeployment", skip_serializing_if = "Option::is_none")] + pub enabled_for_template_deployment: Option, + #[serde(rename = "hsmPoolResourceId", skip_serializing)] + pub hsm_pool_resource_id: Option, + #[serde(rename = "networkAcls", skip_serializing_if = "Option::is_none")] + pub network_acls: Option, + #[serde(rename = "privateEndpointConnections", skip_serializing)] + pub private_endpoint_connections: Option>, + #[serde(rename = "provisioningState", skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "publicNetworkAccess", skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + #[serde(rename = "softDeleteRetentionInDays", skip_serializing_if = "Option::is_none")] + pub soft_delete_retention_in_days: Option, + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + #[serde(rename = "vaultUri", skip_serializing_if = "Option::is_none")] + pub vault_uri: Option, + } + #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] + pub struct VirtualNetworkRule { + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "ignoreMissingVnetServiceEndpoint", skip_serializing_if = "Option::is_none")] + pub ignore_missing_vnet_service_endpoint: Option, + } + #[derive(Clone, Copy, Debug, Eq, PartialEq)] + pub enum AccessPolicyUpdateKind { + Add, + Remove, + Replace, + } + impl AsRef for super::AccessPolicyUpdateKind { + fn as_ref(&self) -> &str; + } + impl Display for super::AccessPolicyUpdateKind { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::AccessPolicyUpdateKind { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::AccessPolicyUpdateKind { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'de> Deserialize<'de> for super::AccessPolicyUpdateKind { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ActionsRequired { + None, + UnknownValue(String), + } + impl AsRef for super::ActionsRequired { + fn as_ref(&self) -> &str; + } + impl Display for super::ActionsRequired { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ActionsRequired { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ActionsRequired { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ActionsRequired> for &'a str { + fn from(e: &'a ActionsRequired) -> Self; + } + impl<'de> Deserialize<'de> for super::ActionsRequired { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ActivationStatus { + Active, + Failed, + NotActivated, + Unknown, + UnknownValue(String), + } + impl AsRef for super::ActivationStatus { + fn as_ref(&self) -> &str; + } + impl Display for super::ActivationStatus { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ActivationStatus { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ActivationStatus { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ActivationStatus> for &'a str { + fn from(e: &'a ActivationStatus) -> Self; + } + impl<'de> Deserialize<'de> for super::ActivationStatus { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum CertificatePermissions { + All, + Backup, + Create, + Delete, + Deleteissuers, + Get, + Getissuers, + Import, + List, + Listissuers, + Managecontacts, + Manageissuers, + Purge, + Recover, + Restore, + Setissuers, + Update, + UnknownValue(String), + } + impl AsRef for super::CertificatePermissions { + fn as_ref(&self) -> &str; + } + impl Display for super::CertificatePermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::CertificatePermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::CertificatePermissions { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a CertificatePermissions> for &'a str { + fn from(e: &'a CertificatePermissions) -> Self; + } + impl<'de> Deserialize<'de> for super::CertificatePermissions { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Copy, Debug, Eq, PartialEq)] + pub enum CreateMode { + Default, + Recover, + } + impl AsRef for super::CreateMode { + fn as_ref(&self) -> &str; + } + impl Display for super::CreateMode { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::CreateMode { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::CreateMode { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'de> Deserialize<'de> for super::CreateMode { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum CreatedByType { + Application, + Key, + ManagedIdentity, + User, + UnknownValue(String), + } + impl AsRef for super::CreatedByType { + fn as_ref(&self) -> &str; + } + impl Display for super::CreatedByType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::CreatedByType { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::CreatedByType { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a CreatedByType> for &'a str { + fn from(e: &'a CreatedByType) -> Self; + } + impl<'de> Deserialize<'de> for super::CreatedByType { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum DeletionRecoveryLevel { + Purgeable, + Recoverable, + RecoverableProtectedSubscription, + RecoverablePurgeable, + UnknownValue(String), + } + impl AsRef for super::DeletionRecoveryLevel { + fn as_ref(&self) -> &str; + } + impl Display for super::DeletionRecoveryLevel { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::DeletionRecoveryLevel { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::DeletionRecoveryLevel { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a DeletionRecoveryLevel> for &'a str { + fn from(e: &'a DeletionRecoveryLevel) -> Self; + } + impl<'de> Deserialize<'de> for super::DeletionRecoveryLevel { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum GeoReplicationRegionProvisioningState { + Cleanup, + Deleting, + Failed, + Preprovisioning, + Provisioning, + Succeeded, + UnknownValue(String), + } + impl AsRef for super::GeoReplicationRegionProvisioningState { + fn as_ref(&self) -> &str; + } + impl Display for super::GeoReplicationRegionProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::GeoReplicationRegionProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::GeoReplicationRegionProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a GeoReplicationRegionProvisioningState> for &'a str { + fn from(e: &'a GeoReplicationRegionProvisioningState) -> Self; + } + impl<'de> Deserialize<'de> for super::GeoReplicationRegionProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum JsonWebKeyCurveName { + P256, + P256K, + P384, + P521, + UnknownValue(String), + } + impl AsRef for super::JsonWebKeyCurveName { + fn as_ref(&self) -> &str; + } + impl Display for super::JsonWebKeyCurveName { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::JsonWebKeyCurveName { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::JsonWebKeyCurveName { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a JsonWebKeyCurveName> for &'a str { + fn from(e: &'a JsonWebKeyCurveName) -> Self; + } + impl<'de> Deserialize<'de> for super::JsonWebKeyCurveName { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum JsonWebKeyOperation { + Decrypt, + Encrypt, + Import, + Release, + Sign, + UnwrapKey, + Verify, + WrapKey, + UnknownValue(String), + } + impl AsRef for super::JsonWebKeyOperation { + fn as_ref(&self) -> &str; + } + impl Display for super::JsonWebKeyOperation { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::JsonWebKeyOperation { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::JsonWebKeyOperation { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a JsonWebKeyOperation> for &'a str { + fn from(e: &'a JsonWebKeyOperation) -> Self; + } + impl<'de> Deserialize<'de> for super::JsonWebKeyOperation { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum JsonWebKeyType { + Ec, + EcHsm, + OctHsm, + Rsa, + RsaHsm, + UnknownValue(String), + } + impl AsRef for super::JsonWebKeyType { + fn as_ref(&self) -> &str; + } + impl Display for super::JsonWebKeyType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::JsonWebKeyType { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::JsonWebKeyType { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a JsonWebKeyType> for &'a str { + fn from(e: &'a JsonWebKeyType) -> Self; + } + impl<'de> Deserialize<'de> for super::JsonWebKeyType { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum KeyPermissions { + All, + Backup, + Create, + Decrypt, + Delete, + Encrypt, + Get, + Getrotationpolicy, + Import, + List, + Purge, + Recover, + Release, + Restore, + Rotate, + Setrotationpolicy, + Sign, + UnwrapKey, + Update, + Verify, + WrapKey, + UnknownValue(String), + } + impl AsRef for super::KeyPermissions { + fn as_ref(&self) -> &str; + } + impl Display for super::KeyPermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::KeyPermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::KeyPermissions { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a KeyPermissions> for &'a str { + fn from(e: &'a KeyPermissions) -> Self; + } + impl<'de> Deserialize<'de> for super::KeyPermissions { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Copy, Debug, Eq, PartialEq)] + pub enum KeyRotationPolicyActionType { + Notify, + Rotate, + } + impl AsRef for super::KeyRotationPolicyActionType { + fn as_ref(&self) -> &str; + } + impl Display for super::KeyRotationPolicyActionType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::KeyRotationPolicyActionType { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::KeyRotationPolicyActionType { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'de> Deserialize<'de> for super::KeyRotationPolicyActionType { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ManagedHsmSkuFamily { + B, + C, + UnknownValue(String), + } + impl AsRef for super::ManagedHsmSkuFamily { + fn as_ref(&self) -> &str; + } + impl Display for super::ManagedHsmSkuFamily { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ManagedHsmSkuFamily { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ManagedHsmSkuFamily { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ManagedHsmSkuFamily> for &'a str { + fn from(e: &'a ManagedHsmSkuFamily) -> Self; + } + impl<'de> Deserialize<'de> for super::ManagedHsmSkuFamily { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ManagedHsmSkuNameV2 { + CustomB32, + CustomB6, + CustomC10, + CustomC42, + StandardB1, + StandardB10V2, + StandardB15V2, + StandardB1V2, + StandardB20V2, + StandardB5V2, + UnknownValue(String), + } + impl AsRef for super::ManagedHsmSkuNameV2 { + fn as_ref(&self) -> &str; + } + impl Display for super::ManagedHsmSkuNameV2 { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ManagedHsmSkuNameV2 { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ManagedHsmSkuNameV2 { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ManagedHsmSkuNameV2> for &'a str { + fn from(e: &'a ManagedHsmSkuNameV2) -> Self; + } + impl<'de> Deserialize<'de> for super::ManagedHsmSkuNameV2 { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ManagedServiceIdentityType { + None, + SystemAssigned, + SystemAssignedUserAssigned, + UserAssigned, + UnknownValue(String), + } + impl AsRef for super::ManagedServiceIdentityType { + fn as_ref(&self) -> &str; + } + impl Display for super::ManagedServiceIdentityType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ManagedServiceIdentityType { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ManagedServiceIdentityType { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ManagedServiceIdentityType> for &'a str { + fn from(e: &'a ManagedServiceIdentityType) -> Self; + } + impl<'de> Deserialize<'de> for super::ManagedServiceIdentityType { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum NetworkRuleAction { + Allow, + Deny, + UnknownValue(String), + } + impl AsRef for super::NetworkRuleAction { + fn as_ref(&self) -> &str; + } + impl Display for super::NetworkRuleAction { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::NetworkRuleAction { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::NetworkRuleAction { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a NetworkRuleAction> for &'a str { + fn from(e: &'a NetworkRuleAction) -> Self; + } + impl<'de> Deserialize<'de> for super::NetworkRuleAction { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum NetworkRuleBypassOptions { + AzureServices, + None, + UnknownValue(String), + } + impl AsRef for super::NetworkRuleBypassOptions { + fn as_ref(&self) -> &str; + } + impl Display for super::NetworkRuleBypassOptions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::NetworkRuleBypassOptions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::NetworkRuleBypassOptions { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a NetworkRuleBypassOptions> for &'a str { + fn from(e: &'a NetworkRuleBypassOptions) -> Self; + } + impl<'de> Deserialize<'de> for super::NetworkRuleBypassOptions { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum PrivateEndpointConnectionProvisioningState { + Creating, + Deleting, + Disconnected, + Failed, + Succeeded, + Updating, + UnknownValue(String), + } + impl AsRef for super::PrivateEndpointConnectionProvisioningState { + fn as_ref(&self) -> &str; + } + impl Display for super::PrivateEndpointConnectionProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::PrivateEndpointConnectionProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::PrivateEndpointConnectionProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a PrivateEndpointConnectionProvisioningState> for &'a str { + fn from(e: &'a PrivateEndpointConnectionProvisioningState) -> Self; + } + impl<'de> Deserialize<'de> for super::PrivateEndpointConnectionProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum PrivateEndpointServiceConnectionStatus { + Approved, + Disconnected, + Pending, + Rejected, + UnknownValue(String), + } + impl AsRef for super::PrivateEndpointServiceConnectionStatus { + fn as_ref(&self) -> &str; + } + impl Display for super::PrivateEndpointServiceConnectionStatus { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::PrivateEndpointServiceConnectionStatus { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::PrivateEndpointServiceConnectionStatus { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a PrivateEndpointServiceConnectionStatus> for &'a str { + fn from(e: &'a PrivateEndpointServiceConnectionStatus) -> Self; + } + impl<'de> Deserialize<'de> for super::PrivateEndpointServiceConnectionStatus { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ProvisioningState { + Activated, + Deleting, + Failed, + Provisioning, + Restoring, + SecurityDomainRestore, + Succeeded, + Updating, + UnknownValue(String), + } + impl AsRef for super::ProvisioningState { + fn as_ref(&self) -> &str; + } + impl Display for super::ProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ProvisioningState> for &'a str { + fn from(e: &'a ProvisioningState) -> Self; + } + impl<'de> Deserialize<'de> for super::ProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum PublicNetworkAccess { + Disabled, + Enabled, + UnknownValue(String), + } + impl AsRef for super::PublicNetworkAccess { + fn as_ref(&self) -> &str; + } + impl Display for super::PublicNetworkAccess { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::PublicNetworkAccess { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::PublicNetworkAccess { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a PublicNetworkAccess> for &'a str { + fn from(e: &'a PublicNetworkAccess) -> Self; + } + impl<'de> Deserialize<'de> for super::PublicNetworkAccess { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum Reason { + AccountNameInvalid, + AlreadyExists, + UnknownValue(String), + } + impl AsRef for super::Reason { + fn as_ref(&self) -> &str; + } + impl Display for super::Reason { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::Reason { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::Reason { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a Reason> for &'a str { + fn from(e: &'a Reason) -> Self; + } + impl<'de> Deserialize<'de> for super::Reason { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum ResourceProvisioningState { + Canceled, + Failed, + Succeeded, + UnknownValue(String), + } + impl AsRef for super::ResourceProvisioningState { + fn as_ref(&self) -> &str; + } + impl Display for super::ResourceProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::ResourceProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::ResourceProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a ResourceProvisioningState> for &'a str { + fn from(e: &'a ResourceProvisioningState) -> Self; + } + impl<'de> Deserialize<'de> for super::ResourceProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum SecretPermissions { + All, + Backup, + Delete, + Get, + List, + Purge, + Recover, + Restore, + Set, + UnknownValue(String), + } + impl AsRef for super::SecretPermissions { + fn as_ref(&self) -> &str; + } + impl Display for super::SecretPermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::SecretPermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::SecretPermissions { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a SecretPermissions> for &'a str { + fn from(e: &'a SecretPermissions) -> Self; + } + impl<'de> Deserialize<'de> for super::SecretPermissions { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum SkuFamily { + A, + UnknownValue(String), + } + impl AsRef for super::SkuFamily { + fn as_ref(&self) -> &str; + } + impl Display for super::SkuFamily { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::SkuFamily { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::SkuFamily { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a SkuFamily> for &'a str { + fn from(e: &'a SkuFamily) -> Self; + } + impl<'de> Deserialize<'de> for super::SkuFamily { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Copy, Debug, Eq, PartialEq)] + pub enum SkuName { + Premium, + Standard, + } + impl AsRef for super::SkuName { + fn as_ref(&self) -> &str; + } + impl Display for super::SkuName { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::SkuName { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::SkuName { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'de> Deserialize<'de> for super::SkuName { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum StoragePermissions { + All, + Backup, + Delete, + Deletesas, + Get, + Getsas, + List, + Listsas, + Purge, + Recover, + Regeneratekey, + Restore, + Set, + Setsas, + Update, + UnknownValue(String), + } + impl AsRef for super::StoragePermissions { + fn as_ref(&self) -> &str; + } + impl Display for super::StoragePermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::StoragePermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::StoragePermissions { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a StoragePermissions> for &'a str { + fn from(e: &'a StoragePermissions) -> Self; + } + impl<'de> Deserialize<'de> for super::StoragePermissions { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + #[derive(Clone, Debug, Eq, PartialEq)] + pub enum VaultProvisioningState { + RegisteringDns, + Succeeded, + UnknownValue(String), + } + impl AsRef for super::VaultProvisioningState { + fn as_ref(&self) -> &str; + } + impl Display for super::VaultProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result; + } + impl FromStr for super::VaultProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err>; + } + impl Serialize for super::VaultProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result<::Ok, ::Error> where S: Serializer; + } + impl<'a> From<&'a VaultProvisioningState> for &'a str { + fn from(e: &'a VaultProvisioningState) -> Self; + } + impl<'de> Deserialize<'de> for super::VaultProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result::Error> where D: Deserializer<'de>; + } + pub trait KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait MHSMPrivateEndpointConnectionHeaders: private::Sealed { + fn azure_async_operation(&self) -> Result>; + fn retry_after(&self) -> Result>; + } + pub trait PrivateEndpointConnectionHeaders: private::Sealed { + fn azure_async_operation(&self) -> Result>; + fn retry_after(&self) -> Result>; + } +} +``` diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_client.rs new file mode 100644 index 0000000000..bb41f8d605 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_client.rs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::clients::{ + KeyVaultKeysClient, KeyVaultMHSMPrivateEndpointConnectionsClient, + KeyVaultMHSMPrivateLinkResourcesClient, KeyVaultMHSMRegionsClient, + KeyVaultManagedHsmKeysClient, KeyVaultManagedHsmsClient, KeyVaultOperationsClient, + KeyVaultPrivateEndpointConnectionsClient, KeyVaultPrivateLinkResourcesClient, + KeyVaultSecretsClient, KeyVaultVaultsClient, +}; +use azure_core::{ + cloud::resource_manager::CloudConfigurationExt as _, + credentials::TokenCredential, + error::ErrorKind, + fmt::SafeDebug, + http::{ + policies::{auth::BearerTokenAuthorizationPolicy, Policy}, + ClientOptions, Pipeline, Url, + }, + tracing, Error, Result, +}; +use std::sync::Arc; + +/// The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. +#[tracing::client] +pub struct KeyVaultClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +/// Options used when creating a [`KeyVaultClient`](KeyVaultClient) +#[derive(Clone, SafeDebug)] +pub struct KeyVaultClientOptions { + /// The API version to use for this operation. + pub api_version: String, + /// Allows customization of the client. + pub client_options: ClientOptions, +} + +impl KeyVaultClient { + /// Creates a new KeyVaultClient, using Entra ID authentication. + /// + /// # Arguments + /// + /// * `subscription_id` - The ID of the target subscription. The value must be an UUID. + /// * `credential` - An implementation of [`TokenCredential`](azure_core::credentials::TokenCredential) that can provide an + /// Entra ID token to use when authenticating. + /// * `options` - Optional configuration for the client. + /// + /// Public cloud is used when no cloud configuration is supplied. For a custom cloud, + /// set [`CustomConfiguration::endpoint`](azure_core::cloud::CustomConfiguration::endpoint) + /// and register its authentication audience using the shared + /// [`Audience`](azure_core::cloud::resource_manager::Audience) marker. + /// Configure the credential's cloud separately to use its identity authority. + /// + /// # Errors + /// + /// Returns an error if a custom cloud has no endpoint or Resource Manager audience, + /// or if its endpoint URL is invalid. + #[tracing::new("Microsoft.KeyVault")] + pub fn new( + subscription_id: String, + credential: Arc, + options: Option, + ) -> Result { + let options = options.unwrap_or_default(); + let cloud = options.client_options.cloud.as_deref().unwrap_or_default(); + let endpoint = cloud + .endpoint() + .ok_or_else(|| Error::new(ErrorKind::Other, "missing Resource Manager endpoint"))?; + let endpoint = Url::parse(endpoint)?; + let scope = cloud.default_scope()?.into_owned(); + let auth_policy: Arc = + Arc::new(BearerTokenAuthorizationPolicy::new(credential, vec![scope])); + Ok(Self { + endpoint, + subscription_id, + api_version: options.api_version, + pipeline: Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + options.client_options, + Vec::default(), + vec![auth_policy], + None, + ), + }) + } + + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Returns a new instance of KeyVaultKeysClient. + #[tracing::subclient] + pub fn get_key_vault_keys_client(&self) -> KeyVaultKeysClient { + KeyVaultKeysClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultManagedHsmKeysClient. + #[tracing::subclient] + pub fn get_key_vault_managed_hsm_keys_client(&self) -> KeyVaultManagedHsmKeysClient { + KeyVaultManagedHsmKeysClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultManagedHsmsClient. + #[tracing::subclient] + pub fn get_key_vault_managed_hsms_client(&self) -> KeyVaultManagedHsmsClient { + KeyVaultManagedHsmsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultMHSMPrivateEndpointConnectionsClient. + #[tracing::subclient] + pub fn get_key_vault_mhsm_private_endpoint_connections_client( + &self, + ) -> KeyVaultMHSMPrivateEndpointConnectionsClient { + KeyVaultMHSMPrivateEndpointConnectionsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultMHSMPrivateLinkResourcesClient. + #[tracing::subclient] + pub fn get_key_vault_mhsm_private_link_resources_client( + &self, + ) -> KeyVaultMHSMPrivateLinkResourcesClient { + KeyVaultMHSMPrivateLinkResourcesClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultMHSMRegionsClient. + #[tracing::subclient] + pub fn get_key_vault_mhsm_regions_client(&self) -> KeyVaultMHSMRegionsClient { + KeyVaultMHSMRegionsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultOperationsClient. + #[tracing::subclient] + pub fn get_key_vault_operations_client(&self) -> KeyVaultOperationsClient { + KeyVaultOperationsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + } + } + + /// Returns a new instance of KeyVaultPrivateEndpointConnectionsClient. + #[tracing::subclient] + pub fn get_key_vault_private_endpoint_connections_client( + &self, + ) -> KeyVaultPrivateEndpointConnectionsClient { + KeyVaultPrivateEndpointConnectionsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultPrivateLinkResourcesClient. + #[tracing::subclient] + pub fn get_key_vault_private_link_resources_client( + &self, + ) -> KeyVaultPrivateLinkResourcesClient { + KeyVaultPrivateLinkResourcesClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultSecretsClient. + #[tracing::subclient] + pub fn get_key_vault_secrets_client(&self) -> KeyVaultSecretsClient { + KeyVaultSecretsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } + + /// Returns a new instance of KeyVaultVaultsClient. + #[tracing::subclient] + pub fn get_key_vault_vaults_client(&self) -> KeyVaultVaultsClient { + KeyVaultVaultsClient { + api_version: self.api_version.clone(), + endpoint: self.endpoint.clone(), + pipeline: self.pipeline.clone(), + subscription_id: self.subscription_id.clone(), + } + } +} + +/// Default value for [`KeyVaultClientOptions::api_version`]. +pub(crate) const DEFAULT_API_VERSION: &str = "2026-05-15"; + +impl Default for KeyVaultClientOptions { + fn default() -> Self { + Self { + api_version: String::from(DEFAULT_API_VERSION), + client_options: ClientOptions::default(), + } + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_keys_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_keys_client.rs new file mode 100644 index 0000000000..859ebdb912 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_keys_client.rs @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + Key, KeyCreateParameters, KeyListResult, KeyVaultKeysClientCreateIfNotExistOptions, + KeyVaultKeysClientGetOptions, KeyVaultKeysClientGetVersionOptions, + KeyVaultKeysClientListOptions, KeyVaultKeysClientListVersionsOptions, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + Method, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, RequestContent, + Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultKeysClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultKeysClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without + /// any write operations being performed. This API does not create subsequent versions, and does not update existing keys. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault which contains the key to be retrieved. + /// * `key_name` - The name of the key to be retrieved. + /// * `parameters` - The parameters used to create the specified key. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Keys.createIfNotExist")] + pub async fn create_if_not_exist( + &self, + resource_group_name: &str, + vault_name: &str, + key_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}"); + path = path.replace("{keyName}", key_name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the current version of the specified key from the specified key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault which contains the key to be retrieved. + /// * `key_name` - The name of the key to be retrieved. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Keys.get")] + pub async fn get( + &self, + resource_group_name: &str, + vault_name: &str, + key_name: &str, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}"); + path = path.replace("{keyName}", key_name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the specified version of the specified key in the specified key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault which contains the key version to be retrieved. + /// * `key_name` - The name of the key version to be retrieved. + /// * `key_version` - The version of the key to be retrieved. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.KeyOperationGroup.getVersion")] + pub async fn get_version( + &self, + resource_group_name: &str, + vault_name: &str, + key_name: &str, + key_version: &str, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if key_version.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_version cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}"); + path = path.replace("{keyName}", key_name); + path = path.replace("{keyVersion}", key_version); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Lists the keys in the specified key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault which contains the key to be retrieved. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Keys.list")] + pub fn list( + &self, + resource_group_name: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultKeysClientListPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultKeysClientListPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Lists the keys in the specified key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault which contains the key version to be retrieved. + /// * `key_name` - The name of the key version to be retrieved. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.KeyOperationGroup.listVersions")] + pub fn list_versions( + &self, + resource_group_name: &str, + vault_name: &str, + key_name: &str, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions"); + path = path.replace("{keyName}", key_name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultKeysClientListVersionsPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultKeysClientListVersionsPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsm_keys_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsm_keys_client.rs new file mode 100644 index 0000000000..b42166da5b --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsm_keys_client.rs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultManagedHsmKeysClientCreateIfNotExistOptions, KeyVaultManagedHsmKeysClientGetOptions, + KeyVaultManagedHsmKeysClientGetVersionOptions, KeyVaultManagedHsmKeysClientListOptions, + KeyVaultManagedHsmKeysClientListVersionsOptions, ManagedHsmKey, ManagedHsmKeyCreateParameters, + ManagedHsmKeyListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + Method, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, RequestContent, + Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultManagedHsmKeysClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultManagedHsmKeysClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without + /// any write operations being performed. This API does not create subsequent versions, and does not update existing keys. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the Managed HSM Pool within the specified resource group. + /// * `key_name` - The name of the key to be created. The value you provide may be copied globally for the purpose of running + /// the service. The value provided should not include personally identifiable or sensitive information. + /// * `parameters` - The parameters used to create the specified key. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmKeys.createIfNotExist")] + pub async fn create_if_not_exist( + &self, + resource_group_name: &str, + name: &str, + key_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}"); + path = path.replace("{keyName}", key_name); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the current version of the specified key from the specified managed HSM. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the Managed HSM Pool within the specified resource group. + /// * `key_name` - The name of the key to be created. The value you provide may be copied globally for the purpose of running + /// the service. The value provided should not include personally identifiable or sensitive information. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmKeys.get")] + pub async fn get( + &self, + resource_group_name: &str, + name: &str, + key_name: &str, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}"); + path = path.replace("{keyName}", key_name); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the specified version of the specified key in the specified managed HSM. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the Managed HSM Pool within the specified resource group. + /// * `key_name` - The name of the key to be created. The value you provide may be copied globally for the purpose of running + /// the service. The value provided should not include personally identifiable or sensitive information. + /// * `key_version` - The version of the key to be retrieved. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmKeyOperationGroup.getVersion")] + pub async fn get_version( + &self, + resource_group_name: &str, + name: &str, + key_name: &str, + key_version: &str, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if key_version.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_version cannot be empty", + )); + } + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}"); + path = path.replace("{keyName}", key_name); + path = path.replace("{keyVersion}", key_version); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Lists the keys in the specified managed HSM. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the Managed HSM Pool within the specified resource group. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmKeys.list")] + pub fn list( + &self, + resource_group_name: &str, + name: &str, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultManagedHsmKeysClientListPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultManagedHsmKeysClientListPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Lists the keys in the specified managed HSM. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the Managed HSM Pool within the specified resource group. + /// * `key_name` - The name of the key to be created. The value you provide may be copied globally for the purpose of running + /// the service. The value provided should not include personally identifiable or sensitive information. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmKeyOperationGroup.listVersions")] + pub fn list_versions( + &self, + resource_group_name: &str, + name: &str, + key_name: &str, + options: Option>, + ) -> Result> { + if key_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter key_name cannot be empty", + )); + } + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions"); + path = path.replace("{keyName}", key_name); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultManagedHsmKeysClientListVersionsPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultManagedHsmKeysClientListVersionsPage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsms_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsms_client.rs new file mode 100644 index 0000000000..c4b7d8a0d0 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsms_client.rs @@ -0,0 +1,698 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + CheckMhsmNameAvailabilityParameters, CheckMhsmNameAvailabilityResult, DeletedManagedHsm, + DeletedManagedHsmListResult, KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions, + KeyVaultManagedHsmsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginDeleteOptions, + KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientBeginPurgeDeletedOptions, + KeyVaultManagedHsmsClientBeginUpdateOperationStatus, + KeyVaultManagedHsmsClientBeginUpdateOptions, + KeyVaultManagedHsmsClientCheckMhsmNameAvailabilityOptions, + KeyVaultManagedHsmsClientGetDeletedOptions, KeyVaultManagedHsmsClientGetOptions, + KeyVaultManagedHsmsClientListByResourceGroupOptions, + KeyVaultManagedHsmsClientListBySubscriptionOptions, + KeyVaultManagedHsmsClientListDeletedOptions, ManagedHsm, ManagedHsmListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + poller::resource_manager::{new_poller, FinalStateVia}, + Method, Pager, Pipeline, PipelineSendOptions, Poller, RawResponse, Request, RequestContent, + Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultManagedHsmsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultManagedHsmsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `parameters` - Parameters to create or update the managed HSM Pool + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus, KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.ManagedHsms.createOrUpdate")] + pub fn begin_create_or_update( + &self, + resource_group_name: &str, + name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + Ok(new_poller( + pipeline, + request, + Some(FinalStateVia::Location), + Some(options.method_options), + )) + } + + /// Deletes the specified managed HSM Pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginDeleteOperationStatus, KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.ManagedHsms.delete")] + pub fn begin_delete( + &self, + resource_group_name: &str, + name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let request = Request::new(url, Method::Delete); + Ok(new_poller( + pipeline, + request, + None, + Some(options.method_options), + )) + } + + /// Permanently deletes the specified managed HSM. + /// + /// # Arguments + /// + /// * `location` - The name of the Azure region. + /// * `name` - The name of the deleted managed HSM. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus, KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted")] + pub fn begin_purge_deleted( + &self, + location: &str, + name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge"); + path = path.replace("{location}", location); + path = path.replace("{name}", name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let request = Request::new(url, Method::Post); + Ok(new_poller( + pipeline, + request, + None, + Some(options.method_options), + )) + } + + /// Update a managed HSM Pool in the specified subscription. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `parameters` - Parameters to patch the managed HSM Pool + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginUpdateOperationStatus, KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.ManagedHsms.update")] + pub fn begin_update( + &self, + resource_group_name: &str, + name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Patch); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + Ok(new_poller( + pipeline, + request, + Some(FinalStateVia::Location), + Some(options.method_options), + )) + } + + /// Checks that the managed hsm name is valid and is not already in use. + /// + /// # Arguments + /// + /// * `mhsm_name` - The request body + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability")] + pub async fn check_mhsm_name_availability( + &self, + mhsm_name: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability"); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(mhsm_name); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the specified managed HSM Pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsms.get")] + pub async fn get( + &self, + resource_group_name: &str, + name: &str, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 204], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the specified deleted managed HSM. + /// + /// # Arguments + /// + /// * `location` - The name of the Azure region. + /// * `name` - The name of the deleted managed HSM. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.DeletedManagedHsms.getDeleted")] + pub async fn get_deleted( + &self, + location: &str, + name: &str, + options: Option>, + ) -> Result> { + if location.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter location cannot be empty", + )); + } + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}"); + path = path.replace("{location}", location); + path = path.replace("{name}", name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified + /// resource group. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsms.listByResourceGroup")] + pub fn list_by_resource_group( + &self, + resource_group_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + if let Some(top) = options.top { + query_builder.set_pair("$top", top.to_string()); + } + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultManagedHsmsClientListByResourceGroupPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultManagedHsmsClientListByResourceGroupPage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// The List operation gets information about the managed HSM Pools associated with the subscription. + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsms.listBySubscription")] + pub fn list_by_subscription( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from( + "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs", + ); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + if let Some(top) = options.top { + query_builder.set_pair("$top", top.to_string()); + } + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultManagedHsmsClientListBySubscriptionPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultManagedHsmsClientListBySubscriptionPage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// The List operation gets information about the deleted managed HSMs associated with the subscription. + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted")] + pub fn list_deleted( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from( + "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs", + ); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultManagedHsmsClientListDeletedPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultManagedHsmsClientListDeletedPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_endpoint_connections_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_endpoint_connections_client.rs new file mode 100644 index 0000000000..970a4567fb --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_endpoint_connections_client.rs @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions, + KeyVaultMHSMPrivateEndpointConnectionsClientGetOptions, + KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions, + KeyVaultMHSMPrivateEndpointConnectionsClientPutOptions, MHSMPrivateEndpointConnection, + MHSMPrivateEndpointConnectionsListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + poller::resource_manager::{new_poller, FinalStateVia}, + Method, Pager, Pipeline, PipelineSendOptions, Poller, RawResponse, Request, RequestContent, + Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultMHSMPrivateEndpointConnectionsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Deletes the specified private endpoint connection associated with the managed hsm pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `private_endpoint_connection_name` - Name of the private endpoint connection associated with the managed hsm pool. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus, KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders`]: crate::generated::models::KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete")] + pub fn begin_delete( + &self, + resource_group_name: &str, + name: &str, + private_endpoint_connection_name: &str, + options: Option>, + ) -> Result> + { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"); + path = path.replace("{name}", name); + path = path.replace( + "{privateEndpointConnectionName}", + private_endpoint_connection_name, + ); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + Ok(new_poller( + pipeline, + request, + Some(FinalStateVia::Location), + Some(options.method_options), + )) + } + + /// Gets the specified private endpoint connection associated with the managed HSM Pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `private_endpoint_connection_name` - Name of the private endpoint connection associated with the managed hsm pool. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.MhsmPrivateEndpointConnections.get")] + pub async fn get( + &self, + resource_group_name: &str, + name: &str, + private_endpoint_connection_name: &str, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if private_endpoint_connection_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter private_endpoint_connection_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"); + path = path.replace("{name}", name); + path = path.replace( + "{privateEndpointConnectionName}", + private_endpoint_connection_name, + ); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource")] + pub fn list_by_resource( + &self, + resource_group_name: &str, + name: &str, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultMHSMPrivateEndpointConnectionsClientListByResourcePage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultMHSMPrivateEndpointConnectionsClientListByResourcePage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Updates the specified private endpoint connection associated with the managed hsm pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `private_endpoint_connection_name` - Name of the private endpoint connection associated with the managed hsm pool. + /// * `properties` - The intended state of private endpoint connection. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`MHSMPrivateEndpointConnectionHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{MHSMPrivateEndpointConnection, MHSMPrivateEndpointConnectionHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(azure_async_operation) = response.azure_async_operation()? { + /// println!("azure-asyncoperation: {:?}", azure_async_operation); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`azure_async_operation`()](crate::generated::models::MHSMPrivateEndpointConnectionHeaders::azure_async_operation) - azure-asyncoperation + /// * [`retry_after`()](crate::generated::models::MHSMPrivateEndpointConnectionHeaders::retry_after) - retry-after + /// + /// [`MHSMPrivateEndpointConnectionHeaders`]: crate::generated::models::MHSMPrivateEndpointConnectionHeaders + #[tracing::function("Microsoft.KeyVault.MhsmPrivateEndpointConnections.put")] + pub async fn put( + &self, + resource_group_name: &str, + name: &str, + private_endpoint_connection_name: &str, + properties: RequestContent, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if private_endpoint_connection_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter private_endpoint_connection_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"); + path = path.replace("{name}", name); + path = path.replace( + "{privateEndpointConnectionName}", + private_endpoint_connection_name, + ); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(properties); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_link_resources_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_link_resources_client.rs new file mode 100644 index 0000000000..9fd89212d1 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_link_resources_client.rs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultMHSMPrivateLinkResourcesClientListByMhsmResourceOptions, + MHSMPrivateLinkResourceListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{Method, Pipeline, PipelineSendOptions, Request, Response, Url, UrlExt}, + tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultMHSMPrivateLinkResourcesClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultMHSMPrivateLinkResourcesClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Gets the private link resources supported for the managed hsm pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsms.listByMHSMResource")] + pub async fn list_by_mhsm_resource( + &self, + resource_group_name: &str, + name: &str, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_regions_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_regions_client.rs new file mode 100644 index 0000000000..28717b3dac --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_regions_client.rs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultMHSMRegionsClientListByResourceOptions, MHSMRegionsListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + Method, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultMHSMRegionsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultMHSMRegionsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// The List operation gets information about the regions associated with the managed HSM Pool. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `name` - The name of the managed HSM Pool. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.ManagedHsms.listByResource")] + pub fn list_by_resource( + &self, + resource_group_name: &str, + name: &str, + options: Option>, + ) -> Result> { + if name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions"); + path = path.replace("{name}", name); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultMHSMRegionsClientListByResourcePage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultMHSMRegionsClientListByResourcePage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_operations_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_operations_client.rs new file mode 100644 index 0000000000..2a57b2649f --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_operations_client.rs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{KeyVaultOperationsClientListOptions, OperationListResult}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + Method, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultOperationsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, +} + +impl KeyVaultOperationsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// List the operations for the provider + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + #[tracing::function("Azure.ResourceManager.Legacy.Operations.list")] + pub fn list( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + first_url.append_path("/providers/Microsoft.KeyVault/operations"); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultOperationsClientListPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultOperationsClientListPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_endpoint_connections_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_endpoint_connections_client.rs new file mode 100644 index 0000000000..05ccd9054c --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_endpoint_connections_client.rs @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions, + KeyVaultPrivateEndpointConnectionsClientGetOptions, + KeyVaultPrivateEndpointConnectionsClientListByResourceOptions, + KeyVaultPrivateEndpointConnectionsClientPutOptions, PrivateEndpointConnection, + PrivateEndpointConnectionListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + poller::resource_manager::{new_poller, FinalStateVia}, + Method, Pager, Pipeline, PipelineSendOptions, Poller, RawResponse, Request, RequestContent, + Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultPrivateEndpointConnectionsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultPrivateEndpointConnectionsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Deletes the specified private endpoint connection associated with the key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `private_endpoint_connection_name` - Name of the private endpoint connection associated with the key vault. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus, KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders`]: crate::generated::models::KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.PrivateEndpointConnections.delete")] + pub fn begin_delete( + &self, + resource_group_name: &str, + vault_name: &str, + private_endpoint_connection_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"); + path = path.replace( + "{privateEndpointConnectionName}", + private_endpoint_connection_name, + ); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + Ok(new_poller( + pipeline, + request, + Some(FinalStateVia::Location), + Some(options.method_options), + )) + } + + /// Gets the specified private endpoint connection associated with the key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `private_endpoint_connection_name` - Name of the private endpoint connection associated with the key vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.PrivateEndpointConnections.get")] + pub async fn get( + &self, + resource_group_name: &str, + vault_name: &str, + private_endpoint_connection_name: &str, + options: Option>, + ) -> Result> { + if private_endpoint_connection_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter private_endpoint_connection_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"); + path = path.replace( + "{privateEndpointConnectionName}", + private_endpoint_connection_name, + ); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 204], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// The List operation gets information about the private endpoint connections associated with the vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.PrivateEndpointConnections.listByResource")] + pub fn list_by_resource( + &self, + resource_group_name: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultPrivateEndpointConnectionsClientListByResourcePage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultPrivateEndpointConnectionsClientListByResourcePage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Updates the specified private endpoint connection associated with the key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `private_endpoint_connection_name` - Name of the private endpoint connection associated with the key vault. + /// * `properties` - The intended state of private endpoint connection. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`PrivateEndpointConnectionHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{PrivateEndpointConnection, PrivateEndpointConnectionHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(azure_async_operation) = response.azure_async_operation()? { + /// println!("azure-asyncoperation: {:?}", azure_async_operation); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`azure_async_operation`()](crate::generated::models::PrivateEndpointConnectionHeaders::azure_async_operation) - azure-asyncoperation + /// * [`retry_after`()](crate::generated::models::PrivateEndpointConnectionHeaders::retry_after) - retry-after + /// + /// [`PrivateEndpointConnectionHeaders`]: crate::generated::models::PrivateEndpointConnectionHeaders + #[tracing::function("Microsoft.KeyVault.PrivateEndpointConnections.put")] + pub async fn put( + &self, + resource_group_name: &str, + vault_name: &str, + private_endpoint_connection_name: &str, + properties: RequestContent, + options: Option>, + ) -> Result> { + if private_endpoint_connection_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter private_endpoint_connection_name cannot be empty", + )); + } + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"); + path = path.replace( + "{privateEndpointConnectionName}", + private_endpoint_connection_name, + ); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(properties); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_link_resources_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_link_resources_client.rs new file mode 100644 index 0000000000..2c4b5b2b02 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_link_resources_client.rs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultPrivateLinkResourcesClientListByVaultOptions, PrivateLinkResourceListResult, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{Method, Pipeline, PipelineSendOptions, Request, Response, Url, UrlExt}, + tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultPrivateLinkResourcesClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultPrivateLinkResourcesClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Gets the private link resources supported for the key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.listByVault")] + pub async fn list_by_vault( + &self, + resource_group_name: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_secrets_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_secrets_client.rs new file mode 100644 index 0000000000..e05584ff63 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_secrets_client.rs @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + KeyVaultSecretsClientCreateOrUpdateOptions, KeyVaultSecretsClientGetOptions, + KeyVaultSecretsClientListOptions, KeyVaultSecretsClientUpdateOptions, Secret, + SecretCreateOrUpdateParameters, SecretListResult, SecretPatchParameters, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + Method, Pager, Pipeline, PipelineSendOptions, RawResponse, Request, RequestContent, + Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultSecretsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultSecretsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in + /// Resource Manager deployments. Users should use the data-plane REST service for interaction with vault secrets. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `secret_name` - The name of the secret. + /// * `parameters` - Parameters to create or update the secret + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Secrets.createOrUpdate")] + pub async fn create_or_update( + &self, + resource_group_name: &str, + vault_name: &str, + secret_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if secret_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter secret_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{secretName}", secret_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 201], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the specified secret. NOTE: This API is intended for internal use in Resource Manager deployments. Users should use the data-plane + /// REST service for interaction with vault secrets. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `secret_name` - The name of the secret. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Secrets.get")] + pub async fn get( + &self, + resource_group_name: &str, + vault_name: &str, + secret_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if secret_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter secret_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{secretName}", secret_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in Resource Manager deployments. + /// Users should use the data-plane REST service for interaction with vault secrets. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Secrets.list")] + pub fn list( + &self, + resource_group_name: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + if let Some(top) = options.top { + query_builder.set_pair("$top", top.to_string()); + } + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultSecretsClientListPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultSecretsClientListPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Update a secret in the specified subscription. NOTE: This API is intended for internal use in Resource Manager deployments. Users should + /// use the data-plane REST service for interaction with vault secrets. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `secret_name` - The name of the secret. + /// * `parameters` - Parameters to patch the secret + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Secrets.update")] + pub async fn update( + &self, + resource_group_name: &str, + vault_name: &str, + secret_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if secret_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter secret_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{secretName}", secret_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Patch); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 201], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_vaults_client.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_vaults_client.rs new file mode 100644 index 0000000000..46767846c7 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_vaults_client.rs @@ -0,0 +1,817 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::generated::models::{ + AccessPolicyUpdateKind, CheckNameAvailabilityResult, DeletedVault, DeletedVaultListResult, + KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus, + KeyVaultVaultsClientBeginCreateOrUpdateOptions, + KeyVaultVaultsClientBeginPurgeDeletedOperationStatus, + KeyVaultVaultsClientBeginPurgeDeletedOptions, KeyVaultVaultsClientCheckNameAvailabilityOptions, + KeyVaultVaultsClientDeleteOptions, KeyVaultVaultsClientGetDeletedOptions, + KeyVaultVaultsClientGetOptions, KeyVaultVaultsClientListByResourceGroupOptions, + KeyVaultVaultsClientListBySubscriptionOptions, KeyVaultVaultsClientListDeletedOptions, + KeyVaultVaultsClientListOptions, KeyVaultVaultsClientUpdateAccessPolicyOptions, + KeyVaultVaultsClientUpdateOptions, ResourceListResult, Vault, VaultAccessPolicyParameters, + VaultCheckNameAvailabilityParameters, VaultCreateOrUpdateParameters, VaultListResult, + VaultPatchParameters, +}; +use azure_core::{ + error::CheckSuccessOptions, + http::{ + pager::{PagerContinuation, PagerResult, PagerState}, + poller::resource_manager::{new_poller, FinalStateVia}, + Method, NoFormat, Pager, Pipeline, PipelineSendOptions, Poller, RawResponse, Request, + RequestContent, Response, Url, UrlExt, + }, + json, tracing, Result, +}; + +#[tracing::client] +pub struct KeyVaultVaultsClient { + pub(crate) api_version: String, + pub(crate) endpoint: Url, + pub(crate) pipeline: Pipeline, + pub(crate) subscription_id: String, +} + +impl KeyVaultVaultsClient { + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Create or update a key vault in the specified subscription. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `parameters` - Parameters to create or update the vault + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus, KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders`]: crate::generated::models::KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.Vaults.createOrUpdate")] + pub fn begin_create_or_update( + &self, + resource_group_name: &str, + vault_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + Ok(new_poller( + pipeline, + request, + Some(FinalStateVia::Location), + Some(options.method_options), + )) + } + + /// Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + /// + /// # Arguments + /// + /// * `location` - The name of the Azure region. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + /// + /// ## Response Headers + /// + /// The returned [`Response`](azure_core::http::Response) implements the [`KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientBeginPurgeDeletedOperationStatus, KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders}; + /// async fn example() -> Result<()> { + /// let response: Response = unimplemented!(); + /// // Access response headers + /// if let Some(location) = response.location()? { + /// println!("location: {:?}", location); + /// } + /// if let Some(retry_after) = response.retry_after()? { + /// println!("retry-after: {:?}", retry_after); + /// } + /// Ok(()) + /// } + /// ``` + /// + /// ### Available headers + /// * [`location`()](crate::generated::models::KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders`]: crate::generated::models::KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.DeletedVaults.purgeDeleted")] + pub fn begin_purge_deleted( + &self, + location: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge"); + path = path.replace("{location}", location); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let request = Request::new(url, Method::Post); + Ok(new_poller( + pipeline, + request, + Some(FinalStateVia::Location), + Some(options.method_options), + )) + } + + /// Checks that the vault name is valid and is not already in use. + /// + /// # Arguments + /// + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability")] + pub async fn check_name_availability( + &self, + vault_name: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from( + "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability", + ); + path = path.replace("{subscriptionId}", &self.subscription_id); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(vault_name); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Deletes the specified Azure key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.delete")] + pub async fn delete( + &self, + resource_group_name: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Delete); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 204], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the specified Azure key vault. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.get")] + pub async fn get( + &self, + resource_group_name: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Gets the deleted Azure key vault. + /// + /// # Arguments + /// + /// * `location` - The name of the Azure region. + /// * `vault_name` - The name of the vault. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.DeletedVaults.getDeleted")] + pub async fn get_deleted( + &self, + location: &str, + vault_name: &str, + options: Option>, + ) -> Result> { + if location.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter location cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}"); + path = path.replace("{location}", location); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// The List operation gets information about the vaults associated with the subscription. + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.VaultsOperationGroup.list")] + pub fn list( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resources"); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'"); + if let Some(top) = options.top { + query_builder.set_pair("$top", top.to_string()); + } + query_builder.set_pair("api-version", "2015-11-01"); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultVaultsClientListPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => next_link.try_into().expect("expected Url"), + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultVaultsClientListPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// The List operation gets information about the vaults associated with the subscription and within the specified resource + /// group. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.listByResourceGroup")] + pub fn list_by_resource_group( + &self, + resource_group_name: &str, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + if let Some(top) = options.top { + query_builder.set_pair("$top", top.to_string()); + } + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultVaultsClientListByResourceGroupPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultVaultsClientListByResourceGroupPage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// The List operation gets information about the vaults associated with the subscription. + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.listBySubscription")] + pub fn list_by_subscription( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = + String::from("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults"); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + if let Some(top) = options.top { + query_builder.set_pair("$top", top.to_string()); + } + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultVaultsClientListBySubscriptionPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultVaultsClientListBySubscriptionPage = + json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Gets information about the deleted vaults in a subscription. + /// + /// # Arguments + /// + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.VaultsOperationGroup.listDeleted")] + pub fn list_deleted( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from( + "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults", + ); + path = path.replace("{subscriptionId}", &self.subscription_id); + first_url.append_path(&path); + let mut query_builder = first_url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + #[derive(serde::Deserialize)] + struct KeyVaultVaultsClientListDeletedPage { + #[serde(rename = "nextLink")] + next_link: Option, + } + + let api_version = self.api_version.clone(); + Ok(Pager::new( + move |next_link: PagerState, pager_options| { + let url = match next_link { + PagerState::More(next_link) => { + let mut next_link: Url = next_link.try_into().expect("expected Url"); + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + next_link + } + PagerState::Initial => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let pipeline = pipeline.clone(); + Box::pin({ + let first_url = first_url.clone(); + async move { + let rsp = pipeline + .send( + &pager_options.context, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let res: KeyVaultVaultsClientListDeletedPage = json::from_json(&body)?; + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.next_link { + Some(next_link) if !next_link.is_empty() => PagerResult::More { + response: rsp, + continuation: PagerContinuation::Link( + first_url.join(next_link.as_ref())?, + ), + }, + _ => PagerResult::Done { response: rsp }, + }) + } + }) + }, + Some(options.method_options), + )) + } + + /// Update a key vault in the specified subscription. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - The name of the vault. + /// * `parameters` - Parameters to patch the vault + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.update")] + pub async fn update( + &self, + resource_group_name: &str, + vault_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Patch); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 201], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } + + /// Update access policies in a key vault in the specified subscription. + /// + /// # Arguments + /// + /// * `resource_group_name` - The name of the resource group. The name is case insensitive. + /// * `vault_name` - Name of the vault + /// * `operation_kind` - Name of the operation + /// * `parameters` - Access policy to merge into the vault + /// * `options` - Optional parameters for the request. + #[tracing::function("Microsoft.KeyVault.Vaults.updateAccessPolicy")] + pub async fn update_access_policy( + &self, + resource_group_name: &str, + vault_name: &str, + operation_kind: AccessPolicyUpdateKind, + parameters: RequestContent, + options: Option>, + ) -> Result> { + if resource_group_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter resource_group_name cannot be empty", + )); + } + if vault_name.is_empty() { + return Err(azure_core::Error::with_message( + azure_core::error::ErrorKind::Other, + "parameter vault_name cannot be empty", + )); + } + let options = options.unwrap_or_default(); + let ctx = options.method_options.context.to_borrowed(); + let mut url = self.endpoint.clone(); + let mut path = String::from("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}"); + path = path.replace("{operationKind}", operation_kind.as_ref()); + path = path.replace("{resourceGroupName}", resource_group_name); + path = path.replace("{subscriptionId}", &self.subscription_id); + path = path.replace("{vaultName}", vault_name); + url.append_path(&path); + let mut query_builder = url.query_builder(); + query_builder.set_pair("api-version", &self.api_version); + query_builder.build(); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + let rsp = self + .pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 201], + }, + ..Default::default() + }), + ) + .await?; + Ok(rsp.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/mod.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/mod.rs new file mode 100644 index 0000000000..e8474acbcb --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/mod.rs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +mod key_vault_client; +mod key_vault_keys_client; +mod key_vault_managed_hsm_keys_client; +mod key_vault_managed_hsms_client; +mod key_vault_mhsm_private_endpoint_connections_client; +mod key_vault_mhsm_private_link_resources_client; +mod key_vault_mhsm_regions_client; +mod key_vault_operations_client; +mod key_vault_private_endpoint_connections_client; +mod key_vault_private_link_resources_client; +mod key_vault_secrets_client; +mod key_vault_vaults_client; +pub use key_vault_client::*; +pub use key_vault_keys_client::*; +pub use key_vault_managed_hsm_keys_client::*; +pub use key_vault_managed_hsms_client::*; +pub use key_vault_mhsm_private_endpoint_connections_client::*; +pub use key_vault_mhsm_private_link_resources_client::*; +pub use key_vault_mhsm_regions_client::*; +pub use key_vault_operations_client::*; +pub use key_vault_private_endpoint_connections_client::*; +pub use key_vault_private_link_resources_client::*; +pub use key_vault_secrets_client::*; +pub use key_vault_vaults_client::*; diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/mod.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/mod.rs new file mode 100644 index 0000000000..e97722ef87 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/mod.rs @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +/// Clients used to communicate with the service. +pub mod clients; +/// Contains all the data structures and types used by the client library. +pub mod models; +pub use clients::{KeyVaultClient, KeyVaultClientOptions}; diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums.rs new file mode 100644 index 0000000000..060e1fc871 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums.rs @@ -0,0 +1,535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum AccessPolicyUpdateKind { + Add, + + Remove, + + Replace, +} + +/// A message indicating if changes on the service provider require any updates on the consumer. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ActionsRequired { + None, + + /// Any other value not defined in `ActionsRequired`. + UnknownValue(String), +} + +/// Activation Status +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ActivationStatus { + /// The managed HSM Pool is active. + Active, + + /// Failed to activate managed hsm. + Failed, + + /// The managed HSM Pool is not yet activated. + NotActivated, + + /// An unknown error occurred while activating managed hsm. + Unknown, + + /// Any other value not defined in `ActivationStatus`. + UnknownValue(String), +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CertificatePermissions { + All, + + Backup, + + Create, + + Delete, + + Deleteissuers, + + Get, + + Getissuers, + + Import, + + List, + + Listissuers, + + Managecontacts, + + Manageissuers, + + Purge, + + Recover, + + Restore, + + Setissuers, + + Update, + + /// Any other value not defined in `CertificatePermissions`. + UnknownValue(String), +} + +/// The vault's create mode to indicate whether the vault need to be recovered or not. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum CreateMode { + Default, + + Recover, +} + +/// The kind of entity that created the resource. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum CreatedByType { + /// The entity was created by an application. + Application, + + /// The entity was created by a key. + Key, + + /// The entity was created by a managed identity. + ManagedIdentity, + + /// The entity was created by a user. + User, + + /// Any other value not defined in `CreatedByType`. + UnknownValue(String), +} + +/// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently +/// deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum DeletionRecoveryLevel { + Purgeable, + + Recoverable, + + RecoverableProtectedSubscription, + + RecoverablePurgeable, + + /// Any other value not defined in `DeletionRecoveryLevel`. + UnknownValue(String), +} + +/// The current provisioning state. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum GeoReplicationRegionProvisioningState { + Cleanup, + + Deleting, + + Failed, + + Preprovisioning, + + Provisioning, + + Succeeded, + + /// Any other value not defined in `GeoReplicationRegionProvisioningState`. + UnknownValue(String), +} + +/// The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys is P-256 +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum JsonWebKeyCurveName { + P256, + + P256K, + + P384, + + P521, + + /// Any other value not defined in `JsonWebKeyCurveName`. + UnknownValue(String), +} + +/// The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum JsonWebKeyOperation { + Decrypt, + + Encrypt, + + Import, + + Release, + + Sign, + + UnwrapKey, + + Verify, + + WrapKey, + + /// Any other value not defined in `JsonWebKeyOperation`. + UnknownValue(String), +} + +/// The type of the key. For valid values, see JsonWebKeyType. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum JsonWebKeyType { + Ec, + + EcHsm, + + OctHsm, + + Rsa, + + RsaHsm, + + /// Any other value not defined in `JsonWebKeyType`. + UnknownValue(String), +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum KeyPermissions { + All, + + Backup, + + Create, + + Decrypt, + + Delete, + + Encrypt, + + Get, + + Getrotationpolicy, + + Import, + + List, + + Purge, + + Recover, + + Release, + + Restore, + + Rotate, + + Setrotationpolicy, + + Sign, + + UnwrapKey, + + Update, + + Verify, + + WrapKey, + + /// Any other value not defined in `KeyPermissions`. + UnknownValue(String), +} + +/// The type of action. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum KeyRotationPolicyActionType { + Notify, + + Rotate, +} + +/// SKU Family of the managed HSM Pool +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ManagedHsmSkuFamily { + B, + + C, + + /// Any other value not defined in `ManagedHsmSkuFamily`. + UnknownValue(String), +} + +/// SKU of the managed HSM Pool +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ManagedHsmSkuNameV2 { + /// Custom_B32 SKU + CustomB32, + + /// Custom_B6 SKU + CustomB6, + + /// Custom_C10 SKU + CustomC10, + + /// Custom_C42 SKU + CustomC42, + + /// Standard_B1 SKU + StandardB1, + + /// Standard_B10v2 SKU + StandardB10V2, + + /// Standard_B15v2 SKU + StandardB15V2, + + /// Standard_B1v2 SKU + StandardB1V2, + + /// Standard_B20v2 SKU + StandardB20V2, + + /// Standard_B5v2 SKU + StandardB5V2, + + /// Any other value not defined in `ManagedHsmSkuNameV2`. + UnknownValue(String), +} + +/// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ManagedServiceIdentityType { + /// No managed identity. + None, + + /// System assigned managed identity. + SystemAssigned, + + /// System and user assigned managed identity. + SystemAssignedUserAssigned, + + /// User assigned managed identity. + UserAssigned, + + /// Any other value not defined in `ManagedServiceIdentityType`. + UnknownValue(String), +} + +/// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property +/// has been evaluated. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum NetworkRuleAction { + Allow, + + Deny, + + /// Any other value not defined in `NetworkRuleAction`. + UnknownValue(String), +} + +/// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum NetworkRuleBypassOptions { + AzureServices, + + None, + + /// Any other value not defined in `NetworkRuleBypassOptions`. + UnknownValue(String), +} + +/// The current provisioning state. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum PrivateEndpointConnectionProvisioningState { + Creating, + + Deleting, + + Disconnected, + + Failed, + + Succeeded, + + Updating, + + /// Any other value not defined in `PrivateEndpointConnectionProvisioningState`. + UnknownValue(String), +} + +/// The private endpoint connection status. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum PrivateEndpointServiceConnectionStatus { + Approved, + + Disconnected, + + Pending, + + Rejected, + + /// Any other value not defined in `PrivateEndpointServiceConnectionStatus`. + UnknownValue(String), +} + +/// Provisioning state. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ProvisioningState { + /// The managed HSM pool is ready for normal use. + Activated, + + /// The managed HSM Pool is currently being deleted. + Deleting, + + /// Provisioning of the managed HSM Pool has failed. + Failed, + + /// The managed HSM Pool is currently being provisioned. + Provisioning, + + /// The managed HSM pool is being restored from full HSM backup. + Restoring, + + /// The managed HSM pool is waiting for a security domain restore action. + SecurityDomainRestore, + + /// The managed HSM Pool has been full provisioned. + Succeeded, + + /// The managed HSM Pool is currently being updated. + Updating, + + /// Any other value not defined in `ProvisioningState`. + UnknownValue(String), +} + +/// Control permission to the managed HSM from public networks. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum PublicNetworkAccess { + Disabled, + + Enabled, + + /// Any other value not defined in `PublicNetworkAccess`. + UnknownValue(String), +} + +/// The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum Reason { + AccountNameInvalid, + + AlreadyExists, + + /// Any other value not defined in `Reason`. + UnknownValue(String), +} + +/// The provisioning state of a resource type. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ResourceProvisioningState { + /// Resource creation was canceled. + Canceled, + + /// Resource creation failed. + Failed, + + /// Resource has been created. + Succeeded, + + /// Any other value not defined in `ResourceProvisioningState`. + UnknownValue(String), +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SecretPermissions { + All, + + Backup, + + Delete, + + Get, + + List, + + Purge, + + Recover, + + Restore, + + Set, + + /// Any other value not defined in `SecretPermissions`. + UnknownValue(String), +} + +/// SKU family name +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum SkuFamily { + A, + + /// Any other value not defined in `SkuFamily`. + UnknownValue(String), +} + +/// SKU name to specify whether the key vault is a standard vault or a premium vault. +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum SkuName { + Premium, + + Standard, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum StoragePermissions { + All, + + Backup, + + Delete, + + Deletesas, + + Get, + + Getsas, + + List, + + Listsas, + + Purge, + + Recover, + + Regeneratekey, + + Restore, + + Set, + + Setsas, + + Update, + + /// Any other value not defined in `StoragePermissions`. + UnknownValue(String), +} + +/// Provisioning state of the vault. +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum VaultProvisioningState { + RegisteringDns, + + Succeeded, + + /// Any other value not defined in `VaultProvisioningState`. + UnknownValue(String), +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_impl.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_impl.rs new file mode 100644 index 0000000000..2c183de1c6 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_impl.rs @@ -0,0 +1,1577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use super::{ + AccessPolicyUpdateKind, ActionsRequired, ActivationStatus, CertificatePermissions, CreateMode, + CreatedByType, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, + JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, KeyPermissions, + KeyRotationPolicyActionType, ManagedHsmSkuFamily, ManagedHsmSkuNameV2, + ManagedServiceIdentityType, NetworkRuleAction, NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, + ProvisioningState, PublicNetworkAccess, Reason, ResourceProvisioningState, SecretPermissions, + SkuFamily, SkuName, StoragePermissions, VaultProvisioningState, +}; +use azure_core::error::{Error, ErrorKind}; +use std::{ + convert::{AsRef, From, Infallible}, + fmt::{Display, Formatter}, + str::FromStr, +}; + +impl FromStr for AccessPolicyUpdateKind { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "add" => AccessPolicyUpdateKind::Add, + "remove" => AccessPolicyUpdateKind::Remove, + "replace" => AccessPolicyUpdateKind::Replace, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of AccessPolicyUpdateKind found: \"{s}\"") + })) + } + }) + } +} + +impl AsRef for AccessPolicyUpdateKind { + fn as_ref(&self) -> &str { + match self { + AccessPolicyUpdateKind::Add => "add", + AccessPolicyUpdateKind::Remove => "remove", + AccessPolicyUpdateKind::Replace => "replace", + } + } +} + +impl Display for AccessPolicyUpdateKind { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + AccessPolicyUpdateKind::Add => Display::fmt("add", f), + AccessPolicyUpdateKind::Remove => Display::fmt("remove", f), + AccessPolicyUpdateKind::Replace => Display::fmt("replace", f), + } + } +} + +impl<'a> From<&'a ActionsRequired> for &'a str { + fn from(e: &'a ActionsRequired) -> Self { + match e { + ActionsRequired::None => "None", + ActionsRequired::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ActionsRequired { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "None" => ActionsRequired::None, + _ => ActionsRequired::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ActionsRequired { + fn as_ref(&self) -> &str { + match self { + ActionsRequired::None => "None", + ActionsRequired::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ActionsRequired { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ActionsRequired::None => f.write_str("None"), + ActionsRequired::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a ActivationStatus> for &'a str { + fn from(e: &'a ActivationStatus) -> Self { + match e { + ActivationStatus::Active => "Active", + ActivationStatus::Failed => "Failed", + ActivationStatus::NotActivated => "NotActivated", + ActivationStatus::Unknown => "Unknown", + ActivationStatus::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ActivationStatus { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Active" => ActivationStatus::Active, + "Failed" => ActivationStatus::Failed, + "NotActivated" => ActivationStatus::NotActivated, + "Unknown" => ActivationStatus::Unknown, + _ => ActivationStatus::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ActivationStatus { + fn as_ref(&self) -> &str { + match self { + ActivationStatus::Active => "Active", + ActivationStatus::Failed => "Failed", + ActivationStatus::NotActivated => "NotActivated", + ActivationStatus::Unknown => "Unknown", + ActivationStatus::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ActivationStatus { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ActivationStatus::Active => f.write_str("Active"), + ActivationStatus::Failed => f.write_str("Failed"), + ActivationStatus::NotActivated => f.write_str("NotActivated"), + ActivationStatus::Unknown => f.write_str("Unknown"), + ActivationStatus::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a CertificatePermissions> for &'a str { + fn from(e: &'a CertificatePermissions) -> Self { + match e { + CertificatePermissions::All => "all", + CertificatePermissions::Backup => "backup", + CertificatePermissions::Create => "create", + CertificatePermissions::Delete => "delete", + CertificatePermissions::Deleteissuers => "deleteissuers", + CertificatePermissions::Get => "get", + CertificatePermissions::Getissuers => "getissuers", + CertificatePermissions::Import => "import", + CertificatePermissions::List => "list", + CertificatePermissions::Listissuers => "listissuers", + CertificatePermissions::Managecontacts => "managecontacts", + CertificatePermissions::Manageissuers => "manageissuers", + CertificatePermissions::Purge => "purge", + CertificatePermissions::Recover => "recover", + CertificatePermissions::Restore => "restore", + CertificatePermissions::Setissuers => "setissuers", + CertificatePermissions::Update => "update", + CertificatePermissions::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for CertificatePermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "all" => CertificatePermissions::All, + "backup" => CertificatePermissions::Backup, + "create" => CertificatePermissions::Create, + "delete" => CertificatePermissions::Delete, + "deleteissuers" => CertificatePermissions::Deleteissuers, + "get" => CertificatePermissions::Get, + "getissuers" => CertificatePermissions::Getissuers, + "import" => CertificatePermissions::Import, + "list" => CertificatePermissions::List, + "listissuers" => CertificatePermissions::Listissuers, + "managecontacts" => CertificatePermissions::Managecontacts, + "manageissuers" => CertificatePermissions::Manageissuers, + "purge" => CertificatePermissions::Purge, + "recover" => CertificatePermissions::Recover, + "restore" => CertificatePermissions::Restore, + "setissuers" => CertificatePermissions::Setissuers, + "update" => CertificatePermissions::Update, + _ => CertificatePermissions::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for CertificatePermissions { + fn as_ref(&self) -> &str { + match self { + CertificatePermissions::All => "all", + CertificatePermissions::Backup => "backup", + CertificatePermissions::Create => "create", + CertificatePermissions::Delete => "delete", + CertificatePermissions::Deleteissuers => "deleteissuers", + CertificatePermissions::Get => "get", + CertificatePermissions::Getissuers => "getissuers", + CertificatePermissions::Import => "import", + CertificatePermissions::List => "list", + CertificatePermissions::Listissuers => "listissuers", + CertificatePermissions::Managecontacts => "managecontacts", + CertificatePermissions::Manageissuers => "manageissuers", + CertificatePermissions::Purge => "purge", + CertificatePermissions::Recover => "recover", + CertificatePermissions::Restore => "restore", + CertificatePermissions::Setissuers => "setissuers", + CertificatePermissions::Update => "update", + CertificatePermissions::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for CertificatePermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + CertificatePermissions::All => f.write_str("all"), + CertificatePermissions::Backup => f.write_str("backup"), + CertificatePermissions::Create => f.write_str("create"), + CertificatePermissions::Delete => f.write_str("delete"), + CertificatePermissions::Deleteissuers => f.write_str("deleteissuers"), + CertificatePermissions::Get => f.write_str("get"), + CertificatePermissions::Getissuers => f.write_str("getissuers"), + CertificatePermissions::Import => f.write_str("import"), + CertificatePermissions::List => f.write_str("list"), + CertificatePermissions::Listissuers => f.write_str("listissuers"), + CertificatePermissions::Managecontacts => f.write_str("managecontacts"), + CertificatePermissions::Manageissuers => f.write_str("manageissuers"), + CertificatePermissions::Purge => f.write_str("purge"), + CertificatePermissions::Recover => f.write_str("recover"), + CertificatePermissions::Restore => f.write_str("restore"), + CertificatePermissions::Setissuers => f.write_str("setissuers"), + CertificatePermissions::Update => f.write_str("update"), + CertificatePermissions::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl FromStr for CreateMode { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "default" => CreateMode::Default, + "recover" => CreateMode::Recover, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of CreateMode found: \"{s}\"") + })) + } + }) + } +} + +impl AsRef for CreateMode { + fn as_ref(&self) -> &str { + match self { + CreateMode::Default => "default", + CreateMode::Recover => "recover", + } + } +} + +impl Display for CreateMode { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + CreateMode::Default => Display::fmt("default", f), + CreateMode::Recover => Display::fmt("recover", f), + } + } +} + +impl<'a> From<&'a CreatedByType> for &'a str { + fn from(e: &'a CreatedByType) -> Self { + match e { + CreatedByType::Application => "Application", + CreatedByType::Key => "Key", + CreatedByType::ManagedIdentity => "ManagedIdentity", + CreatedByType::User => "User", + CreatedByType::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for CreatedByType { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Application" => CreatedByType::Application, + "Key" => CreatedByType::Key, + "ManagedIdentity" => CreatedByType::ManagedIdentity, + "User" => CreatedByType::User, + _ => CreatedByType::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for CreatedByType { + fn as_ref(&self) -> &str { + match self { + CreatedByType::Application => "Application", + CreatedByType::Key => "Key", + CreatedByType::ManagedIdentity => "ManagedIdentity", + CreatedByType::User => "User", + CreatedByType::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for CreatedByType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + CreatedByType::Application => f.write_str("Application"), + CreatedByType::Key => f.write_str("Key"), + CreatedByType::ManagedIdentity => f.write_str("ManagedIdentity"), + CreatedByType::User => f.write_str("User"), + CreatedByType::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a DeletionRecoveryLevel> for &'a str { + fn from(e: &'a DeletionRecoveryLevel) -> Self { + match e { + DeletionRecoveryLevel::Purgeable => "Purgeable", + DeletionRecoveryLevel::Recoverable => "Recoverable", + DeletionRecoveryLevel::RecoverableProtectedSubscription => { + "Recoverable+ProtectedSubscription" + } + DeletionRecoveryLevel::RecoverablePurgeable => "Recoverable+Purgeable", + DeletionRecoveryLevel::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for DeletionRecoveryLevel { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Purgeable" => DeletionRecoveryLevel::Purgeable, + "Recoverable" => DeletionRecoveryLevel::Recoverable, + "Recoverable+ProtectedSubscription" => { + DeletionRecoveryLevel::RecoverableProtectedSubscription + } + "Recoverable+Purgeable" => DeletionRecoveryLevel::RecoverablePurgeable, + _ => DeletionRecoveryLevel::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for DeletionRecoveryLevel { + fn as_ref(&self) -> &str { + match self { + DeletionRecoveryLevel::Purgeable => "Purgeable", + DeletionRecoveryLevel::Recoverable => "Recoverable", + DeletionRecoveryLevel::RecoverableProtectedSubscription => { + "Recoverable+ProtectedSubscription" + } + DeletionRecoveryLevel::RecoverablePurgeable => "Recoverable+Purgeable", + DeletionRecoveryLevel::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for DeletionRecoveryLevel { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + DeletionRecoveryLevel::Purgeable => f.write_str("Purgeable"), + DeletionRecoveryLevel::Recoverable => f.write_str("Recoverable"), + DeletionRecoveryLevel::RecoverableProtectedSubscription => { + f.write_str("Recoverable+ProtectedSubscription") + } + DeletionRecoveryLevel::RecoverablePurgeable => f.write_str("Recoverable+Purgeable"), + DeletionRecoveryLevel::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a GeoReplicationRegionProvisioningState> for &'a str { + fn from(e: &'a GeoReplicationRegionProvisioningState) -> Self { + match e { + GeoReplicationRegionProvisioningState::Cleanup => "Cleanup", + GeoReplicationRegionProvisioningState::Deleting => "Deleting", + GeoReplicationRegionProvisioningState::Failed => "Failed", + GeoReplicationRegionProvisioningState::Preprovisioning => "Preprovisioning", + GeoReplicationRegionProvisioningState::Provisioning => "Provisioning", + GeoReplicationRegionProvisioningState::Succeeded => "Succeeded", + GeoReplicationRegionProvisioningState::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for GeoReplicationRegionProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Cleanup" => GeoReplicationRegionProvisioningState::Cleanup, + "Deleting" => GeoReplicationRegionProvisioningState::Deleting, + "Failed" => GeoReplicationRegionProvisioningState::Failed, + "Preprovisioning" => GeoReplicationRegionProvisioningState::Preprovisioning, + "Provisioning" => GeoReplicationRegionProvisioningState::Provisioning, + "Succeeded" => GeoReplicationRegionProvisioningState::Succeeded, + _ => GeoReplicationRegionProvisioningState::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for GeoReplicationRegionProvisioningState { + fn as_ref(&self) -> &str { + match self { + GeoReplicationRegionProvisioningState::Cleanup => "Cleanup", + GeoReplicationRegionProvisioningState::Deleting => "Deleting", + GeoReplicationRegionProvisioningState::Failed => "Failed", + GeoReplicationRegionProvisioningState::Preprovisioning => "Preprovisioning", + GeoReplicationRegionProvisioningState::Provisioning => "Provisioning", + GeoReplicationRegionProvisioningState::Succeeded => "Succeeded", + GeoReplicationRegionProvisioningState::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for GeoReplicationRegionProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + GeoReplicationRegionProvisioningState::Cleanup => f.write_str("Cleanup"), + GeoReplicationRegionProvisioningState::Deleting => f.write_str("Deleting"), + GeoReplicationRegionProvisioningState::Failed => f.write_str("Failed"), + GeoReplicationRegionProvisioningState::Preprovisioning => { + f.write_str("Preprovisioning") + } + GeoReplicationRegionProvisioningState::Provisioning => f.write_str("Provisioning"), + GeoReplicationRegionProvisioningState::Succeeded => f.write_str("Succeeded"), + GeoReplicationRegionProvisioningState::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a JsonWebKeyCurveName> for &'a str { + fn from(e: &'a JsonWebKeyCurveName) -> Self { + match e { + JsonWebKeyCurveName::P256 => "P-256", + JsonWebKeyCurveName::P256K => "P-256K", + JsonWebKeyCurveName::P384 => "P-384", + JsonWebKeyCurveName::P521 => "P-521", + JsonWebKeyCurveName::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for JsonWebKeyCurveName { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "P-256" => JsonWebKeyCurveName::P256, + "P-256K" => JsonWebKeyCurveName::P256K, + "P-384" => JsonWebKeyCurveName::P384, + "P-521" => JsonWebKeyCurveName::P521, + _ => JsonWebKeyCurveName::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for JsonWebKeyCurveName { + fn as_ref(&self) -> &str { + match self { + JsonWebKeyCurveName::P256 => "P-256", + JsonWebKeyCurveName::P256K => "P-256K", + JsonWebKeyCurveName::P384 => "P-384", + JsonWebKeyCurveName::P521 => "P-521", + JsonWebKeyCurveName::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for JsonWebKeyCurveName { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + JsonWebKeyCurveName::P256 => f.write_str("P-256"), + JsonWebKeyCurveName::P256K => f.write_str("P-256K"), + JsonWebKeyCurveName::P384 => f.write_str("P-384"), + JsonWebKeyCurveName::P521 => f.write_str("P-521"), + JsonWebKeyCurveName::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a JsonWebKeyOperation> for &'a str { + fn from(e: &'a JsonWebKeyOperation) -> Self { + match e { + JsonWebKeyOperation::Decrypt => "decrypt", + JsonWebKeyOperation::Encrypt => "encrypt", + JsonWebKeyOperation::Import => "import", + JsonWebKeyOperation::Release => "release", + JsonWebKeyOperation::Sign => "sign", + JsonWebKeyOperation::UnwrapKey => "unwrapKey", + JsonWebKeyOperation::Verify => "verify", + JsonWebKeyOperation::WrapKey => "wrapKey", + JsonWebKeyOperation::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for JsonWebKeyOperation { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "decrypt" => JsonWebKeyOperation::Decrypt, + "encrypt" => JsonWebKeyOperation::Encrypt, + "import" => JsonWebKeyOperation::Import, + "release" => JsonWebKeyOperation::Release, + "sign" => JsonWebKeyOperation::Sign, + "unwrapKey" => JsonWebKeyOperation::UnwrapKey, + "verify" => JsonWebKeyOperation::Verify, + "wrapKey" => JsonWebKeyOperation::WrapKey, + _ => JsonWebKeyOperation::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for JsonWebKeyOperation { + fn as_ref(&self) -> &str { + match self { + JsonWebKeyOperation::Decrypt => "decrypt", + JsonWebKeyOperation::Encrypt => "encrypt", + JsonWebKeyOperation::Import => "import", + JsonWebKeyOperation::Release => "release", + JsonWebKeyOperation::Sign => "sign", + JsonWebKeyOperation::UnwrapKey => "unwrapKey", + JsonWebKeyOperation::Verify => "verify", + JsonWebKeyOperation::WrapKey => "wrapKey", + JsonWebKeyOperation::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for JsonWebKeyOperation { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + JsonWebKeyOperation::Decrypt => f.write_str("decrypt"), + JsonWebKeyOperation::Encrypt => f.write_str("encrypt"), + JsonWebKeyOperation::Import => f.write_str("import"), + JsonWebKeyOperation::Release => f.write_str("release"), + JsonWebKeyOperation::Sign => f.write_str("sign"), + JsonWebKeyOperation::UnwrapKey => f.write_str("unwrapKey"), + JsonWebKeyOperation::Verify => f.write_str("verify"), + JsonWebKeyOperation::WrapKey => f.write_str("wrapKey"), + JsonWebKeyOperation::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a JsonWebKeyType> for &'a str { + fn from(e: &'a JsonWebKeyType) -> Self { + match e { + JsonWebKeyType::Ec => "EC", + JsonWebKeyType::EcHsm => "EC-HSM", + JsonWebKeyType::OctHsm => "oct-HSM", + JsonWebKeyType::Rsa => "RSA", + JsonWebKeyType::RsaHsm => "RSA-HSM", + JsonWebKeyType::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for JsonWebKeyType { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "EC" => JsonWebKeyType::Ec, + "EC-HSM" => JsonWebKeyType::EcHsm, + "oct-HSM" => JsonWebKeyType::OctHsm, + "RSA" => JsonWebKeyType::Rsa, + "RSA-HSM" => JsonWebKeyType::RsaHsm, + _ => JsonWebKeyType::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for JsonWebKeyType { + fn as_ref(&self) -> &str { + match self { + JsonWebKeyType::Ec => "EC", + JsonWebKeyType::EcHsm => "EC-HSM", + JsonWebKeyType::OctHsm => "oct-HSM", + JsonWebKeyType::Rsa => "RSA", + JsonWebKeyType::RsaHsm => "RSA-HSM", + JsonWebKeyType::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for JsonWebKeyType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + JsonWebKeyType::Ec => f.write_str("EC"), + JsonWebKeyType::EcHsm => f.write_str("EC-HSM"), + JsonWebKeyType::OctHsm => f.write_str("oct-HSM"), + JsonWebKeyType::Rsa => f.write_str("RSA"), + JsonWebKeyType::RsaHsm => f.write_str("RSA-HSM"), + JsonWebKeyType::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a KeyPermissions> for &'a str { + fn from(e: &'a KeyPermissions) -> Self { + match e { + KeyPermissions::All => "all", + KeyPermissions::Backup => "backup", + KeyPermissions::Create => "create", + KeyPermissions::Decrypt => "decrypt", + KeyPermissions::Delete => "delete", + KeyPermissions::Encrypt => "encrypt", + KeyPermissions::Get => "get", + KeyPermissions::Getrotationpolicy => "getrotationpolicy", + KeyPermissions::Import => "import", + KeyPermissions::List => "list", + KeyPermissions::Purge => "purge", + KeyPermissions::Recover => "recover", + KeyPermissions::Release => "release", + KeyPermissions::Restore => "restore", + KeyPermissions::Rotate => "rotate", + KeyPermissions::Setrotationpolicy => "setrotationpolicy", + KeyPermissions::Sign => "sign", + KeyPermissions::UnwrapKey => "unwrapKey", + KeyPermissions::Update => "update", + KeyPermissions::Verify => "verify", + KeyPermissions::WrapKey => "wrapKey", + KeyPermissions::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for KeyPermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "all" => KeyPermissions::All, + "backup" => KeyPermissions::Backup, + "create" => KeyPermissions::Create, + "decrypt" => KeyPermissions::Decrypt, + "delete" => KeyPermissions::Delete, + "encrypt" => KeyPermissions::Encrypt, + "get" => KeyPermissions::Get, + "getrotationpolicy" => KeyPermissions::Getrotationpolicy, + "import" => KeyPermissions::Import, + "list" => KeyPermissions::List, + "purge" => KeyPermissions::Purge, + "recover" => KeyPermissions::Recover, + "release" => KeyPermissions::Release, + "restore" => KeyPermissions::Restore, + "rotate" => KeyPermissions::Rotate, + "setrotationpolicy" => KeyPermissions::Setrotationpolicy, + "sign" => KeyPermissions::Sign, + "unwrapKey" => KeyPermissions::UnwrapKey, + "update" => KeyPermissions::Update, + "verify" => KeyPermissions::Verify, + "wrapKey" => KeyPermissions::WrapKey, + _ => KeyPermissions::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for KeyPermissions { + fn as_ref(&self) -> &str { + match self { + KeyPermissions::All => "all", + KeyPermissions::Backup => "backup", + KeyPermissions::Create => "create", + KeyPermissions::Decrypt => "decrypt", + KeyPermissions::Delete => "delete", + KeyPermissions::Encrypt => "encrypt", + KeyPermissions::Get => "get", + KeyPermissions::Getrotationpolicy => "getrotationpolicy", + KeyPermissions::Import => "import", + KeyPermissions::List => "list", + KeyPermissions::Purge => "purge", + KeyPermissions::Recover => "recover", + KeyPermissions::Release => "release", + KeyPermissions::Restore => "restore", + KeyPermissions::Rotate => "rotate", + KeyPermissions::Setrotationpolicy => "setrotationpolicy", + KeyPermissions::Sign => "sign", + KeyPermissions::UnwrapKey => "unwrapKey", + KeyPermissions::Update => "update", + KeyPermissions::Verify => "verify", + KeyPermissions::WrapKey => "wrapKey", + KeyPermissions::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for KeyPermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + KeyPermissions::All => f.write_str("all"), + KeyPermissions::Backup => f.write_str("backup"), + KeyPermissions::Create => f.write_str("create"), + KeyPermissions::Decrypt => f.write_str("decrypt"), + KeyPermissions::Delete => f.write_str("delete"), + KeyPermissions::Encrypt => f.write_str("encrypt"), + KeyPermissions::Get => f.write_str("get"), + KeyPermissions::Getrotationpolicy => f.write_str("getrotationpolicy"), + KeyPermissions::Import => f.write_str("import"), + KeyPermissions::List => f.write_str("list"), + KeyPermissions::Purge => f.write_str("purge"), + KeyPermissions::Recover => f.write_str("recover"), + KeyPermissions::Release => f.write_str("release"), + KeyPermissions::Restore => f.write_str("restore"), + KeyPermissions::Rotate => f.write_str("rotate"), + KeyPermissions::Setrotationpolicy => f.write_str("setrotationpolicy"), + KeyPermissions::Sign => f.write_str("sign"), + KeyPermissions::UnwrapKey => f.write_str("unwrapKey"), + KeyPermissions::Update => f.write_str("update"), + KeyPermissions::Verify => f.write_str("verify"), + KeyPermissions::WrapKey => f.write_str("wrapKey"), + KeyPermissions::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl FromStr for KeyRotationPolicyActionType { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Notify" => KeyRotationPolicyActionType::Notify, + "Rotate" => KeyRotationPolicyActionType::Rotate, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of KeyRotationPolicyActionType found: \"{s}\"") + })) + } + }) + } +} + +impl AsRef for KeyRotationPolicyActionType { + fn as_ref(&self) -> &str { + match self { + KeyRotationPolicyActionType::Notify => "Notify", + KeyRotationPolicyActionType::Rotate => "Rotate", + } + } +} + +impl Display for KeyRotationPolicyActionType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + KeyRotationPolicyActionType::Notify => Display::fmt("Notify", f), + KeyRotationPolicyActionType::Rotate => Display::fmt("Rotate", f), + } + } +} + +impl<'a> From<&'a ManagedHsmSkuFamily> for &'a str { + fn from(e: &'a ManagedHsmSkuFamily) -> Self { + match e { + ManagedHsmSkuFamily::B => "B", + ManagedHsmSkuFamily::C => "C", + ManagedHsmSkuFamily::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ManagedHsmSkuFamily { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "B" => ManagedHsmSkuFamily::B, + "C" => ManagedHsmSkuFamily::C, + _ => ManagedHsmSkuFamily::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ManagedHsmSkuFamily { + fn as_ref(&self) -> &str { + match self { + ManagedHsmSkuFamily::B => "B", + ManagedHsmSkuFamily::C => "C", + ManagedHsmSkuFamily::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ManagedHsmSkuFamily { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ManagedHsmSkuFamily::B => f.write_str("B"), + ManagedHsmSkuFamily::C => f.write_str("C"), + ManagedHsmSkuFamily::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a ManagedHsmSkuNameV2> for &'a str { + fn from(e: &'a ManagedHsmSkuNameV2) -> Self { + match e { + ManagedHsmSkuNameV2::CustomB32 => "Custom_B32", + ManagedHsmSkuNameV2::CustomB6 => "Custom_B6", + ManagedHsmSkuNameV2::CustomC10 => "Custom_C10", + ManagedHsmSkuNameV2::CustomC42 => "Custom_C42", + ManagedHsmSkuNameV2::StandardB1 => "Standard_B1", + ManagedHsmSkuNameV2::StandardB10V2 => "Standard_B10v2", + ManagedHsmSkuNameV2::StandardB15V2 => "Standard_B15v2", + ManagedHsmSkuNameV2::StandardB1V2 => "Standard_B1v2", + ManagedHsmSkuNameV2::StandardB20V2 => "Standard_B20v2", + ManagedHsmSkuNameV2::StandardB5V2 => "Standard_B5v2", + ManagedHsmSkuNameV2::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ManagedHsmSkuNameV2 { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Custom_B32" => ManagedHsmSkuNameV2::CustomB32, + "Custom_B6" => ManagedHsmSkuNameV2::CustomB6, + "Custom_C10" => ManagedHsmSkuNameV2::CustomC10, + "Custom_C42" => ManagedHsmSkuNameV2::CustomC42, + "Standard_B1" => ManagedHsmSkuNameV2::StandardB1, + "Standard_B10v2" => ManagedHsmSkuNameV2::StandardB10V2, + "Standard_B15v2" => ManagedHsmSkuNameV2::StandardB15V2, + "Standard_B1v2" => ManagedHsmSkuNameV2::StandardB1V2, + "Standard_B20v2" => ManagedHsmSkuNameV2::StandardB20V2, + "Standard_B5v2" => ManagedHsmSkuNameV2::StandardB5V2, + _ => ManagedHsmSkuNameV2::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ManagedHsmSkuNameV2 { + fn as_ref(&self) -> &str { + match self { + ManagedHsmSkuNameV2::CustomB32 => "Custom_B32", + ManagedHsmSkuNameV2::CustomB6 => "Custom_B6", + ManagedHsmSkuNameV2::CustomC10 => "Custom_C10", + ManagedHsmSkuNameV2::CustomC42 => "Custom_C42", + ManagedHsmSkuNameV2::StandardB1 => "Standard_B1", + ManagedHsmSkuNameV2::StandardB10V2 => "Standard_B10v2", + ManagedHsmSkuNameV2::StandardB15V2 => "Standard_B15v2", + ManagedHsmSkuNameV2::StandardB1V2 => "Standard_B1v2", + ManagedHsmSkuNameV2::StandardB20V2 => "Standard_B20v2", + ManagedHsmSkuNameV2::StandardB5V2 => "Standard_B5v2", + ManagedHsmSkuNameV2::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ManagedHsmSkuNameV2 { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ManagedHsmSkuNameV2::CustomB32 => f.write_str("Custom_B32"), + ManagedHsmSkuNameV2::CustomB6 => f.write_str("Custom_B6"), + ManagedHsmSkuNameV2::CustomC10 => f.write_str("Custom_C10"), + ManagedHsmSkuNameV2::CustomC42 => f.write_str("Custom_C42"), + ManagedHsmSkuNameV2::StandardB1 => f.write_str("Standard_B1"), + ManagedHsmSkuNameV2::StandardB10V2 => f.write_str("Standard_B10v2"), + ManagedHsmSkuNameV2::StandardB15V2 => f.write_str("Standard_B15v2"), + ManagedHsmSkuNameV2::StandardB1V2 => f.write_str("Standard_B1v2"), + ManagedHsmSkuNameV2::StandardB20V2 => f.write_str("Standard_B20v2"), + ManagedHsmSkuNameV2::StandardB5V2 => f.write_str("Standard_B5v2"), + ManagedHsmSkuNameV2::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a ManagedServiceIdentityType> for &'a str { + fn from(e: &'a ManagedServiceIdentityType) -> Self { + match e { + ManagedServiceIdentityType::None => "None", + ManagedServiceIdentityType::SystemAssigned => "SystemAssigned", + ManagedServiceIdentityType::SystemAssignedUserAssigned => "SystemAssigned,UserAssigned", + ManagedServiceIdentityType::UserAssigned => "UserAssigned", + ManagedServiceIdentityType::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ManagedServiceIdentityType { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "None" => ManagedServiceIdentityType::None, + "SystemAssigned" => ManagedServiceIdentityType::SystemAssigned, + "SystemAssigned,UserAssigned" => ManagedServiceIdentityType::SystemAssignedUserAssigned, + "UserAssigned" => ManagedServiceIdentityType::UserAssigned, + _ => ManagedServiceIdentityType::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ManagedServiceIdentityType { + fn as_ref(&self) -> &str { + match self { + ManagedServiceIdentityType::None => "None", + ManagedServiceIdentityType::SystemAssigned => "SystemAssigned", + ManagedServiceIdentityType::SystemAssignedUserAssigned => "SystemAssigned,UserAssigned", + ManagedServiceIdentityType::UserAssigned => "UserAssigned", + ManagedServiceIdentityType::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ManagedServiceIdentityType { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ManagedServiceIdentityType::None => f.write_str("None"), + ManagedServiceIdentityType::SystemAssigned => f.write_str("SystemAssigned"), + ManagedServiceIdentityType::SystemAssignedUserAssigned => { + f.write_str("SystemAssigned,UserAssigned") + } + ManagedServiceIdentityType::UserAssigned => f.write_str("UserAssigned"), + ManagedServiceIdentityType::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a NetworkRuleAction> for &'a str { + fn from(e: &'a NetworkRuleAction) -> Self { + match e { + NetworkRuleAction::Allow => "Allow", + NetworkRuleAction::Deny => "Deny", + NetworkRuleAction::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for NetworkRuleAction { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Allow" => NetworkRuleAction::Allow, + "Deny" => NetworkRuleAction::Deny, + _ => NetworkRuleAction::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for NetworkRuleAction { + fn as_ref(&self) -> &str { + match self { + NetworkRuleAction::Allow => "Allow", + NetworkRuleAction::Deny => "Deny", + NetworkRuleAction::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for NetworkRuleAction { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + NetworkRuleAction::Allow => f.write_str("Allow"), + NetworkRuleAction::Deny => f.write_str("Deny"), + NetworkRuleAction::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a NetworkRuleBypassOptions> for &'a str { + fn from(e: &'a NetworkRuleBypassOptions) -> Self { + match e { + NetworkRuleBypassOptions::AzureServices => "AzureServices", + NetworkRuleBypassOptions::None => "None", + NetworkRuleBypassOptions::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for NetworkRuleBypassOptions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "AzureServices" => NetworkRuleBypassOptions::AzureServices, + "None" => NetworkRuleBypassOptions::None, + _ => NetworkRuleBypassOptions::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for NetworkRuleBypassOptions { + fn as_ref(&self) -> &str { + match self { + NetworkRuleBypassOptions::AzureServices => "AzureServices", + NetworkRuleBypassOptions::None => "None", + NetworkRuleBypassOptions::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for NetworkRuleBypassOptions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + NetworkRuleBypassOptions::AzureServices => f.write_str("AzureServices"), + NetworkRuleBypassOptions::None => f.write_str("None"), + NetworkRuleBypassOptions::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a PrivateEndpointConnectionProvisioningState> for &'a str { + fn from(e: &'a PrivateEndpointConnectionProvisioningState) -> Self { + match e { + PrivateEndpointConnectionProvisioningState::Creating => "Creating", + PrivateEndpointConnectionProvisioningState::Deleting => "Deleting", + PrivateEndpointConnectionProvisioningState::Disconnected => "Disconnected", + PrivateEndpointConnectionProvisioningState::Failed => "Failed", + PrivateEndpointConnectionProvisioningState::Succeeded => "Succeeded", + PrivateEndpointConnectionProvisioningState::Updating => "Updating", + PrivateEndpointConnectionProvisioningState::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for PrivateEndpointConnectionProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Creating" => PrivateEndpointConnectionProvisioningState::Creating, + "Deleting" => PrivateEndpointConnectionProvisioningState::Deleting, + "Disconnected" => PrivateEndpointConnectionProvisioningState::Disconnected, + "Failed" => PrivateEndpointConnectionProvisioningState::Failed, + "Succeeded" => PrivateEndpointConnectionProvisioningState::Succeeded, + "Updating" => PrivateEndpointConnectionProvisioningState::Updating, + _ => PrivateEndpointConnectionProvisioningState::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for PrivateEndpointConnectionProvisioningState { + fn as_ref(&self) -> &str { + match self { + PrivateEndpointConnectionProvisioningState::Creating => "Creating", + PrivateEndpointConnectionProvisioningState::Deleting => "Deleting", + PrivateEndpointConnectionProvisioningState::Disconnected => "Disconnected", + PrivateEndpointConnectionProvisioningState::Failed => "Failed", + PrivateEndpointConnectionProvisioningState::Succeeded => "Succeeded", + PrivateEndpointConnectionProvisioningState::Updating => "Updating", + PrivateEndpointConnectionProvisioningState::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for PrivateEndpointConnectionProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + PrivateEndpointConnectionProvisioningState::Creating => f.write_str("Creating"), + PrivateEndpointConnectionProvisioningState::Deleting => f.write_str("Deleting"), + PrivateEndpointConnectionProvisioningState::Disconnected => f.write_str("Disconnected"), + PrivateEndpointConnectionProvisioningState::Failed => f.write_str("Failed"), + PrivateEndpointConnectionProvisioningState::Succeeded => f.write_str("Succeeded"), + PrivateEndpointConnectionProvisioningState::Updating => f.write_str("Updating"), + PrivateEndpointConnectionProvisioningState::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a PrivateEndpointServiceConnectionStatus> for &'a str { + fn from(e: &'a PrivateEndpointServiceConnectionStatus) -> Self { + match e { + PrivateEndpointServiceConnectionStatus::Approved => "Approved", + PrivateEndpointServiceConnectionStatus::Disconnected => "Disconnected", + PrivateEndpointServiceConnectionStatus::Pending => "Pending", + PrivateEndpointServiceConnectionStatus::Rejected => "Rejected", + PrivateEndpointServiceConnectionStatus::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for PrivateEndpointServiceConnectionStatus { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Approved" => PrivateEndpointServiceConnectionStatus::Approved, + "Disconnected" => PrivateEndpointServiceConnectionStatus::Disconnected, + "Pending" => PrivateEndpointServiceConnectionStatus::Pending, + "Rejected" => PrivateEndpointServiceConnectionStatus::Rejected, + _ => PrivateEndpointServiceConnectionStatus::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for PrivateEndpointServiceConnectionStatus { + fn as_ref(&self) -> &str { + match self { + PrivateEndpointServiceConnectionStatus::Approved => "Approved", + PrivateEndpointServiceConnectionStatus::Disconnected => "Disconnected", + PrivateEndpointServiceConnectionStatus::Pending => "Pending", + PrivateEndpointServiceConnectionStatus::Rejected => "Rejected", + PrivateEndpointServiceConnectionStatus::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for PrivateEndpointServiceConnectionStatus { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + PrivateEndpointServiceConnectionStatus::Approved => f.write_str("Approved"), + PrivateEndpointServiceConnectionStatus::Disconnected => f.write_str("Disconnected"), + PrivateEndpointServiceConnectionStatus::Pending => f.write_str("Pending"), + PrivateEndpointServiceConnectionStatus::Rejected => f.write_str("Rejected"), + PrivateEndpointServiceConnectionStatus::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a ProvisioningState> for &'a str { + fn from(e: &'a ProvisioningState) -> Self { + match e { + ProvisioningState::Activated => "Activated", + ProvisioningState::Deleting => "Deleting", + ProvisioningState::Failed => "Failed", + ProvisioningState::Provisioning => "Provisioning", + ProvisioningState::Restoring => "Restoring", + ProvisioningState::SecurityDomainRestore => "SecurityDomainRestore", + ProvisioningState::Succeeded => "Succeeded", + ProvisioningState::Updating => "Updating", + ProvisioningState::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Activated" => ProvisioningState::Activated, + "Deleting" => ProvisioningState::Deleting, + "Failed" => ProvisioningState::Failed, + "Provisioning" => ProvisioningState::Provisioning, + "Restoring" => ProvisioningState::Restoring, + "SecurityDomainRestore" => ProvisioningState::SecurityDomainRestore, + "Succeeded" => ProvisioningState::Succeeded, + "Updating" => ProvisioningState::Updating, + _ => ProvisioningState::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ProvisioningState { + fn as_ref(&self) -> &str { + match self { + ProvisioningState::Activated => "Activated", + ProvisioningState::Deleting => "Deleting", + ProvisioningState::Failed => "Failed", + ProvisioningState::Provisioning => "Provisioning", + ProvisioningState::Restoring => "Restoring", + ProvisioningState::SecurityDomainRestore => "SecurityDomainRestore", + ProvisioningState::Succeeded => "Succeeded", + ProvisioningState::Updating => "Updating", + ProvisioningState::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ProvisioningState::Activated => f.write_str("Activated"), + ProvisioningState::Deleting => f.write_str("Deleting"), + ProvisioningState::Failed => f.write_str("Failed"), + ProvisioningState::Provisioning => f.write_str("Provisioning"), + ProvisioningState::Restoring => f.write_str("Restoring"), + ProvisioningState::SecurityDomainRestore => f.write_str("SecurityDomainRestore"), + ProvisioningState::Succeeded => f.write_str("Succeeded"), + ProvisioningState::Updating => f.write_str("Updating"), + ProvisioningState::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a PublicNetworkAccess> for &'a str { + fn from(e: &'a PublicNetworkAccess) -> Self { + match e { + PublicNetworkAccess::Disabled => "Disabled", + PublicNetworkAccess::Enabled => "Enabled", + PublicNetworkAccess::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for PublicNetworkAccess { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Disabled" => PublicNetworkAccess::Disabled, + "Enabled" => PublicNetworkAccess::Enabled, + _ => PublicNetworkAccess::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for PublicNetworkAccess { + fn as_ref(&self) -> &str { + match self { + PublicNetworkAccess::Disabled => "Disabled", + PublicNetworkAccess::Enabled => "Enabled", + PublicNetworkAccess::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for PublicNetworkAccess { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + PublicNetworkAccess::Disabled => f.write_str("Disabled"), + PublicNetworkAccess::Enabled => f.write_str("Enabled"), + PublicNetworkAccess::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a Reason> for &'a str { + fn from(e: &'a Reason) -> Self { + match e { + Reason::AccountNameInvalid => "AccountNameInvalid", + Reason::AlreadyExists => "AlreadyExists", + Reason::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for Reason { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "AccountNameInvalid" => Reason::AccountNameInvalid, + "AlreadyExists" => Reason::AlreadyExists, + _ => Reason::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for Reason { + fn as_ref(&self) -> &str { + match self { + Reason::AccountNameInvalid => "AccountNameInvalid", + Reason::AlreadyExists => "AlreadyExists", + Reason::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for Reason { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + Reason::AccountNameInvalid => f.write_str("AccountNameInvalid"), + Reason::AlreadyExists => f.write_str("AlreadyExists"), + Reason::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a ResourceProvisioningState> for &'a str { + fn from(e: &'a ResourceProvisioningState) -> Self { + match e { + ResourceProvisioningState::Canceled => "Canceled", + ResourceProvisioningState::Failed => "Failed", + ResourceProvisioningState::Succeeded => "Succeeded", + ResourceProvisioningState::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for ResourceProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Canceled" => ResourceProvisioningState::Canceled, + "Failed" => ResourceProvisioningState::Failed, + "Succeeded" => ResourceProvisioningState::Succeeded, + _ => ResourceProvisioningState::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for ResourceProvisioningState { + fn as_ref(&self) -> &str { + match self { + ResourceProvisioningState::Canceled => "Canceled", + ResourceProvisioningState::Failed => "Failed", + ResourceProvisioningState::Succeeded => "Succeeded", + ResourceProvisioningState::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for ResourceProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ResourceProvisioningState::Canceled => f.write_str("Canceled"), + ResourceProvisioningState::Failed => f.write_str("Failed"), + ResourceProvisioningState::Succeeded => f.write_str("Succeeded"), + ResourceProvisioningState::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a SecretPermissions> for &'a str { + fn from(e: &'a SecretPermissions) -> Self { + match e { + SecretPermissions::All => "all", + SecretPermissions::Backup => "backup", + SecretPermissions::Delete => "delete", + SecretPermissions::Get => "get", + SecretPermissions::List => "list", + SecretPermissions::Purge => "purge", + SecretPermissions::Recover => "recover", + SecretPermissions::Restore => "restore", + SecretPermissions::Set => "set", + SecretPermissions::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for SecretPermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "all" => SecretPermissions::All, + "backup" => SecretPermissions::Backup, + "delete" => SecretPermissions::Delete, + "get" => SecretPermissions::Get, + "list" => SecretPermissions::List, + "purge" => SecretPermissions::Purge, + "recover" => SecretPermissions::Recover, + "restore" => SecretPermissions::Restore, + "set" => SecretPermissions::Set, + _ => SecretPermissions::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for SecretPermissions { + fn as_ref(&self) -> &str { + match self { + SecretPermissions::All => "all", + SecretPermissions::Backup => "backup", + SecretPermissions::Delete => "delete", + SecretPermissions::Get => "get", + SecretPermissions::List => "list", + SecretPermissions::Purge => "purge", + SecretPermissions::Recover => "recover", + SecretPermissions::Restore => "restore", + SecretPermissions::Set => "set", + SecretPermissions::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for SecretPermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + SecretPermissions::All => f.write_str("all"), + SecretPermissions::Backup => f.write_str("backup"), + SecretPermissions::Delete => f.write_str("delete"), + SecretPermissions::Get => f.write_str("get"), + SecretPermissions::List => f.write_str("list"), + SecretPermissions::Purge => f.write_str("purge"), + SecretPermissions::Recover => f.write_str("recover"), + SecretPermissions::Restore => f.write_str("restore"), + SecretPermissions::Set => f.write_str("set"), + SecretPermissions::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a SkuFamily> for &'a str { + fn from(e: &'a SkuFamily) -> Self { + match e { + SkuFamily::A => "A", + SkuFamily::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for SkuFamily { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "A" => SkuFamily::A, + _ => SkuFamily::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for SkuFamily { + fn as_ref(&self) -> &str { + match self { + SkuFamily::A => "A", + SkuFamily::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for SkuFamily { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + SkuFamily::A => f.write_str("A"), + SkuFamily::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl FromStr for SkuName { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "premium" => SkuName::Premium, + "standard" => SkuName::Standard, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of SkuName found: \"{s}\"") + })) + } + }) + } +} + +impl AsRef for SkuName { + fn as_ref(&self) -> &str { + match self { + SkuName::Premium => "premium", + SkuName::Standard => "standard", + } + } +} + +impl Display for SkuName { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + SkuName::Premium => Display::fmt("premium", f), + SkuName::Standard => Display::fmt("standard", f), + } + } +} + +impl<'a> From<&'a StoragePermissions> for &'a str { + fn from(e: &'a StoragePermissions) -> Self { + match e { + StoragePermissions::All => "all", + StoragePermissions::Backup => "backup", + StoragePermissions::Delete => "delete", + StoragePermissions::Deletesas => "deletesas", + StoragePermissions::Get => "get", + StoragePermissions::Getsas => "getsas", + StoragePermissions::List => "list", + StoragePermissions::Listsas => "listsas", + StoragePermissions::Purge => "purge", + StoragePermissions::Recover => "recover", + StoragePermissions::Regeneratekey => "regeneratekey", + StoragePermissions::Restore => "restore", + StoragePermissions::Set => "set", + StoragePermissions::Setsas => "setsas", + StoragePermissions::Update => "update", + StoragePermissions::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for StoragePermissions { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "all" => StoragePermissions::All, + "backup" => StoragePermissions::Backup, + "delete" => StoragePermissions::Delete, + "deletesas" => StoragePermissions::Deletesas, + "get" => StoragePermissions::Get, + "getsas" => StoragePermissions::Getsas, + "list" => StoragePermissions::List, + "listsas" => StoragePermissions::Listsas, + "purge" => StoragePermissions::Purge, + "recover" => StoragePermissions::Recover, + "regeneratekey" => StoragePermissions::Regeneratekey, + "restore" => StoragePermissions::Restore, + "set" => StoragePermissions::Set, + "setsas" => StoragePermissions::Setsas, + "update" => StoragePermissions::Update, + _ => StoragePermissions::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for StoragePermissions { + fn as_ref(&self) -> &str { + match self { + StoragePermissions::All => "all", + StoragePermissions::Backup => "backup", + StoragePermissions::Delete => "delete", + StoragePermissions::Deletesas => "deletesas", + StoragePermissions::Get => "get", + StoragePermissions::Getsas => "getsas", + StoragePermissions::List => "list", + StoragePermissions::Listsas => "listsas", + StoragePermissions::Purge => "purge", + StoragePermissions::Recover => "recover", + StoragePermissions::Regeneratekey => "regeneratekey", + StoragePermissions::Restore => "restore", + StoragePermissions::Set => "set", + StoragePermissions::Setsas => "setsas", + StoragePermissions::Update => "update", + StoragePermissions::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for StoragePermissions { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + StoragePermissions::All => f.write_str("all"), + StoragePermissions::Backup => f.write_str("backup"), + StoragePermissions::Delete => f.write_str("delete"), + StoragePermissions::Deletesas => f.write_str("deletesas"), + StoragePermissions::Get => f.write_str("get"), + StoragePermissions::Getsas => f.write_str("getsas"), + StoragePermissions::List => f.write_str("list"), + StoragePermissions::Listsas => f.write_str("listsas"), + StoragePermissions::Purge => f.write_str("purge"), + StoragePermissions::Recover => f.write_str("recover"), + StoragePermissions::Regeneratekey => f.write_str("regeneratekey"), + StoragePermissions::Restore => f.write_str("restore"), + StoragePermissions::Set => f.write_str("set"), + StoragePermissions::Setsas => f.write_str("setsas"), + StoragePermissions::Update => f.write_str("update"), + StoragePermissions::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} + +impl<'a> From<&'a VaultProvisioningState> for &'a str { + fn from(e: &'a VaultProvisioningState) -> Self { + match e { + VaultProvisioningState::RegisteringDns => "RegisteringDns", + VaultProvisioningState::Succeeded => "Succeeded", + VaultProvisioningState::UnknownValue(s) => s.as_ref(), + } + } +} + +impl FromStr for VaultProvisioningState { + type Err = Infallible; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "RegisteringDns" => VaultProvisioningState::RegisteringDns, + "Succeeded" => VaultProvisioningState::Succeeded, + _ => VaultProvisioningState::UnknownValue(s.to_string()), + }) + } +} + +impl AsRef for VaultProvisioningState { + fn as_ref(&self) -> &str { + match self { + VaultProvisioningState::RegisteringDns => "RegisteringDns", + VaultProvisioningState::Succeeded => "Succeeded", + VaultProvisioningState::UnknownValue(s) => s.as_str(), + } + } +} + +impl Display for VaultProvisioningState { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + VaultProvisioningState::RegisteringDns => f.write_str("RegisteringDns"), + VaultProvisioningState::Succeeded => f.write_str("Succeeded"), + VaultProvisioningState::UnknownValue(s) => f.write_str(s.as_str()), + } + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_serde.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_serde.rs new file mode 100644 index 0000000000..da60c311d6 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_serde.rs @@ -0,0 +1,567 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use super::{ + AccessPolicyUpdateKind, ActionsRequired, ActivationStatus, CertificatePermissions, CreateMode, + CreatedByType, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, + JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, KeyPermissions, + KeyRotationPolicyActionType, ManagedHsmSkuFamily, ManagedHsmSkuNameV2, + ManagedServiceIdentityType, NetworkRuleAction, NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, + ProvisioningState, PublicNetworkAccess, Reason, ResourceProvisioningState, SecretPermissions, + SkuFamily, SkuName, StoragePermissions, VaultProvisioningState, +}; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +impl<'de> Deserialize<'de> for AccessPolicyUpdateKind { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for AccessPolicyUpdateKind { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ActionsRequired { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ActionsRequired { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ActivationStatus { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ActivationStatus { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for CertificatePermissions { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for CertificatePermissions { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for CreateMode { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for CreateMode { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for CreatedByType { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for CreatedByType { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for DeletionRecoveryLevel { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for DeletionRecoveryLevel { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for GeoReplicationRegionProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for GeoReplicationRegionProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for JsonWebKeyCurveName { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for JsonWebKeyCurveName { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for JsonWebKeyOperation { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for JsonWebKeyOperation { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for JsonWebKeyType { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for JsonWebKeyType { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for KeyPermissions { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for KeyPermissions { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for KeyRotationPolicyActionType { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for KeyRotationPolicyActionType { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ManagedHsmSkuFamily { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ManagedHsmSkuFamily { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ManagedHsmSkuNameV2 { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ManagedHsmSkuNameV2 { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ManagedServiceIdentityType { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ManagedServiceIdentityType { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for NetworkRuleAction { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for NetworkRuleAction { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for NetworkRuleBypassOptions { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for NetworkRuleBypassOptions { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for PrivateEndpointConnectionProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for PrivateEndpointConnectionProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for PrivateEndpointServiceConnectionStatus { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for PrivateEndpointServiceConnectionStatus { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for PublicNetworkAccess { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for PublicNetworkAccess { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for Reason { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for Reason { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for ResourceProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for ResourceProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for SecretPermissions { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for SecretPermissions { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for SkuFamily { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for SkuFamily { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for SkuName { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for SkuName { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for StoragePermissions { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for StoragePermissions { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} + +impl<'de> Deserialize<'de> for VaultProvisioningState { + fn deserialize(deserializer: D) -> ::core::result::Result + where + D: Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + s.parse().map_err(serde::de::Error::custom) + } +} + +impl Serialize for VaultProvisioningState { + fn serialize(&self, s: S) -> ::core::result::Result + where + S: Serializer, + { + s.serialize_str(self.as_ref()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/header_traits.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/header_traits.rs new file mode 100644 index 0000000000..a80db4b116 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/header_traits.rs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use super::{ + KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientBeginUpdateOperationStatus, + KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus, + KeyVaultVaultsClientBeginPurgeDeletedOperationStatus, MHSMPrivateEndpointConnection, + PrivateEndpointConnection, +}; +use azure_core::{ + http::{ + headers::{HeaderName, Headers}, + Response, + }, + Result, +}; + +const AZURE_ASYNCOPERATION: HeaderName = HeaderName::from_static("azure-asyncoperation"); +const LOCATION: HeaderName = HeaderName::from_static("location"); +const RETRY_AFTER: HeaderName = HeaderName::from_static("retry-after"); + +/// Provides access to typed response headers for [`KeyVaultMHSMPrivateEndpointConnectionsClient::begin_delete()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::begin_delete()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus, KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders: + private::Sealed +{ + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultManagedHsmsClient::begin_create_or_update()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_create_or_update()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus, KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders: + private::Sealed +{ + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultManagedHsmsClient::begin_delete()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_delete()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginDeleteOperationStatus, KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientBeginDeleteOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultManagedHsmsClient::begin_purge_deleted()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_purge_deleted()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus, KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders: + private::Sealed +{ + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultManagedHsmsClient::begin_update()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_update()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientBeginUpdateOperationStatus, KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientBeginUpdateOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultPrivateEndpointConnectionsClient::begin_delete()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::begin_delete()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus, KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders: + private::Sealed +{ + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultVaultsClient::begin_create_or_update()`](crate::generated::clients::KeyVaultVaultsClient::begin_create_or_update()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus, KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultVaultsClientBeginCreateOrUpdateOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultVaultsClient::begin_purge_deleted()`](crate::generated::clients::KeyVaultVaultsClient::begin_purge_deleted()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientBeginPurgeDeletedOperationStatus, KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(location) = response.location()? { +/// println!("location: {:?}", location); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultVaultsClientBeginPurgeDeletedOperationStatusHeaders + for Response +{ + /// The Location header contains the URL where the status of the long running operation can be checked. + fn location(&self) -> Result> { + Headers::get_optional_as(self.headers(), &LOCATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultMHSMPrivateEndpointConnectionsClient::put()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::put()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{MHSMPrivateEndpointConnection, MHSMPrivateEndpointConnectionHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(azure_async_operation) = response.azure_async_operation()? { +/// println!("azure-asyncoperation: {:?}", azure_async_operation); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait MHSMPrivateEndpointConnectionHeaders: private::Sealed { + fn azure_async_operation(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl MHSMPrivateEndpointConnectionHeaders for Response { + /// (specified only if operation does not finish synchronously) The URI to poll for completion status. The response of this + /// URI may be synchronous or asynchronous. + fn azure_async_operation(&self) -> Result> { + Headers::get_optional_as(self.headers(), &AZURE_ASYNCOPERATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +/// Provides access to typed response headers for [`KeyVaultPrivateEndpointConnectionsClient::put()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::put()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{PrivateEndpointConnection, PrivateEndpointConnectionHeaders}; +/// async fn example() -> Result<()> { +/// let response: Response = unimplemented!(); +/// // Access response headers +/// if let Some(azure_async_operation) = response.azure_async_operation()? { +/// println!("azure-asyncoperation: {:?}", azure_async_operation); +/// } +/// if let Some(retry_after) = response.retry_after()? { +/// println!("retry-after: {:?}", retry_after); +/// } +/// Ok(()) +/// } +/// ``` +pub trait PrivateEndpointConnectionHeaders: private::Sealed { + fn azure_async_operation(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl PrivateEndpointConnectionHeaders for Response { + /// (specified only if operation does not finish synchronously) The URI to poll for completion status. The response of this + /// URI may be synchronous or asynchronous. + fn azure_async_operation(&self) -> Result> { + Headers::get_optional_as(self.headers(), &AZURE_ASYNCOPERATION) + } + + /// The Retry-After header can indicate how long the client should wait before polling the operation status. + fn retry_after(&self) -> Result> { + Headers::get_optional_as(self.headers(), &RETRY_AFTER) + } +} + +mod private { + use super::{ + KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientBeginUpdateOperationStatus, + KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus, + KeyVaultVaultsClientBeginPurgeDeletedOperationStatus, MHSMPrivateEndpointConnection, + PrivateEndpointConnection, + }; + use azure_core::http::Response; + + pub trait Sealed {} + + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} + impl Sealed for Response {} +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/method_options.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/method_options.rs new file mode 100644 index 0000000000..d869d4011c --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/method_options.rs @@ -0,0 +1,663 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use azure_core::{ + fmt::SafeDebug, + http::{pager::PagerOptions, poller::resource_manager::PollerOptions, ClientMethodOptions}, +}; + +/// Options to be passed to [`KeyVaultKeysClient::create_if_not_exist()`](crate::generated::clients::KeyVaultKeysClient::create_if_not_exist()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultKeysClientCreateIfNotExistOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultKeysClient::get()`](crate::generated::clients::KeyVaultKeysClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultKeysClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultKeysClient::get_version()`](crate::generated::clients::KeyVaultKeysClient::get_version()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultKeysClientGetVersionOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultKeysClient::list()`](crate::generated::clients::KeyVaultKeysClient::list()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultKeysClientListOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultKeysClientListOptions<'_> { + /// Transforms this [`KeyVaultKeysClientListOptions`] into a new `KeyVaultKeysClientListOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultKeysClientListOptions<'static> { + KeyVaultKeysClientListOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultKeysClient::list_versions()`](crate::generated::clients::KeyVaultKeysClient::list_versions()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultKeysClientListVersionsOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultKeysClientListVersionsOptions<'_> { + /// Transforms this [`KeyVaultKeysClientListVersionsOptions`] into a new `KeyVaultKeysClientListVersionsOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultKeysClientListVersionsOptions<'static> { + KeyVaultKeysClientListVersionsOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultMHSMPrivateEndpointConnectionsClient::begin_delete()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::begin_delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions<'_> { + /// Transforms this [`KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions`] into a new `KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned( + self, + ) -> KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions<'static> { + KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultMHSMPrivateEndpointConnectionsClient::get()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultMHSMPrivateEndpointConnectionsClient::list_by_resource()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::list_by_resource()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions<'_> { + /// Transforms this [`KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions`] into a new `KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned( + self, + ) -> KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions<'static> { + KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultMHSMPrivateEndpointConnectionsClient::put()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::put()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClientPutOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultMHSMPrivateLinkResourcesClient::list_by_mhsm_resource()`](crate::generated::clients::KeyVaultMHSMPrivateLinkResourcesClient::list_by_mhsm_resource()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMPrivateLinkResourcesClientListByMhsmResourceOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultMHSMRegionsClient::list_by_resource()`](crate::generated::clients::KeyVaultMHSMRegionsClient::list_by_resource()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMRegionsClientListByResourceOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultMHSMRegionsClientListByResourceOptions<'_> { + /// Transforms this [`KeyVaultMHSMRegionsClientListByResourceOptions`] into a new `KeyVaultMHSMRegionsClientListByResourceOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultMHSMRegionsClientListByResourceOptions<'static> { + KeyVaultMHSMRegionsClientListByResourceOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmKeysClient::create_if_not_exist()`](crate::generated::clients::KeyVaultManagedHsmKeysClient::create_if_not_exist()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmKeysClientCreateIfNotExistOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultManagedHsmKeysClient::get()`](crate::generated::clients::KeyVaultManagedHsmKeysClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmKeysClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultManagedHsmKeysClient::get_version()`](crate::generated::clients::KeyVaultManagedHsmKeysClient::get_version()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmKeysClientGetVersionOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultManagedHsmKeysClient::list()`](crate::generated::clients::KeyVaultManagedHsmKeysClient::list()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmKeysClientListOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultManagedHsmKeysClientListOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmKeysClientListOptions`] into a new `KeyVaultManagedHsmKeysClientListOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmKeysClientListOptions<'static> { + KeyVaultManagedHsmKeysClientListOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmKeysClient::list_versions()`](crate::generated::clients::KeyVaultManagedHsmKeysClient::list_versions()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmKeysClientListVersionsOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultManagedHsmKeysClientListVersionsOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmKeysClientListVersionsOptions`] into a new `KeyVaultManagedHsmKeysClientListVersionsOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmKeysClientListVersionsOptions<'static> { + KeyVaultManagedHsmKeysClientListVersionsOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::begin_create_or_update()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_create_or_update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions`] into a new `KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions<'static> { + KeyVaultManagedHsmsClientBeginCreateOrUpdateOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::begin_delete()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientBeginDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientBeginDeleteOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientBeginDeleteOptions`] into a new `KeyVaultManagedHsmsClientBeginDeleteOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginDeleteOptions<'static> { + KeyVaultManagedHsmsClientBeginDeleteOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::begin_purge_deleted()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_purge_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientBeginPurgeDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientBeginPurgeDeletedOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientBeginPurgeDeletedOptions`] into a new `KeyVaultManagedHsmsClientBeginPurgeDeletedOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginPurgeDeletedOptions<'static> { + KeyVaultManagedHsmsClientBeginPurgeDeletedOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::begin_update()`](crate::generated::clients::KeyVaultManagedHsmsClient::begin_update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientBeginUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientBeginUpdateOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientBeginUpdateOptions`] into a new `KeyVaultManagedHsmsClientBeginUpdateOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientBeginUpdateOptions<'static> { + KeyVaultManagedHsmsClientBeginUpdateOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::check_mhsm_name_availability()`](crate::generated::clients::KeyVaultManagedHsmsClient::check_mhsm_name_availability()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientCheckMhsmNameAvailabilityOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::get_deleted()`](crate::generated::clients::KeyVaultManagedHsmsClient::get_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientGetDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::get()`](crate::generated::clients::KeyVaultManagedHsmsClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::list_by_resource_group()`](crate::generated::clients::KeyVaultManagedHsmsClient::list_by_resource_group()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientListByResourceGroupOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, + + /// Maximum number of results to return. + pub top: Option, +} + +impl KeyVaultManagedHsmsClientListByResourceGroupOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientListByResourceGroupOptions`] into a new `KeyVaultManagedHsmsClientListByResourceGroupOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientListByResourceGroupOptions<'static> { + KeyVaultManagedHsmsClientListByResourceGroupOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + top: self.top, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::list_by_subscription()`](crate::generated::clients::KeyVaultManagedHsmsClient::list_by_subscription()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientListBySubscriptionOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, + + /// Maximum number of results to return. + pub top: Option, +} + +impl KeyVaultManagedHsmsClientListBySubscriptionOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientListBySubscriptionOptions`] into a new `KeyVaultManagedHsmsClientListBySubscriptionOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientListBySubscriptionOptions<'static> { + KeyVaultManagedHsmsClientListBySubscriptionOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + top: self.top, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::list_deleted()`](crate::generated::clients::KeyVaultManagedHsmsClient::list_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientListDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientListDeletedOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientListDeletedOptions`] into a new `KeyVaultManagedHsmsClientListDeletedOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientListDeletedOptions<'static> { + KeyVaultManagedHsmsClientListDeletedOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultOperationsClient::list()`](crate::generated::clients::KeyVaultOperationsClient::list()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultOperationsClientListOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultOperationsClientListOptions<'_> { + /// Transforms this [`KeyVaultOperationsClientListOptions`] into a new `KeyVaultOperationsClientListOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultOperationsClientListOptions<'static> { + KeyVaultOperationsClientListOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultPrivateEndpointConnectionsClient::begin_delete()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::begin_delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions<'_> { + /// Transforms this [`KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions`] into a new `KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions<'static> { + KeyVaultPrivateEndpointConnectionsClientBeginDeleteOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultPrivateEndpointConnectionsClient::get()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultPrivateEndpointConnectionsClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultPrivateEndpointConnectionsClient::list_by_resource()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::list_by_resource()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultPrivateEndpointConnectionsClientListByResourceOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultPrivateEndpointConnectionsClientListByResourceOptions<'_> { + /// Transforms this [`KeyVaultPrivateEndpointConnectionsClientListByResourceOptions`] into a new `KeyVaultPrivateEndpointConnectionsClientListByResourceOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned( + self, + ) -> KeyVaultPrivateEndpointConnectionsClientListByResourceOptions<'static> { + KeyVaultPrivateEndpointConnectionsClientListByResourceOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultPrivateEndpointConnectionsClient::put()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::put()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultPrivateEndpointConnectionsClientPutOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultPrivateLinkResourcesClient::list_by_vault()`](crate::generated::clients::KeyVaultPrivateLinkResourcesClient::list_by_vault()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultPrivateLinkResourcesClientListByVaultOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultSecretsClient::create_or_update()`](crate::generated::clients::KeyVaultSecretsClient::create_or_update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultSecretsClientCreateOrUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultSecretsClient::get()`](crate::generated::clients::KeyVaultSecretsClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultSecretsClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultSecretsClient::list()`](crate::generated::clients::KeyVaultSecretsClient::list()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultSecretsClientListOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, + + /// Maximum number of results to return. + pub top: Option, +} + +impl KeyVaultSecretsClientListOptions<'_> { + /// Transforms this [`KeyVaultSecretsClientListOptions`] into a new `KeyVaultSecretsClientListOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultSecretsClientListOptions<'static> { + KeyVaultSecretsClientListOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + top: self.top, + } + } +} + +/// Options to be passed to [`KeyVaultSecretsClient::update()`](crate::generated::clients::KeyVaultSecretsClient::update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultSecretsClientUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultVaultsClient::begin_create_or_update()`](crate::generated::clients::KeyVaultVaultsClient::begin_create_or_update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientBeginCreateOrUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultVaultsClientBeginCreateOrUpdateOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientBeginCreateOrUpdateOptions`] into a new `KeyVaultVaultsClientBeginCreateOrUpdateOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientBeginCreateOrUpdateOptions<'static> { + KeyVaultVaultsClientBeginCreateOrUpdateOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultVaultsClient::begin_purge_deleted()`](crate::generated::clients::KeyVaultVaultsClient::begin_purge_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientBeginPurgeDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultVaultsClientBeginPurgeDeletedOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientBeginPurgeDeletedOptions`] into a new `KeyVaultVaultsClientBeginPurgeDeletedOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientBeginPurgeDeletedOptions<'static> { + KeyVaultVaultsClientBeginPurgeDeletedOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultVaultsClient::check_name_availability()`](crate::generated::clients::KeyVaultVaultsClient::check_name_availability()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientCheckNameAvailabilityOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultVaultsClient::delete()`](crate::generated::clients::KeyVaultVaultsClient::delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultVaultsClient::get_deleted()`](crate::generated::clients::KeyVaultVaultsClient::get_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientGetDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultVaultsClient::get()`](crate::generated::clients::KeyVaultVaultsClient::get()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientGetOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultVaultsClient::list_by_resource_group()`](crate::generated::clients::KeyVaultVaultsClient::list_by_resource_group()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientListByResourceGroupOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, + + /// Maximum number of results to return. + pub top: Option, +} + +impl KeyVaultVaultsClientListByResourceGroupOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientListByResourceGroupOptions`] into a new `KeyVaultVaultsClientListByResourceGroupOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientListByResourceGroupOptions<'static> { + KeyVaultVaultsClientListByResourceGroupOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + top: self.top, + } + } +} + +/// Options to be passed to [`KeyVaultVaultsClient::list_by_subscription()`](crate::generated::clients::KeyVaultVaultsClient::list_by_subscription()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientListBySubscriptionOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, + + /// Maximum number of results to return. + pub top: Option, +} + +impl KeyVaultVaultsClientListBySubscriptionOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientListBySubscriptionOptions`] into a new `KeyVaultVaultsClientListBySubscriptionOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientListBySubscriptionOptions<'static> { + KeyVaultVaultsClientListBySubscriptionOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + top: self.top, + } + } +} + +/// Options to be passed to [`KeyVaultVaultsClient::list_deleted()`](crate::generated::clients::KeyVaultVaultsClient::list_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientListDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, +} + +impl KeyVaultVaultsClientListDeletedOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientListDeletedOptions`] into a new `KeyVaultVaultsClientListDeletedOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientListDeletedOptions<'static> { + KeyVaultVaultsClientListDeletedOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultVaultsClient::list()`](crate::generated::clients::KeyVaultVaultsClient::list()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientListOptions<'a> { + /// Allows customization of the method call. + pub method_options: PagerOptions<'a>, + + /// Maximum number of results to return. + pub top: Option, +} + +impl KeyVaultVaultsClientListOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientListOptions`] into a new `KeyVaultVaultsClientListOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientListOptions<'static> { + KeyVaultVaultsClientListOptions { + method_options: PagerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + top: self.top, + } + } +} + +/// Options to be passed to [`KeyVaultVaultsClient::update_access_policy()`](crate::generated::clients::KeyVaultVaultsClient::update_access_policy()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientUpdateAccessPolicyOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} + +/// Options to be passed to [`KeyVaultVaultsClient::update()`](crate::generated::clients::KeyVaultVaultsClient::update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: ClientMethodOptions<'a>, +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/mod.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/mod.rs new file mode 100644 index 0000000000..f5a684bdf2 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/mod.rs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +mod enums; +mod enums_impl; +mod enums_serde; +mod header_traits; +mod method_options; +#[allow(clippy::module_inception)] +mod models; +mod models_impl; +mod models_serde; +pub use enums::*; +pub use header_traits::*; +pub use method_options::*; +pub use models::*; diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models.rs new file mode 100644 index 0000000000..c6c8db575b --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models.rs @@ -0,0 +1,2874 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use super::{ + models_serde, ActionsRequired, ActivationStatus, CertificatePermissions, CreateMode, + CreatedByType, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, + JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, KeyPermissions, + KeyRotationPolicyActionType, ManagedHsmSkuFamily, ManagedHsmSkuNameV2, + ManagedServiceIdentityType, NetworkRuleAction, NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, + ProvisioningState, PublicNetworkAccess, Reason, ResourceProvisioningState, SecretPermissions, + SkuFamily, SkuName, StoragePermissions, VaultProvisioningState, +}; +use azure_core::{base64, fmt::SafeDebug, http::Etag, time::OffsetDateTime, Value}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +/// An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's +/// tenant ID. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct AccessPolicyEntry { + /// Application ID of the client making request on behalf of a principal + #[serde(rename = "applicationId", skip_serializing_if = "Option::is_none")] + pub application_id: Option, + + /// The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object + /// ID must be unique for the list of access policies. + #[serde(rename = "objectId", skip_serializing_if = "Option::is_none")] + pub object_id: Option, + + /// Permissions the identity has for keys, secrets and certificates. + #[serde(skip_serializing_if = "Option::is_none")] + pub permissions: Option, + + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct Action { + /// The type of action. + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, +} + +/// The parameters used to check the availability of the managed hsm name. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct CheckMhsmNameAvailabilityParameters { + /// The managed hsm name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, +} + +/// The CheckMhsmNameAvailability operation response. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct CheckMhsmNameAvailabilityResult { + /// An error message explaining the Reason value in more detail. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub message: Option, + + /// A boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, + /// the name has already been taken or is invalid and cannot be used. + /// + /// Operational visibility: Read + #[serde(rename = "nameAvailable", skip_serializing)] + pub name_available: Option, + + /// The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub reason: Option, +} + +/// The CheckNameAvailability operation response. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct CheckNameAvailabilityResult { + /// An error message explaining the Reason value in more detail. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub message: Option, + + /// A boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, + /// the name has already been taken or is invalid and cannot be used. + /// + /// Operational visibility: Read + #[serde(rename = "nameAvailable", skip_serializing)] + pub name_available: Option, + + /// The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub reason: Option, +} + +/// An error response from Key Vault resource provider +#[derive(Clone, Deserialize, SafeDebug, Serialize)] +pub struct CloudError { + /// An error response from Key Vault resource provider + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, +} + +/// An error response from Key Vault resource provider +#[derive(Clone, Deserialize, SafeDebug, Serialize)] +pub struct CloudErrorBody { + /// Error code. This is a mnemonic that can be consumed programmatically. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + + /// User friendly error message. The message is typically localized and may vary with service version. + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +/// Concrete proxy resource types can be created by aliasing this type using a specific property type. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DeletedManagedHsm { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// The name of the deleted managed HSM. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Properties of the deleted managed HSM + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// The response of a DeletedManagedHsm list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DeletedManagedHsmListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The DeletedManagedHsm items on this page + #[serde(default)] + pub value: Vec, +} + +/// Properties of the deleted managed HSM. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DeletedManagedHsmProperties { + /// The deleted date. + /// + /// Operational visibility: Read + #[serde( + default, + rename = "deletionDate", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub deletion_date: Option, + + /// The location of the original managed HSM. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// The resource id of the original managed HSM. + /// + /// Operational visibility: Read + #[serde(rename = "mhsmId", skip_serializing)] + pub mhsm_id: Option, + + /// Purge protection status of the original managed HSM. + /// + /// Operational visibility: Read + #[serde(rename = "purgeProtectionEnabled", skip_serializing)] + pub purge_protection_enabled: Option, + + /// The scheduled purged date. + /// + /// Operational visibility: Read + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub scheduled_purge_date: Option, + + /// Tags of the original managed HSM. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub tags: Option>, +} + +/// Deleted vault information with extended details. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DeletedVault { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// The name of the vault. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Properties of the vault + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// The response of a DeletedVault list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DeletedVaultListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The DeletedVault items on this page + #[serde(default)] + pub value: Vec, +} + +/// Properties of the deleted vault. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DeletedVaultProperties { + /// The deleted date. + /// + /// Operational visibility: Read + #[serde( + default, + rename = "deletionDate", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub deletion_date: Option, + + /// The location of the original vault. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// Purge protection status of the original vault. + /// + /// Operational visibility: Read + #[serde(rename = "purgeProtectionEnabled", skip_serializing)] + pub purge_protection_enabled: Option, + + /// The scheduled purged date. + /// + /// Operational visibility: Read + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub scheduled_purge_date: Option, + + /// Tags of the original vault. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub tags: Option>, + + /// The resource id of the original vault. + /// + /// Operational visibility: Read + #[serde(rename = "vaultId", skip_serializing)] + pub vault_id: Option, +} + +/// Type of operation: get, read, delete, etc. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct DimensionProperties { + /// Display name of dimension. + #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] + pub display_name: Option, + + /// Name of dimension. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// Property to specify whether the dimension should be exported for Shoebox. + #[serde( + rename = "toBeExportedForShoebox", + skip_serializing_if = "Option::is_none" + )] + pub to_be_exported_for_shoebox: Option, +} + +/// The server error. +#[derive(Clone, Deserialize, SafeDebug, Serialize)] +pub struct Error { + /// The error code. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub code: Option, + + /// The inner error, contains a more specific error code. + /// + /// Operational visibility: Read + #[serde(rename = "innererror", skip_serializing)] + pub inner_error: Option>, + + /// The error message. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub message: Option, +} + +/// The resource management error additional info. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ErrorAdditionalInfo { + /// The additional info. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub info: Option, + + /// The additional info type. + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// The error detail. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ErrorDetail { + /// The error additional info. + /// + /// Operational visibility: Read + #[serde(rename = "additionalInfo", skip_serializing)] + pub additional_info: Option>, + + /// The error code. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub code: Option, + + /// The error details. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub details: Option>, + + /// The error message. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub message: Option, + + /// The error target. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub target: Option, +} + +/// A rule governing the accessibility of a vault from a specific ip address or ip range. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct IPRule { + /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses + /// that start with 124.56.78). + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +/// The key resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct Key { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// The supported Azure location where the managed HSM Pool should be created. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// The name of the key to be retrieved. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The properties of the key. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Resource tags + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// The object attributes managed by the Azure Key Vault service. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct KeyAttributes { + /// Creation time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub created: Option, + + /// Determines whether or not the object is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + + /// Expiry date in seconds since 1970-01-01T00:00:00Z. + #[serde(rename = "exp", skip_serializing_if = "Option::is_none")] + pub expires: Option, + + /// Indicates if the private key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub exportable: Option, + + /// Not before date in seconds since 1970-01-01T00:00:00Z. + #[serde(rename = "nbf", skip_serializing_if = "Option::is_none")] + pub not_before: Option, + + /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently + /// deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. + /// + /// Operational visibility: Read + #[serde(rename = "recoveryLevel", skip_serializing)] + pub recovery_level: Option, + + /// Last updated time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub updated: Option, +} + +/// The parameters used to create a key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct KeyCreateParameters { + /// The properties of the key to be created. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The tags that will be assigned to the key. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The response of a Key list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The Key items on this page + #[serde(default)] + pub value: Vec, +} + +/// The properties of the key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct KeyProperties { + /// The attributes of the key. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys is P-256 + #[serde(rename = "curveName", skip_serializing_if = "Option::is_none")] + pub curve_name: Option, + + #[serde(rename = "keyOps", skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + + /// The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA and RSA-HSM keys is 2048. Exception made + /// for bring your own key (BYOK), key exchange keys default to 4096. + #[serde(rename = "keySize", skip_serializing_if = "Option::is_none")] + pub key_size: Option, + + /// The URI to retrieve the current version of the key. + /// + /// Operational visibility: Read + #[serde(rename = "keyUri", skip_serializing)] + pub key_uri: Option, + + /// The URI to retrieve the specific version of the key. + /// + /// Operational visibility: Read + #[serde(rename = "keyUriWithVersion", skip_serializing)] + pub key_uri_with_version: Option, + + /// The type of the key. For valid values, see JsonWebKeyType. + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + + /// Key release policy in response. It will be used for both output and input. Omitted if empty + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// Key rotation policy in response. It will be used for both output and input. Omitted if empty + #[serde(rename = "rotationPolicy", skip_serializing_if = "Option::is_none")] + pub rotation_policy: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct KeyReleasePolicy { + /// Content type and version of key release policy + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + + /// Blob encoding the policy rules under which the key can be released. + #[serde( + default, + deserialize_with = "base64::option::deserialize_url_safe", + serialize_with = "base64::option::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub data: Option>, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct KeyRotationPolicyAttributes { + /// Creation time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub created: Option, + + /// The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. + #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + + /// Last updated time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub updated: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultManagedHsmsClientBeginDeleteOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultManagedHsmsClientBeginUpdateOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// Standard Azure Resource Manager operation status response, used as the response +/// body for `GetResourceOperationStatus`. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct KeyVaultVaultsClientBeginPurgeDeletedOperationStatus { + /// Operation complete time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "endTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub end_time: Option, + + /// Errors that occurred if the operation ended with Canceled or Failed status + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, + + /// The unique identifier for the operationStatus resource + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// The name of the operationStatus resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The progress made toward completing the operation + /// + /// Operational visibility: Read + #[serde(rename = "percentComplete", skip_serializing)] + pub percent_complete: Option, + + /// Operation start time + /// + /// Operational visibility: Read + #[serde( + default, + rename = "startTime", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub start_time: Option, + + /// The operation status + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct LifetimeAction { + /// The action of key rotation policy lifetimeAction. + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + + /// The trigger of key rotation policy lifetimeAction. + #[serde(skip_serializing_if = "Option::is_none")] + pub trigger: Option, +} + +/// Log specification of operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct LogSpecification { + /// Blob duration of specification. + #[serde(rename = "blobDuration", skip_serializing_if = "Option::is_none")] + pub blob_duration: Option, + + /// Display name of log specification. + #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] + pub display_name: Option, + + /// Name of log specification. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, +} + +/// A region that this managed HSM Pool has been extended to. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMGeoReplicatedRegion { + /// A boolean value that indicates whether the region is the primary region or a secondary region. + #[serde(rename = "isPrimary", skip_serializing_if = "Option::is_none")] + pub is_primary: Option, + + /// Name of the geo replicated region. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// Provisioning state of the geo replicated region. + /// + /// Operational visibility: Read + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, +} + +/// A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMIPRule { + /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses + /// that start with 124.56.78). + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +/// A set of rules governing the network accessibility of a managed hsm pool. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMNetworkRuleSet { + /// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. + #[serde(skip_serializing_if = "Option::is_none")] + pub bypass: Option, + + /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property + /// has been evaluated. + #[serde(rename = "defaultAction", skip_serializing_if = "Option::is_none")] + pub default_action: Option, + + /// The list of IP address rules. + #[serde(rename = "ipRules", skip_serializing_if = "Option::is_none")] + pub ip_rules: Option>, + + /// The list of service tags. + #[serde(rename = "serviceTags", skip_serializing_if = "Option::is_none")] + pub service_tags: Option>, + + /// The list of virtual network rules. + #[serde( + rename = "virtualNetworkRules", + skip_serializing_if = "Option::is_none" + )] + pub virtual_network_rules: Option>, +} + +/// Private endpoint object properties. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMPrivateEndpoint { + /// Full identifier of the private endpoint resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, +} + +/// Private endpoint connection resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMPrivateEndpointConnection { + /// Modified whenever there is a change in the state of private endpoint connection. + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Managed service identity + #[serde(skip_serializing_if = "Option::is_none")] + pub identity: Option, + + /// The geo-location where the resource lives + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + + /// Name of the private endpoint connection associated with the managed hsm pool. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Resource properties. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// SKU details + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Resource tags. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// Private endpoint connection item. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MHSMPrivateEndpointConnectionItem { + /// Modified whenever there is a change in the state of private endpoint connection. + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + + /// Id of private endpoint connection. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// Private endpoint connection properties. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, +} + +/// Properties of the private endpoint connection resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMPrivateEndpointConnectionProperties { + /// Properties of the private endpoint object. + #[serde(rename = "privateEndpoint", skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + + /// Approval state of the private link connection. + #[serde( + rename = "privateLinkServiceConnectionState", + skip_serializing_if = "Option::is_none" + )] + pub private_link_service_connection_state: Option, + + /// Provisioning state of the private endpoint connection. + /// + /// Operational visibility: Read + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, +} + +/// List of private endpoint connections associated with a managed HSM Pools +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MHSMPrivateEndpointConnectionsListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The MhsmPrivateEndpointConnection items on this page + #[serde(default)] + pub value: Vec, +} + +/// A private link resource +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MHSMPrivateLinkResource { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Managed service identity (system assigned and/or user assigned identities) + #[serde(skip_serializing_if = "Option::is_none")] + pub identity: Option, + + /// The geo-location where the resource lives + /// + /// Operational visibility: Create, Read + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + + /// The name of the resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Resource properties. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// SKU details + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Resource tags. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// A list of private link resources +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MHSMPrivateLinkResourceListResult { + /// Array of private link resources + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, +} + +/// Properties of a private link resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MHSMPrivateLinkResourceProperties { + /// Group identifier of private link resource. + /// + /// Operational visibility: Read + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + + /// Required member names of private link resource. + /// + /// Operational visibility: Read + #[serde(rename = "requiredMembers", skip_serializing)] + pub required_members: Option>, + + /// Required DNS zone names of the the private link resource. + #[serde(rename = "requiredZoneNames", skip_serializing_if = "Option::is_none")] + pub required_zone_names: Option>, +} + +/// An object that represents the approval state of the private link connection. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMPrivateLinkServiceConnectionState { + /// A message indicating if changes on the service provider require any updates on the consumer. + #[serde(rename = "actionsRequired", skip_serializing_if = "Option::is_none")] + pub actions_required: Option, + + /// The reason for approval or rejection. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + + /// Indicates whether the connection has been approved, rejected or removed by the key vault owner. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// List of regions associated with a managed HSM Pools +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MHSMRegionsListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The MhsmGeoReplicatedRegion items on this page + #[serde(default)] + pub value: Vec, +} + +/// A rule governing the accessibility of a managed hsm pool from a specific service tags. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMServiceTagRule { + /// Name of the service tag. + #[serde(skip_serializing_if = "Option::is_none")] + pub tag: Option, +} + +/// A rule governing the accessibility of a managed hsm pool from a specific virtual network. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct MHSMVirtualNetworkRule { + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, +} + +/// The security domain properties of the managed hsm. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ManagedHSMSecurityDomainProperties { + /// Activation Status + /// + /// Operational visibility: Read + #[serde(rename = "activationStatus", skip_serializing)] + pub activation_status: Option, + + /// Activation Status Message. + /// + /// Operational visibility: Read + #[serde(rename = "activationStatusMessage", skip_serializing)] + pub activation_status_message: Option, +} + +/// Resource information with extended details. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsm { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Managed service identity + #[serde(skip_serializing_if = "Option::is_none")] + pub identity: Option, + + /// The geo-location where the resource lives + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + + /// The name of the managed HSM Pool. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Properties of the managed HSM + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// SKU details + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Resource tags. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmAction { + /// The type of action. + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, +} + +/// The error exception. +#[derive(Clone, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmError { + /// The server error. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub error: Option, +} + +/// The key resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ManagedHsmKey { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. + /// The value provided should not include personally identifiable or sensitive information. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// The properties of the key. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Resource tags + /// + /// Operational visibility: Create, Read, Update + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// The object attributes managed by the Azure Key Vault service. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmKeyAttributes { + /// Creation time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub created: Option, + + /// Determines whether or not the object is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + + /// Expiry date in seconds since 1970-01-01T00:00:00Z. + #[serde(rename = "exp", skip_serializing_if = "Option::is_none")] + pub expires: Option, + + /// Indicates if the private key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub exportable: Option, + + /// Not before date in seconds since 1970-01-01T00:00:00Z. + #[serde(rename = "nbf", skip_serializing_if = "Option::is_none")] + pub not_before: Option, + + /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently + /// deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. + /// + /// Operational visibility: Read + #[serde(rename = "recoveryLevel", skip_serializing)] + pub recovery_level: Option, + + /// Last updated time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub updated: Option, +} + +/// The parameters used to create a key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmKeyCreateParameters { + /// The properties of the key to be created. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The tags that will be assigned to the key. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The response of a ManagedHsmKey list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ManagedHsmKeyListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The ManagedHsmKey items on this page + #[serde(default)] + pub value: Vec, +} + +/// The properties of the key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmKeyProperties { + /// The attributes of the key. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys is P-256 + #[serde(rename = "curveName", skip_serializing_if = "Option::is_none")] + pub curve_name: Option, + + #[serde(rename = "keyOps", skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + + /// The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA and RSA-HSM keys is 2048. Exception made + /// for bring your own key (BYOK), key exchange keys default to 4096. + #[serde(rename = "keySize", skip_serializing_if = "Option::is_none")] + pub key_size: Option, + + /// The URI to retrieve the current version of the key. + /// + /// Operational visibility: Read + #[serde(rename = "keyUri", skip_serializing)] + pub key_uri: Option, + + /// The URI to retrieve the specific version of the key. + /// + /// Operational visibility: Read + #[serde(rename = "keyUriWithVersion", skip_serializing)] + pub key_uri_with_version: Option, + + /// The type of the key. For valid values, see JsonWebKeyType. + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + + /// Key release policy in response. It will be used for both output and input. Omitted if empty + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// Key rotation policy in response. It will be used for both output and input. Omitted if empty + #[serde(rename = "rotationPolicy", skip_serializing_if = "Option::is_none")] + pub rotation_policy: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmKeyReleasePolicy { + /// Content type and version of key release policy + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + + /// Blob encoding the policy rules under which the key can be released. + #[serde( + default, + deserialize_with = "base64::option::deserialize_url_safe", + serialize_with = "base64::option::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub data: Option>, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmKeyRotationPolicyAttributes { + /// Creation time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub created: Option, + + /// The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. + #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + + /// Last updated time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub updated: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmLifetimeAction { + /// The action of key rotation policy lifetimeAction. + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + + /// The trigger of key rotation policy lifetimeAction. + #[serde(skip_serializing_if = "Option::is_none")] + pub trigger: Option, +} + +/// The response of a ManagedHsm list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ManagedHsmListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The ManagedHsm items on this page + #[serde(default)] + pub value: Vec, +} + +/// Properties of the managed HSM Pool +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmProperties { + /// The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. + /// + /// Operational visibility: Create, Update + #[serde(rename = "createMode", skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + + /// Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true + /// activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate + /// a hard, irrecoverable deletion. Enabling this functionality is irreversible. + #[serde( + rename = "enablePurgeProtection", + skip_serializing_if = "Option::is_none" + )] + pub enable_purge_protection: Option, + + /// Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. Soft delete is enabled + /// by default for all managed HSMs and is immutable. + #[serde(rename = "enableSoftDelete", skip_serializing_if = "Option::is_none")] + pub enable_soft_delete: Option, + + /// The URI of the managed hsm pool for performing operations on keys. + /// + /// Operational visibility: Read + #[serde(rename = "hsmUri", skip_serializing)] + pub hsm_uri: Option, + + /// Array of initial administrators object ids for this managed hsm pool. + #[serde( + rename = "initialAdminObjectIds", + skip_serializing_if = "Option::is_none" + )] + pub initial_admin_object_ids: Option>, + + /// Rules governing the accessibility of the key vault from specific network locations. + #[serde(rename = "networkAcls", skip_serializing_if = "Option::is_none")] + pub network_acls: Option, + + /// List of private endpoint connections associated with the managed hsm pool. + /// + /// Operational visibility: Read + #[serde(rename = "privateEndpointConnections", skip_serializing)] + pub private_endpoint_connections: Option>, + + /// Provisioning state. + /// + /// Operational visibility: Read + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + + /// Control permission to the managed HSM from public networks. + #[serde( + rename = "publicNetworkAccess", + skip_serializing_if = "Option::is_none" + )] + pub public_network_access: Option, + + /// List of all regions associated with the managed hsm pool. + #[serde(skip_serializing_if = "Option::is_none")] + pub regions: Option>, + + /// The scheduled purge date in UTC. + /// + /// Operational visibility: Read + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing, + with = "azure_core::time::rfc3339::option" + )] + pub scheduled_purge_date: Option, + + /// Managed HSM security domain properties. + /// + /// Operational visibility: Read + #[serde(rename = "securityDomainProperties", skip_serializing)] + pub security_domain_properties: Option, + + /// Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable for the configured retention + /// period or for a default period of 90 days. It accepts values between 7 and 90. + #[serde( + rename = "softDeleteRetentionInDays", + skip_serializing_if = "Option::is_none" + )] + pub soft_delete_retention_in_days: Option, + + /// Resource Status Message. + /// + /// Operational visibility: Read + #[serde(rename = "statusMessage", skip_serializing)] + pub status_message: Option, + + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmRotationPolicy { + /// The attributes of key rotation policy. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The lifetimeActions for key rotation action. + #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] + pub lifetime_actions: Option>, +} + +/// SKU details +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmSku { + /// SKU Family of the managed HSM Pool + #[serde(skip_serializing_if = "Option::is_none")] + pub family: Option, + + /// SKU of the managed HSM Pool + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedHsmTrigger { + /// The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. + /// Eg: 'P90D', 'P1Y'. + #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] + pub time_after_create: Option, + + /// The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] + pub time_before_expiry: Option, +} + +/// Managed service identity (system assigned and/or user assigned identities) +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct ManagedServiceIdentity { + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// + /// Operational visibility: Read + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, + + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// + /// Operational visibility: Read + #[serde(rename = "tenantId", skip_serializing)] + pub tenant_id: Option, + + /// The type of managed identity assigned to this resource. + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, + + /// The identities assigned to this resource by the user. + #[serde( + rename = "userAssignedIdentities", + skip_serializing_if = "Option::is_none" + )] + pub user_assigned_identities: Option>, +} + +/// Metric specification of operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct MetricSpecification { + /// The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. + #[serde(rename = "aggregationType", skip_serializing_if = "Option::is_none")] + pub aggregation_type: Option, + + /// The dimensions of metric + #[serde(skip_serializing_if = "Option::is_none")] + pub dimensions: Option>, + + /// Display description of metric specification. + #[serde(rename = "displayDescription", skip_serializing_if = "Option::is_none")] + pub display_description: Option, + + /// Display name of metric specification. + #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] + pub display_name: Option, + + /// Property to specify whether to fill gap with zero. + #[serde(rename = "fillGapWithZero", skip_serializing_if = "Option::is_none")] + pub fill_gap_with_zero: Option, + + /// The internal metric name. + #[serde(rename = "internalMetricName", skip_serializing_if = "Option::is_none")] + pub internal_metric_name: Option, + + /// The metric lock aggregation type. + #[serde( + rename = "lockAggregationType", + skip_serializing_if = "Option::is_none" + )] + pub lock_aggregation_type: Option, + + /// Name of metric specification. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// The supported aggregation types for the metrics. + #[serde( + rename = "supportedAggregationTypes", + skip_serializing_if = "Option::is_none" + )] + pub supported_aggregation_types: Option>, + + /// The supported time grain types for the metrics. + #[serde( + rename = "supportedTimeGrainTypes", + skip_serializing_if = "Option::is_none" + )] + pub supported_time_grain_types: Option>, + + /// The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + #[serde(skip_serializing_if = "Option::is_none")] + pub unit: Option, +} + +/// A set of rules governing the network accessibility of a vault. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct NetworkRuleSet { + /// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. + #[serde(skip_serializing_if = "Option::is_none")] + pub bypass: Option, + + /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property + /// has been evaluated. + #[serde(rename = "defaultAction", skip_serializing_if = "Option::is_none")] + pub default_action: Option, + + /// The list of IP address rules. + #[serde(rename = "ipRules", skip_serializing_if = "Option::is_none")] + pub ip_rules: Option>, + + /// The list of virtual network rules. + #[serde( + rename = "virtualNetworkRules", + skip_serializing_if = "Option::is_none" + )] + pub virtual_network_rules: Option>, +} + +/// Key Vault REST API operation definition. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct Operation { + /// Display metadata associated with the operation. + #[serde(skip_serializing_if = "Option::is_none")] + pub display: Option, + + /// Property to specify whether the action is a data action. + #[serde(rename = "isDataAction", skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + + /// Operation name: {provider}/{resource}/{operation} + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// Properties of operation, include metric specifications. + #[serde(rename = "properties", skip_serializing_if = "Option::is_none")] + pub operation_properties: Option, + + /// The origin of operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub origin: Option, +} + +/// Display metadata associated with the operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct OperationDisplay { + /// Description of operation. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + + /// Type of operation: get, read, delete, etc. + #[serde(skip_serializing_if = "Option::is_none")] + pub operation: Option, + + /// Service provider: Microsoft Key Vault. + #[serde(skip_serializing_if = "Option::is_none")] + pub provider: Option, + + /// Resource on which the operation is performed etc. + #[serde(skip_serializing_if = "Option::is_none")] + pub resource: Option, +} + +/// Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set +/// of results. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct OperationListResult { + /// The URL to get the next set of operations. + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// List of Storage operations supported by the Storage resource provider. + #[serde(default)] + pub value: Vec, +} + +/// Properties of operation, include metric specifications. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct OperationProperties { + /// One property of operation, include metric specifications. + #[serde( + rename = "serviceSpecification", + skip_serializing_if = "Option::is_none" + )] + pub service_specification: Option, +} + +/// Permissions the identity has for keys, secrets, certificates and storage. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct Permissions { + /// Permissions to certificates + #[serde(skip_serializing_if = "Option::is_none")] + pub certificates: Option>, + + /// Permissions to keys + #[serde(skip_serializing_if = "Option::is_none")] + pub keys: Option>, + + /// Permissions to secrets + #[serde(skip_serializing_if = "Option::is_none")] + pub secrets: Option>, + + /// Permissions to storage accounts + #[serde(skip_serializing_if = "Option::is_none")] + pub storage: Option>, +} + +/// Private endpoint object properties. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct PrivateEndpoint { + /// Full identifier of the private endpoint resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, +} + +/// Private endpoint connection resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct PrivateEndpointConnection { + /// Modified whenever there is a change in the state of private endpoint connection. + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Azure location of the key vault resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// Name of the private endpoint connection associated with the key vault. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Resource properties. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Tags assigned to the key vault resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// Private endpoint connection item. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct PrivateEndpointConnectionItem { + /// Modified whenever there is a change in the state of private endpoint connection. + #[serde(skip_serializing_if = "Option::is_none")] + pub etag: Option, + + /// Id of private endpoint connection. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// Private endpoint connection properties. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, +} + +/// The response of a PrivateEndpointConnection list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct PrivateEndpointConnectionListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The PrivateEndpointConnection items on this page + #[serde(default)] + pub value: Vec, +} + +/// Properties of the private endpoint connection resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct PrivateEndpointConnectionProperties { + /// Properties of the private endpoint object. + #[serde(rename = "privateEndpoint", skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + + /// Approval state of the private link connection. + #[serde( + rename = "privateLinkServiceConnectionState", + skip_serializing_if = "Option::is_none" + )] + pub private_link_service_connection_state: Option, + + /// Provisioning state of the private endpoint connection. + /// + /// Operational visibility: Read + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, +} + +/// A private link resource +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct PrivateLinkResource { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Azure location of the key vault resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// The name of the resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Resource properties. + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Tags assigned to the key vault resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// A list of private link resources +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct PrivateLinkResourceListResult { + /// Array of private link resources + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, +} + +/// Properties of a private link resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct PrivateLinkResourceProperties { + /// Group identifier of private link resource. + /// + /// Operational visibility: Read + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + + /// Required member names of private link resource. + /// + /// Operational visibility: Read + #[serde(rename = "requiredMembers", skip_serializing)] + pub required_members: Option>, + + /// Required DNS zone names of the the private link resource. + #[serde(rename = "requiredZoneNames", skip_serializing_if = "Option::is_none")] + pub required_zone_names: Option>, +} + +/// An object that represents the approval state of the private link connection. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct PrivateLinkServiceConnectionState { + /// A message indicating if changes on the service provider require any updates on the consumer. + #[serde(rename = "actionsRequired", skip_serializing_if = "Option::is_none")] + pub actions_required: Option, + + /// The reason for approval or rejection. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + + /// Indicates whether the connection has been approved, rejected or removed by the key vault owner. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +/// The list of vault resources. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ResourceListResult { + /// The URL to get the next set of vault resources. + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The list of vault resources. + #[serde(default)] + pub value: Vec, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct RotationPolicy { + /// The attributes of key rotation policy. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The lifetimeActions for key rotation action. + #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] + pub lifetime_actions: Option>, +} + +/// Resource information with extended details. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct Secret { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Azure location of the key vault resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// The name of the secret. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Properties of the secret + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Tags assigned to the key vault resource. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// The secret management attributes. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct SecretAttributes { + /// Creation time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde( + default, + skip_serializing, + with = "azure_core::time::unix_time::option" + )] + pub created: Option, + + /// Determines whether the object is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + + /// Expiry date in seconds since 1970-01-01T00:00:00Z. + #[serde( + default, + rename = "exp", + skip_serializing_if = "Option::is_none", + with = "azure_core::time::unix_time::option" + )] + pub expires: Option, + + /// Not before date in seconds since 1970-01-01T00:00:00Z. + #[serde( + default, + rename = "nbf", + skip_serializing_if = "Option::is_none", + with = "azure_core::time::unix_time::option" + )] + pub not_before: Option, + + /// Last updated time in seconds since 1970-01-01T00:00:00Z. + /// + /// Operational visibility: Read + #[serde( + default, + skip_serializing, + with = "azure_core::time::unix_time::option" + )] + pub updated: Option, +} + +/// Parameters for creating or updating a secret +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct SecretCreateOrUpdateParameters { + /// Properties of the secret + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The tags that will be assigned to the secret. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The response of a Secret list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct SecretListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The Secret items on this page + #[serde(default)] + pub value: Vec, +} + +/// Parameters for patching a secret +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct SecretPatchParameters { + /// Properties of the secret + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The tags that will be assigned to the secret. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// Properties of the secret +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct SecretPatchProperties { + /// The attributes of the secret. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The content type of the secret. + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + + /// The value of the secret. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +/// Properties of the secret +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct SecretProperties { + /// The attributes of the secret. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The content type of the secret. + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + + /// The URI to retrieve the current version of the secret. + /// + /// Operational visibility: Read + #[serde(rename = "secretUri", skip_serializing)] + pub secret_uri: Option, + + /// The URI to retrieve the specific version of the secret. + /// + /// Operational visibility: Read + #[serde(rename = "secretUriWithVersion", skip_serializing)] + pub secret_uri_with_version: Option, + + /// The value of the secret. NOTE: 'value' will never be returned from the service, as APIs using this model are is intended + /// for internal use in Resource Manager deployments. Users should use the data-plane REST service for interaction with vault secrets. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +/// One property of operation, include log specifications. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct ServiceSpecification { + /// Log specifications of operation. + #[serde(rename = "logSpecifications", skip_serializing_if = "Option::is_none")] + pub log_specifications: Option>, + + /// Metric specifications of operation. + #[serde( + rename = "metricSpecifications", + skip_serializing_if = "Option::is_none" + )] + pub metric_specifications: Option>, +} + +/// SKU details +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct Sku { + /// SKU family name + #[serde(skip_serializing_if = "Option::is_none")] + pub family: Option, + + /// SKU name to specify whether the key vault is a standard vault or a premium vault. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, +} + +/// Metadata pertaining to creation and last modification of the resource. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct SystemData { + /// The timestamp of resource creation (UTC). + #[serde( + default, + rename = "createdAt", + skip_serializing_if = "Option::is_none", + with = "azure_core::time::rfc3339::option" + )] + pub created_at: Option, + + /// The identity that created the resource. + #[serde(rename = "createdBy", skip_serializing_if = "Option::is_none")] + pub created_by: Option, + + /// The type of identity that created the resource. + #[serde(rename = "createdByType", skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + + /// The timestamp of resource last modification (UTC) + #[serde( + default, + rename = "lastModifiedAt", + skip_serializing_if = "Option::is_none", + with = "azure_core::time::rfc3339::option" + )] + pub last_modified_at: Option, + + /// The identity that last modified the resource. + #[serde(rename = "lastModifiedBy", skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + + /// The type of identity that last modified the resource. + #[serde(rename = "lastModifiedByType", skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, +} + +/// Tracked Resource +/// +/// The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct TrackedResource { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// The geo-location where the resource lives + /// + /// Operational visibility: Create, Read + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + + /// The name of the resource + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Resource tags. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct Trigger { + /// The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. + /// Eg: 'P90D', 'P1Y'. + #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] + pub time_after_create: Option, + + /// The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] + pub time_before_expiry: Option, +} + +/// User assigned identity properties +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct UserAssignedIdentity { + /// The client ID of the assigned identity. + /// + /// Operational visibility: Read + #[serde(rename = "clientId", skip_serializing)] + pub client_id: Option, + + /// The principal ID of the assigned identity. + /// + /// Operational visibility: Read + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, +} + +/// Resource information with extended details. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct Vault { + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// Azure location of the key vault resource. + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + + /// The name of the vault. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Properties of the vault + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// + /// Operational visibility: Read + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + + /// Tags assigned to the key vault resource. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// Parameters for updating the access policy in a vault +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultAccessPolicyParameters { + /// The resource id of the access policy. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub id: Option, + + /// The resource type of the access policy. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub location: Option, + + /// The resource name of the access policy. + /// + /// Operational visibility: Read + #[serde(skip_serializing)] + pub name: Option, + + /// Properties of the access policy + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The resource name of the access policy. + /// + /// Operational visibility: Read + #[serde(rename = "type", skip_serializing)] + pub type_prop: Option, +} + +/// Properties of the vault access policy +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultAccessPolicyProperties { + /// An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant + /// ID as the key vault's tenant ID. + #[serde(rename = "accessPolicies", skip_serializing_if = "Option::is_none")] + pub access_policies: Option>, +} + +/// The parameters used to check the availability of the vault name. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultCheckNameAvailabilityParameters { + /// The vault name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + /// The type of resource, Microsoft.KeyVault/vaults + /// + /// Field has constant value Microsoft.KeyVault/vaults. Any specified value will be ignored. + #[serde( + rename = "type", + serialize_with = "models_serde::serialize_string_literal_Microsoft_KeyVault_vaults" + )] + pub type_prop: Option, +} + +/// Parameters for creating or updating a vault +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultCreateOrUpdateParameters { + /// The supported Azure location where the key vault should be created. + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, + + /// Properties of the vault + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The tags that will be assigned to the key vault. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The response of a Vault list operation. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +#[non_exhaustive] +pub struct VaultListResult { + /// The link to the next page of items + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// The Vault items on this page + #[serde(default)] + pub value: Vec, +} + +/// Parameters for creating or updating a vault +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultPatchParameters { + /// Properties of the vault + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option, + + /// The tags that will be assigned to the key vault. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// Properties of the vault +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultPatchProperties { + /// An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant + /// ID as the key vault's tenant ID. + #[serde(rename = "accessPolicies", skip_serializing_if = "Option::is_none")] + pub access_policies: Option>, + + /// The vault's create mode to indicate whether the vault need to be recovered or not. + #[serde(rename = "createMode", skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + + /// Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates + /// protection against purge for this vault and its content - only the Key Vault service may initiate a hard, irrecoverable + /// deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible - + /// that is, the property does not accept false as its value. + #[serde( + rename = "enablePurgeProtection", + skip_serializing_if = "Option::is_none" + )] + pub enable_purge_protection: Option, + + /// Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) + /// for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, + /// the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager + /// will be ignored. If null or not specified, the value of this property will not change. + #[serde( + rename = "enableRbacAuthorization", + skip_serializing_if = "Option::is_none" + )] + pub enable_rbac_authorization: Option, + + /// Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot + /// be reverted to false. + #[serde(rename = "enableSoftDelete", skip_serializing_if = "Option::is_none")] + pub enable_soft_delete: Option, + + /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key + /// vault. + #[serde( + rename = "enabledForDeployment", + skip_serializing_if = "Option::is_none" + )] + pub enabled_for_deployment: Option, + + /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. + #[serde( + rename = "enabledForDiskEncryption", + skip_serializing_if = "Option::is_none" + )] + pub enabled_for_disk_encryption: Option, + + /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + #[serde( + rename = "enabledForTemplateDeployment", + skip_serializing_if = "Option::is_none" + )] + pub enabled_for_template_deployment: Option, + + /// A collection of rules governing the accessibility of the vault from specific network locations. + #[serde(rename = "networkAcls", skip_serializing_if = "Option::is_none")] + pub network_acls: Option, + + /// Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except + /// private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall + /// rules, meaning that even if the firewall rules are present we will not honor the rules. + #[serde( + rename = "publicNetworkAccess", + skip_serializing_if = "Option::is_none" + )] + pub public_network_access: Option, + + /// SKU details + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + + /// softDelete data retention days. It accepts >=7 and <=90. + #[serde( + rename = "softDeleteRetentionInDays", + skip_serializing_if = "Option::is_none" + )] + pub soft_delete_retention_in_days: Option, + + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, +} + +/// Properties of the vault +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VaultProperties { + /// An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant + /// ID as the key vault's tenant ID. When `createMode` is set to `recover`, access policies are not required. Otherwise, access + /// policies are required. + #[serde(rename = "accessPolicies", skip_serializing_if = "Option::is_none")] + pub access_policies: Option>, + + /// The vault's create mode to indicate whether the vault need to be recovered or not. + /// + /// Operational visibility: Create, Update + #[serde(rename = "createMode", skip_serializing_if = "Option::is_none")] + pub create_mode: Option, + + /// Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates + /// protection against purge for this vault and its content - only the Key Vault service may initiate a hard, irrecoverable + /// deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible - + /// that is, the property does not accept false as its value. + #[serde( + rename = "enablePurgeProtection", + skip_serializing_if = "Option::is_none" + )] + pub enable_purge_protection: Option, + + /// Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) + /// for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, + /// the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager + /// will be ignored. If null or not specified, the vault is created with the default value of false. Note that management + /// actions are always authorized with RBAC. + #[serde( + rename = "enableRbacAuthorization", + skip_serializing_if = "Option::is_none" + )] + pub enable_rbac_authorization: Option, + + /// Property to specify whether the 'soft delete' functionality is enabled for this key vault. If it's not set to any value(true + /// or false) when creating new key vault, it will be set to true by default. Once set to true, it cannot be reverted to false. + #[serde(rename = "enableSoftDelete", skip_serializing_if = "Option::is_none")] + pub enable_soft_delete: Option, + + /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key + /// vault. + #[serde( + rename = "enabledForDeployment", + skip_serializing_if = "Option::is_none" + )] + pub enabled_for_deployment: Option, + + /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. + #[serde( + rename = "enabledForDiskEncryption", + skip_serializing_if = "Option::is_none" + )] + pub enabled_for_disk_encryption: Option, + + /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + #[serde( + rename = "enabledForTemplateDeployment", + skip_serializing_if = "Option::is_none" + )] + pub enabled_for_template_deployment: Option, + + /// The resource id of HSM Pool. + /// + /// Operational visibility: Read + #[serde(rename = "hsmPoolResourceId", skip_serializing)] + pub hsm_pool_resource_id: Option, + + /// Rules governing the accessibility of the key vault from specific network locations. + #[serde(rename = "networkAcls", skip_serializing_if = "Option::is_none")] + pub network_acls: Option, + + /// List of private endpoint connections associated with the key vault. + /// + /// Operational visibility: Read + #[serde(rename = "privateEndpointConnections", skip_serializing)] + pub private_endpoint_connections: Option>, + + /// Provisioning state of the vault. + #[serde(rename = "provisioningState", skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + + /// Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except + /// private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall + /// rules, meaning that even if the firewall rules are present we will not honor the rules. + #[serde( + rename = "publicNetworkAccess", + skip_serializing_if = "Option::is_none" + )] + pub public_network_access: Option, + + /// SKU details + #[serde(skip_serializing_if = "Option::is_none")] + pub sku: Option, + + /// softDelete data retention days. It accepts >=7 and <=90. + #[serde( + rename = "softDeleteRetentionInDays", + skip_serializing_if = "Option::is_none" + )] + pub soft_delete_retention_in_days: Option, + + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + #[serde(rename = "tenantId", skip_serializing_if = "Option::is_none")] + pub tenant_id: Option, + + /// The URI of the vault for performing operations on keys and secrets. + #[serde(rename = "vaultUri", skip_serializing_if = "Option::is_none")] + pub vault_uri: Option, +} + +/// A rule governing the accessibility of a vault from a specific virtual network. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)] +pub struct VirtualNetworkRule { + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. + #[serde( + rename = "ignoreMissingVnetServiceEndpoint", + skip_serializing_if = "Option::is_none" + )] + pub ignore_missing_vnet_service_endpoint: Option, +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models_impl.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models_impl.rs new file mode 100644 index 0000000000..10daa94c44 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models_impl.rs @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use super::{ + CheckMhsmNameAvailabilityParameters, DeletedManagedHsm, DeletedManagedHsmListResult, + DeletedVault, DeletedVaultListResult, Key, KeyCreateParameters, KeyListResult, + KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientBeginDeleteOperationStatus, + KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientBeginUpdateOperationStatus, + KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus, + KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus, + KeyVaultVaultsClientBeginPurgeDeletedOperationStatus, MHSMGeoReplicatedRegion, + MHSMPrivateEndpointConnection, MHSMPrivateEndpointConnectionsListResult, MHSMRegionsListResult, + ManagedHsm, ManagedHsmKey, ManagedHsmKeyCreateParameters, ManagedHsmKeyListResult, + ManagedHsmListResult, Operation, OperationListResult, PrivateEndpointConnection, + PrivateEndpointConnectionListResult, ResourceListResult, Secret, + SecretCreateOrUpdateParameters, SecretListResult, SecretPatchParameters, TrackedResource, + Vault, VaultAccessPolicyParameters, VaultCheckNameAvailabilityParameters, + VaultCreateOrUpdateParameters, VaultListResult, VaultPatchParameters, +}; +use async_trait::async_trait; +use azure_core::{ + http::{ + pager::Page, + poller::{PollerStatus, StatusMonitor}, + JsonFormat, NoFormat, RequestContent, + }, + json::to_json, + Result, +}; + +#[async_trait] +impl Page for DeletedManagedHsmListResult { + type Item = DeletedManagedHsm; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for DeletedVaultListResult { + type Item = DeletedVault; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for KeyListResult { + type Item = Key; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for MHSMPrivateEndpointConnectionsListResult { + type Item = MHSMPrivateEndpointConnection; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for MHSMRegionsListResult { + type Item = MHSMGeoReplicatedRegion; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for ManagedHsmKeyListResult { + type Item = ManagedHsmKey; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for ManagedHsmListResult { + type Item = ManagedHsm; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for OperationListResult { + type Item = Operation; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for PrivateEndpointConnectionListResult { + type Item = PrivateEndpointConnection; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for ResourceListResult { + type Item = TrackedResource; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for SecretListResult { + type Item = Secret; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +#[async_trait] +impl Page for VaultListResult { + type Item = Vault; + type IntoIter = as IntoIterator>::IntoIter; + async fn into_items(self) -> Result { + Ok(self.value.into_iter()) + } +} + +impl StatusMonitor for KeyVaultMHSMPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + type Output = MHSMPrivateEndpointConnection; + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultManagedHsmsClientBeginCreateOrUpdateOperationStatus { + type Output = ManagedHsm; + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultManagedHsmsClientBeginDeleteOperationStatus { + type Output = (); + type Format = NoFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultManagedHsmsClientBeginPurgeDeletedOperationStatus { + type Output = (); + type Format = NoFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultManagedHsmsClientBeginUpdateOperationStatus { + type Output = ManagedHsm; + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultPrivateEndpointConnectionsClientBeginDeleteOperationStatus { + type Output = PrivateEndpointConnection; + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus { + type Output = Vault; + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultVaultsClientBeginPurgeDeletedOperationStatus { + type Output = (); + type Format = NoFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl TryFrom + for RequestContent +{ + type Error = azure_core::Error; + fn try_from(value: CheckMhsmNameAvailabilityParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyCreateParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: MHSMPrivateEndpointConnection) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: ManagedHsm) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: ManagedHsmKeyCreateParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: PrivateEndpointConnection) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: SecretCreateOrUpdateParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: SecretPatchParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: VaultAccessPolicyParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom + for RequestContent +{ + type Error = azure_core::Error; + fn try_from(value: VaultCheckNameAvailabilityParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: VaultCreateOrUpdateParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: VaultPatchParameters) -> Result { + Ok(to_json(&value)?.into()) + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models_serde.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models_serde.rs new file mode 100644 index 0000000000..0056041e70 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/models_serde.rs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use serde::Serializer; + +#[allow(non_snake_case)] +pub(crate) fn serialize_string_literal_Microsoft_KeyVault_vaults( + _ignored: &Option, + serializer: S, +) -> std::result::Result +where + S: Serializer, +{ + serializer.serialize_str("Microsoft.KeyVault/vaults") +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/lib.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/lib.rs new file mode 100644 index 0000000000..ab2e1a3f9e --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/lib.rs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// Code generated by Microsoft (R) Rust Code Generator. + +#![cfg_attr(docsrs, feature(doc_cfg))] + +//! Manage Azure Key Vault resources with Azure Resource Manager. + +mod generated; +pub use generated::*; + +#[cfg(test)] +mod tests; diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/tests.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/tests.rs new file mode 100644 index 0000000000..5f9f639db5 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/tests.rs @@ -0,0 +1,682 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use super::{models, KeyVaultClient, KeyVaultClientOptions}; +use azure_core::{ + cloud::{resource_manager::Audience, Audiences, CloudConfiguration, CustomConfiguration}, + error::ErrorResponse, + http::{ + headers::{HeaderName, Headers, ACCEPT, AUTHORIZATION, CONTENT_TYPE}, + poller::resource_manager::PollerOptions, + request::{options::ClientRequestId, Body}, + AsyncRawResponse, ClientOptions, Context, Method, RetryOptions, StatusCode, Transport, + }, + Result, +}; +use azure_core_test::{credentials::MockCredential, http::MockHttpClient}; +use futures::{FutureExt as _, TryStreamExt as _}; +use serde_json::{json, Value}; +use std::{ + collections::VecDeque, + sync::{Arc, Mutex}, +}; + +mod enums; + +const VAULT: &str = + "/subscriptions/sub/resourceGroups/group/providers/Microsoft.KeyVault/vaults/vault"; +const HSM: &str = + "/subscriptions/sub/resourceGroups/group/providers/Microsoft.KeyVault/managedHSMs/hsm"; +const OPERATION: &str = "/operations/1"; +const REQUEST_ID: HeaderName = HeaderName::from_static("x-ms-client-request-id"); + +#[tokio::test] +async fn secret_update_includes_properties_and_value() -> Result<()> { + let mut update = step( + Method::Patch, + &format!("{VAULT}/secrets/secret"), + StatusCode::Ok, + br#"{"name":"secret","properties":{"contentType":"text/plain"},"tags":{"updated":"true"}}"#, + ); + update.request_body = Some(json!({ + "properties": {"contentType": "text/plain", "value": "test-value"}, + "tags": {"updated": "true"}, + })); + let (client, pending) = scripted_client(vec![update])?; + let secret = client + .get_key_vault_secrets_client() + .update( + "group", + "vault", + "secret", + models::SecretPatchParameters { + properties: Some(models::SecretPatchProperties { + content_type: Some("text/plain".into()), + value: Some("test-value".into()), + ..Default::default() + }), + tags: Some([("updated".into(), "true".into())].into()), + } + .try_into()?, + None, + ) + .await? + .into_model()?; + assert_eq!( + secret.properties.unwrap().content_type.as_deref(), + Some("text/plain") + ); + assert_eq!(secret.tags.unwrap().get("updated").unwrap(), "true"); + assert!(pending.lock().unwrap().is_empty()); + Ok(()) +} + +struct Step { + method: Method, + path: String, + response: AsyncRawResponse, + request_body: Option, +} + +fn step(method: Method, path: &str, status: StatusCode, body: &'static [u8]) -> Step { + let mut headers = Headers::new(); + headers.insert("retry-after-ms", "0"); + Step { + method, + path: path.into(), + response: AsyncRawResponse::from_bytes(status, headers, body), + request_body: None, + } +} + +fn accepted(method: Method, path: &str, header: &str) -> Step { + let mut headers = Headers::new(); + headers.insert("retry-after-ms", "0"); + headers.insert( + HeaderName::from(header.to_string()), + "/operations/1?api-version=other", + ); + let mut step = step( + method, + path, + StatusCode::Accepted, + br#"{"status":"InProgress"}"#, + ); + step.response = AsyncRawResponse::from_bytes( + StatusCode::Accepted, + headers, + br#"{"status":"InProgress"}"#.as_slice(), + ); + step +} + +fn scripted_client(steps: Vec) -> Result<(KeyVaultClient, Arc>>)> { + let pending = Arc::new(Mutex::new(VecDeque::from(steps))); + let script = pending.clone(); + let mock = MockHttpClient::new(move |request| { + let step = script + .lock() + .unwrap() + .pop_front() + .expect("unexpected request"); + assert_eq!(request.method(), step.method); + assert_eq!( + request.url().as_str(), + format!( + "https://management.azure.com{}?api-version=2026-05-15", + step.path + ) + ); + assert_eq!( + request.headers().get_optional_str(&AUTHORIZATION), + Some("Bearer TEST TOKEN https://management.core.windows.net//.default") + ); + if let Some(expected) = step.request_body { + assert_eq!( + request.headers().get_optional_str(&ACCEPT), + Some("application/json") + ); + assert_eq!( + request.headers().get_optional_str(&CONTENT_TYPE), + Some("application/json") + ); + let Body::Bytes(body) = request.body() else { + panic!("expected a JSON request body"); + }; + assert_eq!(serde_json::from_slice::(body).unwrap(), expected); + } + async move { Ok(step.response) }.boxed() + }); + let client = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + transport: Some(Transport::new(Arc::new(mock))), + retry: RetryOptions::none(), + ..Default::default() + }, + ..Default::default() + }), + )?; + Ok((client, pending)) +} + +#[test] +fn default_and_explicit_public_cloud() -> Result<()> { + for cloud in [None, Some(Arc::new(CloudConfiguration::AzurePublic))] { + let client = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + cloud, + ..Default::default() + }, + ..Default::default() + }), + )?; + assert_eq!(client.endpoint().as_str(), "https://management.azure.com/"); + } + let client = KeyVaultClient::new("sub".into(), MockCredential::new()?, None)?; + assert_eq!(client.endpoint().as_str(), "https://management.azure.com/"); + Ok(()) +} + +#[tokio::test] +async fn custom_cloud_uses_supplied_service_root_and_scope() -> Result<()> { + let audience = "https://custom.example/resource"; + let mut custom = CustomConfiguration::default(); + custom.authority_host = "https://login.example/".into(); + custom.endpoint = Some("https://management.example/resource".into()); + custom.audiences = Audiences::new().with::(audience.into()); + let mock = MockHttpClient::new(|request| { + assert_eq!(request.url().host_str(), Some("management.example")); + assert!(request.url().path().starts_with("/resource/")); + assert_eq!( + request.headers().get_optional_str(&AUTHORIZATION), + Some("Bearer TEST TOKEN https://custom.example/resource/.default") + ); + async { + Ok(AsyncRawResponse::from_bytes( + StatusCode::Ok, + Headers::new(), + b"{}".as_slice(), + )) + } + .boxed() + }); + let client = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + cloud: Some(Arc::new(custom.into())), + transport: Some(Transport::new(Arc::new(mock))), + ..Default::default() + }, + ..Default::default() + }), + )?; + assert_eq!( + client.endpoint().as_str(), + "https://management.example/resource" + ); + client + .get_key_vault_vaults_client() + .get("group", "vault", None) + .await?; + Ok(()) +} + +#[test] +fn missing_custom_audience_is_an_error() -> Result<()> { + let mut custom = CustomConfiguration::default(); + custom.endpoint = Some("https://management.example/".into()); + let error = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + cloud: Some(Arc::new(custom.into())), + ..Default::default() + }, + ..Default::default() + }), + ) + .err() + .expect("missing audience must fail"); + assert!(error + .to_string() + .contains("missing custom cloud configuration audience")); + Ok(()) +} + +#[test] +fn missing_custom_endpoint_is_an_error() -> Result<()> { + let mut custom = CustomConfiguration::default(); + custom.audiences = Audiences::new().with::("https://custom.example".into()); + let error = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + cloud: Some(Arc::new(custom.into())), + ..Default::default() + }, + ..Default::default() + }), + ) + .err() + .expect("missing endpoint must fail"); + assert!(error + .to_string() + .contains("missing Resource Manager endpoint")); + Ok(()) +} + +#[tokio::test] +async fn sovereign_clouds_use_core_endpoint_and_scope() -> Result<()> { + for (cloud, endpoint, scope) in [ + ( + CloudConfiguration::AzureGovernment, + "https://management.usgovcloudapi.net/", + "https://management.core.usgovcloudapi.net//.default", + ), + ( + CloudConfiguration::AzureChina, + "https://management.chinacloudapi.cn/", + "https://management.core.chinacloudapi.cn//.default", + ), + ] { + let mock = MockHttpClient::new(move |request| { + assert!(request.url().as_str().starts_with(endpoint)); + assert!(request + .headers() + .get_optional_str(&AUTHORIZATION) + .expect("authorization header must be set") + .ends_with(scope)); + async { + Ok(AsyncRawResponse::from_bytes( + StatusCode::Ok, + Headers::new(), + b"{}".as_slice(), + )) + } + .boxed() + }); + let client = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + cloud: Some(Arc::new(cloud)), + transport: Some(Transport::new(Arc::new(mock))), + ..Default::default() + }, + ..Default::default() + }), + )?; + assert_eq!(client.endpoint().as_str(), endpoint); + client + .get_key_vault_vaults_client() + .get("group", "vault", None) + .await?; + } + Ok(()) +} + +#[tokio::test] +async fn resource_pollers_fetch_final_resources() -> Result<()> { + for operation in 0..3 { + let (path, method) = match operation { + 0 => (VAULT, Method::Put), + 1 => (HSM, Method::Put), + _ => (HSM, Method::Patch), + }; + let mut initial = accepted(method, path, "azure-asyncoperation"); + initial.request_body = Some(json!({"location":"westus"})); + let (client, pending) = scripted_client(vec![ + initial, + step( + Method::Get, + OPERATION, + StatusCode::Ok, + br#"{"status":"Succeeded"}"#, + ), + step( + Method::Get, + path, + StatusCode::Ok, + br#"{"name":"result","properties":{"provisioningState":"Succeeded"}}"#, + ), + ])?; + let name = match operation { + 0 => { + client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters { + location: Some("westus".into()), + ..Default::default() + } + .try_into()?, + None, + )? + .await? + .into_model()? + .name + } + 1 => { + client + .get_key_vault_managed_hsms_client() + .begin_create_or_update( + "group", + "hsm", + models::ManagedHsm { + location: Some("westus".into()), + ..Default::default() + } + .try_into()?, + None, + )? + .await? + .into_model()? + .name + } + _ => { + client + .get_key_vault_managed_hsms_client() + .begin_update( + "group", + "hsm", + models::ManagedHsm { + location: Some("westus".into()), + ..Default::default() + } + .try_into()?, + None, + )? + .await? + .into_model()? + .name + } + }; + assert_eq!(name.as_deref(), Some("result")); + assert!(pending.lock().unwrap().is_empty()); + } + Ok(()) +} + +#[tokio::test] +async fn delete_and_purge_pollers_complete_without_final_get() -> Result<()> { + for operation in 0..5 { + let path = match operation { + 0 => HSM.into(), + 1 => "/subscriptions/sub/providers/Microsoft.KeyVault/locations/westus/deletedManagedHSMs/hsm/purge".into(), + 2 => "/subscriptions/sub/providers/Microsoft.KeyVault/locations/westus/deletedVaults/vault/purge".into(), + 3 => format!("{VAULT}/privateEndpointConnections/connection"), + _ => format!("{HSM}/privateEndpointConnections/connection"), + }; + let method = if matches!(operation, 1 | 2) { + Method::Post + } else { + Method::Delete + }; + let (client, pending) = scripted_client(vec![ + accepted(method, &path, "location"), + step(Method::Get, OPERATION, StatusCode::NoContent, b""), + ])?; + let status = match operation { + 0 => client + .get_key_vault_managed_hsms_client() + .begin_delete("group", "hsm", None)? + .await? + .status(), + 1 => client + .get_key_vault_managed_hsms_client() + .begin_purge_deleted("westus", "hsm", None)? + .await? + .status(), + 2 => client + .get_key_vault_vaults_client() + .begin_purge_deleted("westus", "vault", None)? + .await? + .status(), + 3 => client + .get_key_vault_private_endpoint_connections_client() + .begin_delete("group", "vault", "connection", None)? + .await? + .status(), + _ => client + .get_key_vault_mhsm_private_endpoint_connections_client() + .begin_delete("group", "hsm", "connection", None)? + .await? + .status(), + }; + assert_eq!(status, StatusCode::NoContent); + assert!(pending.lock().unwrap().is_empty()); + } + Ok(()) +} + +#[tokio::test] +async fn synchronous_resource_completion_is_lazy_and_reuses_response() -> Result<()> { + let (client, pending) = scripted_client(vec![step( + Method::Put, + VAULT, + StatusCode::Created, + br#"{"name":"vault","properties":{"provisioningState":"Succeeded"}}"#, + )])?; + let poller = client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters::default().try_into()?, + None, + )?; + assert_eq!(pending.lock().unwrap().len(), 1); + assert_eq!(poller.await?.into_model()?.name.as_deref(), Some("vault")); + assert!(pending.lock().unwrap().is_empty()); + Ok(()) +} + +#[tokio::test] +async fn explicit_location_metadata_overrides_operation_resource_location() -> Result<()> { + let mut headers = Headers::new(); + headers.insert("operation-location", "/operations/1?api-version=other"); + headers.insert("location", "/results/1?api-version=other"); + headers.insert("retry-after-ms", "0"); + let initial = Step { + method: Method::Put, + path: VAULT.into(), + response: AsyncRawResponse::from_bytes( + StatusCode::Accepted, + headers, + br#"{"status":"InProgress"}"#.as_slice(), + ), + request_body: None, + }; + let (client, pending) = scripted_client(vec![ + initial, + step( + Method::Get, + OPERATION, + StatusCode::Ok, + br#"{"status":"Succeeded","resourceLocation":"/wrong-result"}"#, + ), + step( + Method::Get, + "/results/1", + StatusCode::Ok, + br#"{"name":"vault"}"#, + ), + ])?; + let vault = client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters::default().try_into()?, + None, + )? + .await? + .into_model()?; + assert_eq!(vault.name.as_deref(), Some("vault")); + assert!(pending.lock().unwrap().is_empty()); + Ok(()) +} + +#[tokio::test] +async fn streamed_monitors_can_be_followed_by_awaiting() -> Result<()> { + let (client, pending) = scripted_client(vec![ + accepted(Method::Put, VAULT, "azure-asyncoperation"), + step( + Method::Get, + OPERATION, + StatusCode::Ok, + br#"{"status":"Running"}"#, + ), + step( + Method::Get, + OPERATION, + StatusCode::Ok, + br#"{"status":"Succeeded","name":"vault"}"#, + ), + step(Method::Get, VAULT, StatusCode::Ok, br#"{"name":"vault"}"#), + ])?; + let mut poller = client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters::default().try_into()?, + None, + )?; + let mut statuses = Vec::new(); + while let Some(response) = poller.try_next().await? { + statuses.push(response.into_model()?.status.unwrap().to_string()); + } + assert_eq!(statuses, ["InProgress", "Running", "Succeeded"]); + assert_eq!(pending.lock().unwrap().len(), 1); + assert_eq!(poller.await?.into_model()?.name.as_deref(), Some("vault")); + assert!(pending.lock().unwrap().is_empty()); + Ok(()) +} + +#[tokio::test] +async fn failures_propagate_without_final_requests() -> Result<()> { + for state in ["Failed", "Canceled"] { + let body = if state == "Failed" { + br#"{"status":"Failed","error":{"code":"QuotaExceeded","message":"capacity exhausted"}}"#.as_slice() + } else { + br#"{"status":"Canceled"}"#.as_slice() + }; + let (client, pending) = scripted_client(vec![ + accepted(Method::Put, VAULT, "azure-asyncoperation"), + step(Method::Get, OPERATION, StatusCode::Ok, body), + ])?; + let error = client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters::default().try_into()?, + None, + )? + .await + .err() + .expect("terminal failure must propagate"); + if state == "Failed" { + assert_eq!(error.http_status(), Some(StatusCode::Ok)); + assert_eq!(error.to_string(), "capacity exhausted"); + let detail = ErrorResponse::try_from(error)?.error.unwrap(); + assert_eq!(detail.code.as_deref(), Some("QuotaExceeded")); + assert_eq!(detail.message.as_deref(), Some("capacity exhausted")); + } else { + assert!(error.to_string().contains("canceled")); + } + assert!(pending.lock().unwrap().is_empty()); + } + let (client, pending) = scripted_client(vec![step( + Method::Put, + VAULT, + StatusCode::Forbidden, + br#"{"error":{"code":"Forbidden","message":"denied"}}"#, + )])?; + let error = client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters::default().try_into()?, + None, + )? + .await + .err() + .expect("HTTP failure must propagate"); + assert_eq!(error.http_status(), Some(StatusCode::Forbidden)); + assert!(pending.lock().unwrap().is_empty()); + Ok(()) +} + +#[tokio::test] +async fn borrowed_context_reaches_initial_poll_and_final_requests() -> Result<()> { + let requests = Arc::new(Mutex::new(0)); + let count = requests.clone(); + let mock = MockHttpClient::new(move |request| { + assert_eq!( + request.headers().get_optional_str(&REQUEST_ID), + Some("caller-id") + ); + let mut count = count.lock().unwrap(); + *count += 1; + let response = match *count { + 1 => accepted(Method::Put, VAULT, "azure-asyncoperation").response, + 2 => { + step( + Method::Get, + OPERATION, + StatusCode::Ok, + br#"{"status":"Succeeded"}"#, + ) + .response + } + 3 => step(Method::Get, VAULT, StatusCode::Ok, br#"{"name":"vault"}"#).response, + _ => panic!("unexpected request"), + }; + async move { Ok(response) }.boxed() + }); + let client = KeyVaultClient::new( + "sub".into(), + MockCredential::new()?, + Some(KeyVaultClientOptions { + client_options: ClientOptions { + transport: Some(Transport::new(Arc::new(mock))), + ..Default::default() + }, + ..Default::default() + }), + )?; + let context = Context::new().with_value(ClientRequestId::new("caller-id")); + let poller = client + .get_key_vault_vaults_client() + .begin_create_or_update( + "group", + "vault", + models::VaultCreateOrUpdateParameters::default().try_into()?, + Some(models::KeyVaultVaultsClientBeginCreateOrUpdateOptions { + method_options: PollerOptions { + context: context.to_borrowed(), + ..Default::default() + }, + }), + )?; + drop(context); + assert_eq!(poller.await?.into_model()?.name.as_deref(), Some("vault")); + assert_eq!(*requests.lock().unwrap(), 3); + Ok(()) +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/tests/enums.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/tests/enums.rs new file mode 100644 index 0000000000..839e731cb2 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/tests/enums.rs @@ -0,0 +1,580 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use super::models::{ + self, AccessPolicyUpdateKind, ActionsRequired, ActivationStatus, CertificatePermissions, + CreateMode, CreatedByType, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, + JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, KeyPermissions, + KeyRotationPolicyActionType, ManagedHsmSkuFamily, ManagedHsmSkuNameV2, + ManagedServiceIdentityType, NetworkRuleAction, NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, + ProvisioningState, PublicNetworkAccess, Reason, ResourceProvisioningState, SecretPermissions, + SkuFamily, SkuName, StoragePermissions, VaultProvisioningState, +}; +use azure_core::Result; +use serde::{de::DeserializeOwned, Serialize}; +use serde_json::{json, Value}; +use std::{fmt::Debug, str::FromStr}; + +fn check(cases: &[(E, &str)], unknown: Option E>) -> Result<()> +where + E: AsRef + Clone + Debug + DeserializeOwned + PartialEq + Serialize + ToString + FromStr, + E::Err: Debug, +{ + for (expected, wire) in cases { + assert_eq!(wire.parse::().unwrap(), *expected, "{wire}"); + assert_eq!(expected.as_ref(), *wire); + assert_eq!(expected.to_string(), *wire); + assert_eq!(serde_json::to_value(expected)?, json!(wire)); + assert_eq!(serde_json::from_value::(json!(wire))?, *expected); + let wrong_case = if wire.to_ascii_lowercase() == *wire { + wire.to_ascii_uppercase() + } else { + wire.to_ascii_lowercase() + }; + if let Some(unknown) = unknown { + assert_eq!( + serde_json::from_value::(json!(wrong_case))?, + unknown(wrong_case.clone()) + ); + assert_ne!(wrong_case.parse::().unwrap(), *expected); + } else { + assert!(wrong_case.parse::().is_err()); + assert!(serde_json::from_value::(json!(wrong_case)).is_err()); + } + } + let future = "FutureEnumValue"; + if let Some(unknown) = unknown { + let expected = unknown(future.into()); + assert_eq!(future.parse::().unwrap(), expected); + assert_eq!(serde_json::from_value::(json!(future))?, expected); + assert_eq!(serde_json::to_value(&expected)?, json!(future)); + assert_eq!(expected.as_ref(), future); + assert_eq!(expected.to_string(), future); + } else { + assert!(future.parse::().is_err()); + assert!(serde_json::from_value::(json!(future)).is_err()); + } + Ok(()) +} + +#[test] +fn vault_lifecycle_enum_wire_values() -> Result<()> { + check(&[(SkuFamily::A, "A")], Some(SkuFamily::UnknownValue))?; + check( + &[ + (SkuName::Standard, "standard"), + (SkuName::Premium, "premium"), + ], + None, + )?; + check( + &[ + (CreateMode::Default, "default"), + (CreateMode::Recover, "recover"), + ], + None, + )?; + check( + &[ + (VaultProvisioningState::RegisteringDns, "RegisteringDns"), + (VaultProvisioningState::Succeeded, "Succeeded"), + ], + Some(VaultProvisioningState::UnknownValue), + )?; + let properties: models::VaultProperties = serde_json::from_value(json!({ + "createMode": "recover", + "sku": {"family": "A", "name": "standard"}, + "provisioningState": "Succeeded", + }))?; + assert_eq!(properties.create_mode, Some(CreateMode::Recover)); + assert_eq!( + properties.provisioning_state, + Some(VaultProvisioningState::Succeeded) + ); + let value = serde_json::to_value(properties)?; + assert_eq!(value["createMode"], "recover"); + assert_eq!(value["sku"]["name"], "standard"); + Ok(()) +} + +#[test] +fn access_policy_enum_wire_values() -> Result<()> { + check( + &[ + (AccessPolicyUpdateKind::Add, "add"), + (AccessPolicyUpdateKind::Remove, "remove"), + (AccessPolicyUpdateKind::Replace, "replace"), + ], + None, + )?; + check( + &[ + (KeyPermissions::All, "all"), + (KeyPermissions::Backup, "backup"), + (KeyPermissions::Create, "create"), + (KeyPermissions::Decrypt, "decrypt"), + (KeyPermissions::Delete, "delete"), + (KeyPermissions::Encrypt, "encrypt"), + (KeyPermissions::Get, "get"), + (KeyPermissions::Getrotationpolicy, "getrotationpolicy"), + (KeyPermissions::Import, "import"), + (KeyPermissions::List, "list"), + (KeyPermissions::Purge, "purge"), + (KeyPermissions::Recover, "recover"), + (KeyPermissions::Release, "release"), + (KeyPermissions::Restore, "restore"), + (KeyPermissions::Rotate, "rotate"), + (KeyPermissions::Setrotationpolicy, "setrotationpolicy"), + (KeyPermissions::Sign, "sign"), + (KeyPermissions::UnwrapKey, "unwrapKey"), + (KeyPermissions::Update, "update"), + (KeyPermissions::Verify, "verify"), + (KeyPermissions::WrapKey, "wrapKey"), + ], + Some(KeyPermissions::UnknownValue), + )?; + check( + &[ + (SecretPermissions::All, "all"), + (SecretPermissions::Backup, "backup"), + (SecretPermissions::Delete, "delete"), + (SecretPermissions::Get, "get"), + (SecretPermissions::List, "list"), + (SecretPermissions::Purge, "purge"), + (SecretPermissions::Recover, "recover"), + (SecretPermissions::Restore, "restore"), + (SecretPermissions::Set, "set"), + ], + Some(SecretPermissions::UnknownValue), + )?; + check( + &[ + (CertificatePermissions::All, "all"), + (CertificatePermissions::Backup, "backup"), + (CertificatePermissions::Create, "create"), + (CertificatePermissions::Delete, "delete"), + (CertificatePermissions::Deleteissuers, "deleteissuers"), + (CertificatePermissions::Get, "get"), + (CertificatePermissions::Getissuers, "getissuers"), + (CertificatePermissions::Import, "import"), + (CertificatePermissions::List, "list"), + (CertificatePermissions::Listissuers, "listissuers"), + (CertificatePermissions::Managecontacts, "managecontacts"), + (CertificatePermissions::Manageissuers, "manageissuers"), + (CertificatePermissions::Purge, "purge"), + (CertificatePermissions::Recover, "recover"), + (CertificatePermissions::Restore, "restore"), + (CertificatePermissions::Setissuers, "setissuers"), + (CertificatePermissions::Update, "update"), + ], + Some(CertificatePermissions::UnknownValue), + )?; + check( + &[ + (StoragePermissions::All, "all"), + (StoragePermissions::Backup, "backup"), + (StoragePermissions::Delete, "delete"), + (StoragePermissions::Deletesas, "deletesas"), + (StoragePermissions::Get, "get"), + (StoragePermissions::Getsas, "getsas"), + (StoragePermissions::List, "list"), + (StoragePermissions::Listsas, "listsas"), + (StoragePermissions::Purge, "purge"), + (StoragePermissions::Recover, "recover"), + (StoragePermissions::Regeneratekey, "regeneratekey"), + (StoragePermissions::Restore, "restore"), + (StoragePermissions::Set, "set"), + (StoragePermissions::Setsas, "setsas"), + (StoragePermissions::Update, "update"), + ], + Some(StoragePermissions::UnknownValue), + )?; + let permissions = models::Permissions { + keys: Some(vec![KeyPermissions::WrapKey]), + secrets: Some(vec![SecretPermissions::Set]), + certificates: Some(vec![CertificatePermissions::Manageissuers]), + storage: Some(vec![StoragePermissions::Getsas]), + }; + let value = serde_json::to_value(&permissions)?; + assert_eq!( + value, + json!({ + "keys": ["wrapKey"], "secrets": ["set"], + "certificates": ["manageissuers"], "storage": ["getsas"], + }) + ); + let decoded: models::Permissions = serde_json::from_value(value)?; + assert_eq!(decoded.keys, permissions.keys); + assert_eq!(decoded.storage, permissions.storage); + Ok(()) +} + +#[test] +fn resource_identity_enum_wire_values() -> Result<()> { + check( + &[ + (CreatedByType::Application, "Application"), + (CreatedByType::Key, "Key"), + (CreatedByType::ManagedIdentity, "ManagedIdentity"), + (CreatedByType::User, "User"), + ], + Some(CreatedByType::UnknownValue), + )?; + check( + &[ + (ManagedServiceIdentityType::None, "None"), + (ManagedServiceIdentityType::SystemAssigned, "SystemAssigned"), + (ManagedServiceIdentityType::UserAssigned, "UserAssigned"), + ( + ManagedServiceIdentityType::SystemAssignedUserAssigned, + "SystemAssigned,UserAssigned", + ), + ], + Some(ManagedServiceIdentityType::UnknownValue), + )?; + let hsm: models::ManagedHsm = serde_json::from_value(json!({ + "identity": {"type": "SystemAssigned,UserAssigned"}, + "systemData": {"createdByType": "Application", "lastModifiedByType": "User"}, + }))?; + assert_eq!( + hsm.identity.as_ref().unwrap().type_prop, + Some(ManagedServiceIdentityType::SystemAssignedUserAssigned) + ); + assert_eq!( + hsm.system_data.as_ref().unwrap().created_by_type, + Some(CreatedByType::Application) + ); + assert_eq!( + serde_json::to_value(hsm)?["identity"]["type"], + "SystemAssigned,UserAssigned" + ); + Ok(()) +} + +#[test] +fn network_rule_enum_wire_values() -> Result<()> { + check( + &[ + (NetworkRuleAction::Allow, "Allow"), + (NetworkRuleAction::Deny, "Deny"), + ], + Some(NetworkRuleAction::UnknownValue), + )?; + check( + &[ + (NetworkRuleBypassOptions::AzureServices, "AzureServices"), + (NetworkRuleBypassOptions::None, "None"), + ], + Some(NetworkRuleBypassOptions::UnknownValue), + )?; + check( + &[ + (PublicNetworkAccess::Disabled, "Disabled"), + (PublicNetworkAccess::Enabled, "Enabled"), + ], + Some(PublicNetworkAccess::UnknownValue), + )?; + let value = json!({"defaultAction":"Deny","bypass":"AzureServices"}); + let vault: models::NetworkRuleSet = serde_json::from_value(value.clone())?; + let hsm: models::MHSMNetworkRuleSet = serde_json::from_value(value.clone())?; + assert_eq!(vault.default_action, Some(NetworkRuleAction::Deny)); + assert_eq!(hsm.bypass, Some(NetworkRuleBypassOptions::AzureServices)); + assert_eq!(serde_json::to_value(vault)?, value); + assert_eq!(serde_json::to_value(hsm)?, value); + Ok(()) +} + +#[test] +fn key_algorithm_enum_wire_values() -> Result<()> { + check( + &[ + (JsonWebKeyType::Ec, "EC"), + (JsonWebKeyType::EcHsm, "EC-HSM"), + (JsonWebKeyType::OctHsm, "oct-HSM"), + (JsonWebKeyType::Rsa, "RSA"), + (JsonWebKeyType::RsaHsm, "RSA-HSM"), + ], + Some(JsonWebKeyType::UnknownValue), + )?; + check( + &[ + (JsonWebKeyCurveName::P256, "P-256"), + (JsonWebKeyCurveName::P256K, "P-256K"), + (JsonWebKeyCurveName::P384, "P-384"), + (JsonWebKeyCurveName::P521, "P-521"), + ], + Some(JsonWebKeyCurveName::UnknownValue), + )?; + check( + &[ + (JsonWebKeyOperation::Decrypt, "decrypt"), + (JsonWebKeyOperation::Encrypt, "encrypt"), + (JsonWebKeyOperation::Import, "import"), + (JsonWebKeyOperation::Release, "release"), + (JsonWebKeyOperation::Sign, "sign"), + (JsonWebKeyOperation::UnwrapKey, "unwrapKey"), + (JsonWebKeyOperation::Verify, "verify"), + (JsonWebKeyOperation::WrapKey, "wrapKey"), + ], + Some(JsonWebKeyOperation::UnknownValue), + )?; + let value = json!({"kty":"EC","curveName":"P-256K","keyOps":["sign","verify"]}); + let vault: models::KeyProperties = serde_json::from_value(value.clone())?; + let hsm: models::ManagedHsmKeyProperties = serde_json::from_value(value.clone())?; + assert_eq!(vault.kty, Some(JsonWebKeyType::Ec)); + assert_eq!(hsm.curve_name, Some(JsonWebKeyCurveName::P256K)); + assert_eq!(serde_json::to_value(vault)?, value); + assert_eq!(serde_json::to_value(hsm)?, value); + Ok(()) +} + +#[test] +fn key_policy_enum_wire_values() -> Result<()> { + // The service returned Notify; the pinned specification declares notify/rotate. + check( + &[ + (KeyRotationPolicyActionType::Notify, "Notify"), + (KeyRotationPolicyActionType::Rotate, "Rotate"), + ], + None, + )?; + check( + &[ + (DeletionRecoveryLevel::Purgeable, "Purgeable"), + (DeletionRecoveryLevel::Recoverable, "Recoverable"), + ( + DeletionRecoveryLevel::RecoverableProtectedSubscription, + "Recoverable+ProtectedSubscription", + ), + ( + DeletionRecoveryLevel::RecoverablePurgeable, + "Recoverable+Purgeable", + ), + ], + Some(DeletionRecoveryLevel::UnknownValue), + )?; + for wire in ["Notify", "Rotate"] { + let value = json!({"type": wire}); + let vault: models::Action = serde_json::from_value(value.clone())?; + let hsm: models::ManagedHsmAction = serde_json::from_value(value.clone())?; + assert_eq!(serde_json::to_value(vault)?, value); + assert_eq!(serde_json::to_value(hsm)?, value); + } + let value = json!({"recoveryLevel":"Recoverable+Purgeable"}); + let vault: models::KeyAttributes = serde_json::from_value(value.clone())?; + let hsm: models::ManagedHsmKeyAttributes = serde_json::from_value(value)?; + assert_eq!( + vault.recovery_level, + Some(DeletionRecoveryLevel::RecoverablePurgeable) + ); + assert_eq!(hsm.recovery_level, vault.recovery_level); + Ok(()) +} + +#[test] +fn private_endpoint_enum_wire_values() -> Result<()> { + check( + &[(ActionsRequired::None, "None")], + Some(ActionsRequired::UnknownValue), + )?; + check( + &[ + ( + PrivateEndpointConnectionProvisioningState::Creating, + "Creating", + ), + ( + PrivateEndpointConnectionProvisioningState::Deleting, + "Deleting", + ), + ( + PrivateEndpointConnectionProvisioningState::Disconnected, + "Disconnected", + ), + (PrivateEndpointConnectionProvisioningState::Failed, "Failed"), + ( + PrivateEndpointConnectionProvisioningState::Succeeded, + "Succeeded", + ), + ( + PrivateEndpointConnectionProvisioningState::Updating, + "Updating", + ), + ], + Some(PrivateEndpointConnectionProvisioningState::UnknownValue), + )?; + check( + &[ + (PrivateEndpointServiceConnectionStatus::Approved, "Approved"), + ( + PrivateEndpointServiceConnectionStatus::Disconnected, + "Disconnected", + ), + (PrivateEndpointServiceConnectionStatus::Pending, "Pending"), + (PrivateEndpointServiceConnectionStatus::Rejected, "Rejected"), + ], + Some(PrivateEndpointServiceConnectionStatus::UnknownValue), + )?; + let value = json!({"properties":{ + "provisioningState":"Succeeded", + "privateLinkServiceConnectionState":{"status":"Approved","actionsRequired":"None"}, + }}); + let vault: models::PrivateEndpointConnection = serde_json::from_value(value.clone())?; + let hsm: models::MHSMPrivateEndpointConnection = serde_json::from_value(value)?; + let vault = vault.properties.unwrap(); + let hsm = hsm.properties.unwrap(); + assert_eq!( + vault.provisioning_state, + Some(PrivateEndpointConnectionProvisioningState::Succeeded) + ); + assert_eq!(hsm.provisioning_state, vault.provisioning_state); + let state = vault.private_link_service_connection_state.unwrap(); + assert_eq!( + state.status, + Some(PrivateEndpointServiceConnectionStatus::Approved) + ); + assert_eq!(state.actions_required, Some(ActionsRequired::None)); + assert_eq!(serde_json::to_value(state)?["status"], "Approved"); + Ok(()) +} + +#[test] +fn managed_hsm_sku_enum_wire_values() -> Result<()> { + check( + &[(ManagedHsmSkuFamily::B, "B"), (ManagedHsmSkuFamily::C, "C")], + Some(ManagedHsmSkuFamily::UnknownValue), + )?; + check( + &[ + (ManagedHsmSkuNameV2::CustomB32, "Custom_B32"), + (ManagedHsmSkuNameV2::CustomB6, "Custom_B6"), + (ManagedHsmSkuNameV2::CustomC10, "Custom_C10"), + (ManagedHsmSkuNameV2::CustomC42, "Custom_C42"), + (ManagedHsmSkuNameV2::StandardB1, "Standard_B1"), + (ManagedHsmSkuNameV2::StandardB10V2, "Standard_B10v2"), + (ManagedHsmSkuNameV2::StandardB15V2, "Standard_B15v2"), + (ManagedHsmSkuNameV2::StandardB1V2, "Standard_B1v2"), + (ManagedHsmSkuNameV2::StandardB20V2, "Standard_B20v2"), + (ManagedHsmSkuNameV2::StandardB5V2, "Standard_B5v2"), + ], + Some(ManagedHsmSkuNameV2::UnknownValue), + )?; + let value = json!({"family":"B","name":"Standard_B10v2"}); + let sku: models::ManagedHsmSku = serde_json::from_value(value.clone())?; + assert_eq!(sku.name, Some(ManagedHsmSkuNameV2::StandardB10V2)); + assert_eq!(serde_json::to_value(sku)?, value); + Ok(()) +} + +#[test] +fn managed_hsm_state_enum_wire_values() -> Result<()> { + check( + &[ + (ActivationStatus::Active, "Active"), + (ActivationStatus::Failed, "Failed"), + (ActivationStatus::NotActivated, "NotActivated"), + (ActivationStatus::Unknown, "Unknown"), + ], + Some(ActivationStatus::UnknownValue), + )?; + check( + &[ + (ProvisioningState::Activated, "Activated"), + (ProvisioningState::Deleting, "Deleting"), + (ProvisioningState::Failed, "Failed"), + (ProvisioningState::Provisioning, "Provisioning"), + (ProvisioningState::Restoring, "Restoring"), + ( + ProvisioningState::SecurityDomainRestore, + "SecurityDomainRestore", + ), + (ProvisioningState::Succeeded, "Succeeded"), + (ProvisioningState::Updating, "Updating"), + ], + Some(ProvisioningState::UnknownValue), + )?; + check( + &[ + (GeoReplicationRegionProvisioningState::Cleanup, "Cleanup"), + (GeoReplicationRegionProvisioningState::Deleting, "Deleting"), + (GeoReplicationRegionProvisioningState::Failed, "Failed"), + ( + GeoReplicationRegionProvisioningState::Preprovisioning, + "Preprovisioning", + ), + ( + GeoReplicationRegionProvisioningState::Provisioning, + "Provisioning", + ), + ( + GeoReplicationRegionProvisioningState::Succeeded, + "Succeeded", + ), + ], + Some(GeoReplicationRegionProvisioningState::UnknownValue), + )?; + let hsm: models::ManagedHsmProperties = serde_json::from_value(json!({ + "provisioningState":"Succeeded", + "securityDomainProperties":{"activationStatus":"NotActivated"}, + "regions":[{"provisioningState":"Succeeded"}], + }))?; + assert_eq!(hsm.provisioning_state, Some(ProvisioningState::Succeeded)); + assert_eq!( + hsm.security_domain_properties.unwrap().activation_status, + Some(ActivationStatus::NotActivated) + ); + assert_eq!( + hsm.regions.unwrap()[0].provisioning_state, + Some(GeoReplicationRegionProvisioningState::Succeeded) + ); + Ok(()) +} + +#[test] +fn name_availability_enum_wire_values() -> Result<()> { + check( + &[ + (Reason::AccountNameInvalid, "AccountNameInvalid"), + (Reason::AlreadyExists, "AlreadyExists"), + ], + Some(Reason::UnknownValue), + )?; + for (wire, expected) in [ + ("AccountNameInvalid", Reason::AccountNameInvalid), + ("AlreadyExists", Reason::AlreadyExists), + ] { + let value = json!({"nameAvailable":false,"reason":wire}); + let vault: models::CheckNameAvailabilityResult = serde_json::from_value(value.clone())?; + let hsm: models::CheckMhsmNameAvailabilityResult = serde_json::from_value(value)?; + assert_eq!(vault.reason, Some(expected)); + assert_eq!(hsm.reason, vault.reason); + } + Ok(()) +} + +#[test] +fn operation_status_enum_wire_values() -> Result<()> { + check( + &[ + (ResourceProvisioningState::Canceled, "Canceled"), + (ResourceProvisioningState::Failed, "Failed"), + (ResourceProvisioningState::Succeeded, "Succeeded"), + ], + Some(ResourceProvisioningState::UnknownValue), + )?; + for (wire, expected) in [ + ("Canceled", ResourceProvisioningState::Canceled), + ("Failed", ResourceProvisioningState::Failed), + ("Succeeded", ResourceProvisioningState::Succeeded), + ] { + let value: Value = json!({"status":wire}); + let vault: models::KeyVaultVaultsClientBeginCreateOrUpdateOperationStatus = + serde_json::from_value(value.clone())?; + let hsm: models::KeyVaultManagedHsmsClientBeginDeleteOperationStatus = + serde_json::from_value(value)?; + assert_eq!(vault.status, Some(expected)); + assert_eq!(hsm.status, vault.status); + } + Ok(()) +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tests/common/mod.rs b/sdk/keyvault/azure_resourcemanager_keyvault/tests/common/mod.rs new file mode 100644 index 0000000000..a3e5a909e1 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/common/mod.rs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core::{ + http::{Response, Url}, + Bytes, Result, +}; +use azure_core_test::{TestContext, SANITIZE_BODY_NAME}; +use azure_resourcemanager_keyvault::{ + models::{CreatedByType, SystemData}, + KeyVaultClient, KeyVaultClientOptions, +}; +use serde::de::DeserializeOwned; +use serde_json::Value; +use std::fmt::Debug; + +pub async fn client(ctx: &TestContext) -> Result { + let recording = ctx.recording(); + // The recursive name sanitizer also replaces SKU enum values. + recording.remove_sanitizers(&[SANITIZE_BODY_NAME]).await?; + let mut options = KeyVaultClientOptions::default(); + recording.instrument(&mut options.client_options); + let client = KeyVaultClient::new( + recording.var("KEYVAULT_SUBSCRIPTION_ID", None), + recording.credential(), + Some(options), + )?; + let endpoint: Url = recording + .var("KEYVAULT_RESOURCE_MANAGER_URL", None) + .parse()?; + assert_eq!(client.endpoint(), &endpoint); + Ok(client) +} + +pub fn model_and_json(response: Response) -> Result<(T, Value)> { + let bytes = Bytes::from(response.to_raw_response().into_body()); + let value = serde_json::from_slice(&bytes)?; + Ok((response.into_model()?, value)) +} + +pub fn assert_system_data(data: Option<&SystemData>, raw: &Value) { + if let Some(data) = data { + for (actual, field) in [ + (&data.created_by_type, "createdByType"), + (&data.last_modified_by_type, "lastModifiedByType"), + ] { + if let Some(actual) = actual { + assert!(matches!( + actual, + CreatedByType::Application + | CreatedByType::Key + | CreatedByType::ManagedIdentity + | CreatedByType::User + )); + assert_eq!(raw["systemData"][field].as_str(), Some(actual.as_ref())); + } + } + } +} + +pub fn assert_enum_values + Debug + PartialEq>( + actual: Option<&[E]>, + expected: Option<&[E]>, + raw: &Value, +) { + if let Some(expected) = expected { + let actual = actual.unwrap(); + let raw = raw.as_array().unwrap(); + assert_eq!(actual.len(), expected.len()); + assert_eq!(raw.len(), expected.len()); + for value in expected { + assert!(actual.contains(value), "missing named variant {value:?}"); + assert!(raw.iter().any(|raw| raw.as_str() == Some(value.as_ref()))); + } + } else { + assert!(actual.is_none_or(<[E]>::is_empty)); + assert!(raw.is_null() || raw.as_array().is_some_and(Vec::is_empty)); + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tests/managed_hsms.rs b/sdk/keyvault/azure_resourcemanager_keyvault/tests/managed_hsms.rs new file mode 100644 index 0000000000..20388ceef8 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/managed_hsms.rs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +mod common; + +use azure_core::{http::Url, Result}; +use azure_core_test::{recorded, TestContext}; +use azure_resourcemanager_keyvault::models::{ + ActivationStatus, CreateMode, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, + JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, KeyRotationPolicyActionType, + MHSMNetworkRuleSet, ManagedHsm, ManagedHsmKey, ManagedHsmKeyCreateParameters, + ManagedHsmKeyProperties, ManagedHsmProperties, ManagedHsmSku, ManagedHsmSkuFamily, + ManagedHsmSkuNameV2, NetworkRuleAction, NetworkRuleBypassOptions, ProvisioningState, + PublicNetworkAccess, +}; +use common::{assert_enum_values, assert_system_data, client, model_and_json}; +use futures::TryStreamExt as _; +use serde_json::Value; +use std::collections::HashMap; + +fn hsm_parameters(ctx: &TestContext) -> Result { + let recording = ctx.recording(); + Ok(ManagedHsm { + location: Some(recording.var("KEYVAULT_LOCATION", None)), + properties: Some(ManagedHsmProperties { + create_mode: Some(CreateMode::Default), + tenant_id: Some(recording.var("KEYVAULT_TENANT_ID", None).parse()?), + initial_admin_object_ids: Some(vec![recording.var("KEYVAULT_OBJECT_ID", None)]), + ..Default::default() + }), + sku: Some(ManagedHsmSku { + family: Some(ManagedHsmSkuFamily::B), + name: Some(ManagedHsmSkuNameV2::StandardB1), + }), + ..Default::default() + }) +} + +fn assert_hsm(hsm: &ManagedHsm, raw: &Value) { + let sku = hsm.sku.as_ref().unwrap(); + assert_eq!(sku.family, Some(ManagedHsmSkuFamily::B)); + assert_eq!(sku.name, Some(ManagedHsmSkuNameV2::StandardB1)); + assert_eq!(raw["sku"]["family"], "B"); + assert_eq!(raw["sku"]["name"], "Standard_B1"); + let properties = hsm.properties.as_ref().unwrap(); + let state = properties.provisioning_state.as_ref().unwrap(); + assert!(matches!( + state, + ProvisioningState::Succeeded | ProvisioningState::Activated + )); + assert_eq!( + raw["properties"]["provisioningState"].as_str(), + Some(state.as_ref()) + ); + if let Some(activation) = properties + .security_domain_properties + .as_ref() + .and_then(|domain| domain.activation_status.as_ref()) + { + assert!(matches!( + activation, + ActivationStatus::Active | ActivationStatus::NotActivated + )); + assert_eq!( + raw["properties"]["securityDomainProperties"]["activationStatus"].as_str(), + Some(activation.as_ref()) + ); + } + if let Some(regions) = &properties.regions { + for (region, raw_region) in regions + .iter() + .zip(raw["properties"]["regions"].as_array().unwrap()) + { + if let Some(state) = ®ion.provisioning_state { + assert!(matches!( + state, + GeoReplicationRegionProvisioningState::Cleanup + | GeoReplicationRegionProvisioningState::Deleting + | GeoReplicationRegionProvisioningState::Failed + | GeoReplicationRegionProvisioningState::Preprovisioning + | GeoReplicationRegionProvisioningState::Provisioning + | GeoReplicationRegionProvisioningState::Succeeded + )); + assert_eq!( + raw_region["provisioningState"].as_str(), + Some(state.as_ref()) + ); + } + } + } + assert_system_data(hsm.system_data.as_ref(), raw); +} + +#[recorded::test] +#[ignore = "requires Managed HSM availability, quota, and special provisioning"] +async fn managed_hsm_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let name = recording.random_string::<16>(Some("h")); + let hsms = client.get_key_vault_managed_hsms_client(); + let (hsm, raw) = model_and_json( + hsms.begin_create_or_update(&group, &name, hsm_parameters(&ctx)?.try_into()?, None)? + .await?, + )?; + assert_eq!(hsm.name.as_deref(), Some(name.as_str())); + assert_hsm(&hsm, &raw); + let (hsm, raw) = model_and_json(hsms.get(&group, &name, None).await?)?; + assert_hsm(&hsm, &raw); + let mut pager = hsms.list_by_resource_group(&group, None)?.into_stream(); + let mut found = false; + while let Some(hsm) = pager.try_next().await? { + found |= hsm.name.as_deref() == Some(name.as_str()); + } + assert!(found); + let (hsm, raw) = model_and_json( + hsms.begin_update( + &group, + &name, + ManagedHsm { + tags: Some(HashMap::from([("updated".into(), "true".into())])), + ..Default::default() + } + .try_into()?, + None, + )? + .await?, + )?; + assert_hsm(&hsm, &raw); + assert_eq!( + hsm.tags + .as_ref() + .and_then(|tags| tags.get("updated")) + .map(String::as_str), + Some("true") + ); + hsms.begin_delete(&group, &name, None)?.await?; + Ok(()) +} + +#[recorded::test] +#[ignore = "requires a test-created Managed HSM and regional quota"] +async fn managed_hsm_network_rules(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let name = recording.random_string::<16>(Some("h")); + let hsms = client.get_key_vault_managed_hsms_client(); + hsms.begin_create_or_update(&group, &name, hsm_parameters(&ctx)?.try_into()?, None)? + .await?; + for (action, bypass, public) in [ + ( + NetworkRuleAction::Deny, + NetworkRuleBypassOptions::None, + PublicNetworkAccess::Disabled, + ), + ( + NetworkRuleAction::Allow, + NetworkRuleBypassOptions::AzureServices, + PublicNetworkAccess::Enabled, + ), + ] { + let response = hsms + .begin_update( + &group, + &name, + ManagedHsm { + properties: Some(ManagedHsmProperties { + network_acls: Some(MHSMNetworkRuleSet { + default_action: Some(action.clone()), + bypass: Some(bypass.clone()), + ..Default::default() + }), + public_network_access: Some(public.clone()), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + )? + .await?; + for response in [response, hsms.get(&group, &name, None).await?] { + let (hsm, raw) = model_and_json(response)?; + assert_hsm(&hsm, &raw); + let properties = hsm.properties.unwrap(); + let rules = properties.network_acls.unwrap(); + assert_eq!(rules.default_action.as_ref(), Some(&action)); + assert_eq!(rules.bypass.as_ref(), Some(&bypass)); + assert_eq!(properties.public_network_access.as_ref(), Some(&public)); + assert_eq!( + raw["properties"]["networkAcls"]["defaultAction"].as_str(), + Some(action.as_ref()) + ); + assert_eq!( + raw["properties"]["networkAcls"]["bypass"].as_str(), + Some(bypass.as_ref()) + ); + assert_eq!( + raw["properties"]["publicNetworkAccess"].as_str(), + Some(public.as_ref()) + ); + } + } + hsms.begin_delete(&group, &name, None)?.await?; + Ok(()) +} + +fn assert_key( + key: &ManagedHsmKey, + raw: &Value, + kty: &JsonWebKeyType, + curve: Option<&JsonWebKeyCurveName>, + operations: &[JsonWebKeyOperation], +) { + let properties = key.properties.as_ref().unwrap(); + assert_eq!(properties.kty.as_ref(), Some(kty)); + assert_eq!(raw["properties"]["kty"].as_str(), Some(kty.as_ref())); + assert_eq!(properties.curve_name.as_ref(), curve); + if let Some(curve) = curve { + assert_eq!( + raw["properties"]["curveName"].as_str(), + Some(curve.as_ref()) + ); + } + assert_enum_values( + properties.key_ops.as_deref(), + Some(operations), + &raw["properties"]["keyOps"], + ); + if let Some(level) = properties + .attributes + .as_ref() + .and_then(|attributes| attributes.recovery_level.as_ref()) + { + assert!(matches!( + level, + DeletionRecoveryLevel::Purgeable + | DeletionRecoveryLevel::Recoverable + | DeletionRecoveryLevel::RecoverableProtectedSubscription + | DeletionRecoveryLevel::RecoverablePurgeable + )); + assert_eq!( + raw["properties"]["attributes"]["recoveryLevel"].as_str(), + Some(level.as_ref()) + ); + } + if let Some(policy) = &properties.rotation_policy { + if let Some(actions) = &policy.lifetime_actions { + let raw_actions = raw["properties"]["rotationPolicy"]["lifetimeActions"] + .as_array() + .unwrap(); + assert_eq!(actions.len(), raw_actions.len()); + for (action, raw_action) in actions.iter().zip(raw_actions) { + let action = action.action.as_ref().unwrap().type_prop.unwrap(); + assert!(matches!( + action, + KeyRotationPolicyActionType::Notify | KeyRotationPolicyActionType::Rotate + )); + assert_eq!(raw_action["action"]["type"].as_str(), Some(action.as_ref())); + } + } + } +} + +#[recorded::test] +#[ignore = "requires a dedicated activated disposable HSM with external provisioning and teardown"] +async fn managed_hsm_key_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + assert_eq!( + recording.var("KEYVAULT_MANAGED_HSM_DISPOSABLE", None), + "true", + "the fixture owner must arrange disposal of this activated test HSM" + ); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let hsm = recording.var("KEYVAULT_MANAGED_HSM_NAME", None); + let keys = client.get_key_vault_managed_hsm_keys_client(); + let mut names = Vec::new(); + for (kty, curve, operations) in [ + ( + JsonWebKeyType::RsaHsm, + None, + vec![ + JsonWebKeyOperation::Encrypt, + JsonWebKeyOperation::Decrypt, + JsonWebKeyOperation::WrapKey, + JsonWebKeyOperation::UnwrapKey, + ], + ), + ( + JsonWebKeyType::EcHsm, + Some(JsonWebKeyCurveName::P256), + vec![JsonWebKeyOperation::Sign, JsonWebKeyOperation::Verify], + ), + ] { + let name = recording.random_string::<16>(Some("k")); + let (key, raw) = model_and_json( + keys.create_if_not_exist( + &group, + &hsm, + &name, + ManagedHsmKeyCreateParameters { + properties: Some(ManagedHsmKeyProperties { + kty: Some(kty.clone()), + key_size: if curve.is_none() { Some(2048) } else { None }, + curve_name: curve.clone(), + key_ops: Some(operations.clone()), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await?, + )?; + assert_key(&key, &raw, &kty, curve.as_ref(), &operations); + let (key, raw) = model_and_json(keys.get(&group, &hsm, &name, None).await?)?; + assert_key(&key, &raw, &kty, curve.as_ref(), &operations); + let url: Url = key + .properties + .as_ref() + .unwrap() + .key_uri_with_version + .as_ref() + .unwrap() + .parse()?; + let version = url.path_segments().unwrap().next_back().unwrap(); + let (key, raw) = + model_and_json(keys.get_version(&group, &hsm, &name, version, None).await?)?; + assert_key(&key, &raw, &kty, curve.as_ref(), &operations); + let mut versions = keys.list_versions(&group, &hsm, &name, None)?.into_stream(); + let mut count = 0; + while let Some(key) = versions.try_next().await? { + if let Some(actual) = key.properties.and_then(|properties| properties.kty) { + assert_eq!(actual, kty); + } + count += 1; + } + assert_eq!(count, 1); + names.push(name); + } + let mut pager = keys.list(&group, &hsm, None)?.into_stream(); + while let Some(key) = pager.try_next().await? { + if let Some(name) = key.name { + names.retain(|expected| expected != &name); + } + } + assert!(names.is_empty()); + Ok(()) +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tests/readme.rs b/sdk/keyvault/azure_resourcemanager_keyvault/tests/readme.rs new file mode 100644 index 0000000000..e756edabeb --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/readme.rs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core::{http::Url, Result}; +use azure_core_test::{recorded, TestContext, SANITIZE_BODY_NAME}; +use azure_resourcemanager_keyvault::{KeyVaultClient, KeyVaultClientOptions}; +use include_file::include_markdown; + +#[test] +fn client_configuration_examples_compile() { + { + include_markdown!("README.md", "create_client"); + let _ = main as fn() -> Result<()>; + } + { + include_markdown!("README.md", "create_custom_cloud_client"); + let _ = main as fn() -> Result<()>; + } +} + +#[recorded::test] +async fn readme(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + recording.remove_sanitizers(&[SANITIZE_BODY_NAME]).await?; + let mut options = KeyVaultClientOptions::default(); + recording.instrument(&mut options.client_options); + let client = KeyVaultClient::new( + recording.var("KEYVAULT_SUBSCRIPTION_ID", None), + recording.credential(), + Some(options), + )?; + let endpoint: Url = recording + .var("KEYVAULT_RESOURCE_MANAGER_URL", None) + .parse()?; + assert_eq!(client.endpoint(), &endpoint); + let vaults = client.get_key_vault_vaults_client(); + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let location = recording.var("KEYVAULT_LOCATION", None); + let tenant_id = recording.var("KEYVAULT_TENANT_ID", None); + let vault_name = recording.random_string::<16>(Some("v")); + let missing_vault_name = recording.random_string::<16>(Some("missing")); + + include_markdown!("README.md", "create_vault", scope); + include_markdown!("README.md", "list_vaults", scope); + include_markdown!("README.md", "update_vault", scope); + include_markdown!("README.md", "errors", scope); + include_markdown!("README.md", "delete_vault", scope); + Ok(()) +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tests/vaults.rs b/sdk/keyvault/azure_resourcemanager_keyvault/tests/vaults.rs new file mode 100644 index 0000000000..22cca0084f --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/vaults.rs @@ -0,0 +1,724 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +mod common; + +use azure_core::{ + http::{StatusCode, Url}, + Result, +}; +use azure_core_test::{recorded, TestContext, TestMode}; +use azure_resourcemanager_keyvault::{ + models::{ + AccessPolicyEntry, AccessPolicyUpdateKind, Action, CertificatePermissions, CreateMode, + DeletionRecoveryLevel, JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, Key, + KeyCreateParameters, KeyPermissions, KeyProperties, KeyRotationPolicyActionType, + KeyRotationPolicyAttributes, LifetimeAction, NetworkRuleAction, NetworkRuleBypassOptions, + NetworkRuleSet, Permissions, Reason, RotationPolicy, SecretCreateOrUpdateParameters, + SecretPatchParameters, SecretPatchProperties, SecretPermissions, SecretProperties, Sku, + SkuFamily, SkuName, StoragePermissions, Trigger, Vault, VaultAccessPolicyParameters, + VaultAccessPolicyProperties, VaultCheckNameAvailabilityParameters, + VaultCreateOrUpdateParameters, VaultPatchParameters, VaultPatchProperties, VaultProperties, + VaultProvisioningState, + }, + KeyVaultClient, +}; +use azure_security_keyvault_test::Retry; +use common::{assert_enum_values, assert_system_data, client, model_and_json}; +use futures::TryStreamExt as _; +use serde_json::Value; +use std::collections::HashMap; + +fn vault_parameters(ctx: &TestContext) -> Result { + let recording = ctx.recording(); + Ok(VaultCreateOrUpdateParameters { + location: Some(recording.var("KEYVAULT_LOCATION", None)), + properties: Some(VaultProperties { + create_mode: Some(CreateMode::Default), + tenant_id: Some(recording.var("KEYVAULT_TENANT_ID", None).parse()?), + sku: Some(Sku { + family: Some(SkuFamily::A), + name: Some(SkuName::Standard), + }), + access_policies: Some(vec![]), + enable_rbac_authorization: Some(true), + enable_soft_delete: Some(true), + soft_delete_retention_in_days: Some(7), + ..Default::default() + }), + ..Default::default() + }) +} + +fn assert_vault(vault: &Vault, raw: &Value) { + let properties = vault.properties.as_ref().unwrap(); + let sku = properties.sku.as_ref().unwrap(); + assert_eq!(sku.family, Some(SkuFamily::A)); + assert_eq!(sku.name, Some(SkuName::Standard)); + assert_eq!(raw["properties"]["sku"]["family"], "A"); + assert_eq!(raw["properties"]["sku"]["name"], "standard"); + assert_eq!( + properties.provisioning_state, + Some(VaultProvisioningState::Succeeded) + ); + assert_eq!(raw["properties"]["provisioningState"], "Succeeded"); + assert_system_data(vault.system_data.as_ref(), raw); +} + +async fn create_vault(ctx: &TestContext, client: &KeyVaultClient, name: &str) -> Result<()> { + let recording = ctx.recording(); + let (vault, raw) = model_and_json( + client + .get_key_vault_vaults_client() + .begin_create_or_update( + &recording.var("KEYVAULT_RESOURCE_GROUP", None), + name, + vault_parameters(ctx)?.try_into()?, + None, + )? + .await?, + )?; + assert_eq!(vault.name.as_deref(), Some(name)); + assert_vault(&vault, &raw); + Ok(()) +} + +fn assert_key( + key: &Key, + raw: &Value, + kty: &JsonWebKeyType, + curve: Option<&JsonWebKeyCurveName>, + operations: &[JsonWebKeyOperation], +) { + let properties = key.properties.as_ref().unwrap(); + assert_eq!(properties.kty.as_ref(), Some(kty)); + assert_eq!(raw["properties"]["kty"].as_str(), Some(kty.as_ref())); + assert_eq!(properties.curve_name.as_ref(), curve); + if let Some(curve) = curve { + assert_eq!( + raw["properties"]["curveName"].as_str(), + Some(curve.as_ref()) + ); + } + assert_enum_values( + properties.key_ops.as_deref(), + Some(operations), + &raw["properties"]["keyOps"], + ); + if let Some(level) = properties + .attributes + .as_ref() + .and_then(|attributes| attributes.recovery_level.as_ref()) + { + // Seven-day retention returns a value missing from the specification. + assert_eq!( + level, + &DeletionRecoveryLevel::UnknownValue("CustomizedRecoverable+Purgeable".into()) + ); + assert_eq!( + raw["properties"]["attributes"]["recoveryLevel"], + "CustomizedRecoverable+Purgeable" + ); + } +} + +fn key_version(key: &Key) -> Result { + let url: Url = key + .properties + .as_ref() + .unwrap() + .key_uri_with_version + .as_ref() + .unwrap() + .parse()?; + Ok(url + .path_segments() + .unwrap() + .next_back() + .unwrap() + .to_string()) +} + +#[recorded::test] +async fn key_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let vault_name = recording.random_string::<16>(Some("v")); + let key_name = recording.random_string::<16>(Some("k")); + create_vault(&ctx, &client, &vault_name).await?; + let keys = client.get_key_vault_keys_client(); + let operations = vec![ + JsonWebKeyOperation::Encrypt, + JsonWebKeyOperation::Decrypt, + JsonWebKeyOperation::WrapKey, + JsonWebKeyOperation::UnwrapKey, + ]; + let (key, raw) = model_and_json( + keys.create_if_not_exist( + &resource_group, + &vault_name, + &key_name, + KeyCreateParameters { + properties: Some(KeyProperties { + kty: Some(JsonWebKeyType::Rsa), + key_size: Some(2048), + key_ops: Some(operations.clone()), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await?, + )?; + assert_eq!(key.name.as_deref(), Some(key_name.as_str())); + assert_key(&key, &raw, &JsonWebKeyType::Rsa, None, &operations); + let mut pager = keys.list(&resource_group, &vault_name, None)?.into_stream(); + let mut found = false; + while let Some(key) = pager.try_next().await? { + found |= key.name.as_deref() == Some(key_name.as_str()); + } + assert!(found); + let (key, raw) = model_and_json( + keys.get(&resource_group, &vault_name, &key_name, None) + .await?, + )?; + assert_eq!(key.name.as_deref(), Some(key_name.as_str())); + assert_key(&key, &raw, &JsonWebKeyType::Rsa, None, &operations); + let (versioned, raw) = model_and_json( + keys.get_version( + &resource_group, + &vault_name, + &key_name, + &key_version(&key)?, + None, + ) + .await?, + )?; + assert_key(&versioned, &raw, &JsonWebKeyType::Rsa, None, &operations); + let mut versions = keys + .list_versions(&resource_group, &vault_name, &key_name, None)? + .into_stream(); + let mut count = 0; + while let Some(version) = versions.try_next().await? { + if let Some(kty) = version + .properties + .as_ref() + .and_then(|properties| properties.kty.as_ref()) + { + assert_eq!(kty, &JsonWebKeyType::Rsa); + } + count += 1; + } + assert_eq!(count, 1); + client + .get_key_vault_vaults_client() + .delete(&resource_group, &vault_name, None) + .await?; + Ok(()) +} + +#[recorded::test] +async fn ec_key_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let vault = recording.random_string::<16>(Some("v")); + create_vault(&ctx, &client, &vault).await?; + let keys = client.get_key_vault_keys_client(); + let operations = vec![JsonWebKeyOperation::Sign, JsonWebKeyOperation::Verify]; + for curve in [ + JsonWebKeyCurveName::P256, + JsonWebKeyCurveName::P256K, + JsonWebKeyCurveName::P384, + JsonWebKeyCurveName::P521, + ] { + let name = recording.random_string::<16>(Some("k")); + let (key, raw) = model_and_json( + keys.create_if_not_exist( + &group, + &vault, + &name, + KeyCreateParameters { + properties: Some(KeyProperties { + kty: Some(JsonWebKeyType::Ec), + curve_name: Some(curve.clone()), + key_ops: Some(operations.clone()), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await?, + )?; + assert_key(&key, &raw, &JsonWebKeyType::Ec, Some(&curve), &operations); + let (key, raw) = model_and_json(keys.get(&group, &vault, &name, None).await?)?; + assert_key(&key, &raw, &JsonWebKeyType::Ec, Some(&curve), &operations); + let (versioned, raw) = model_and_json( + keys.get_version(&group, &vault, &name, &key_version(&key)?, None) + .await?, + )?; + assert_key( + &versioned, + &raw, + &JsonWebKeyType::Ec, + Some(&curve), + &operations, + ); + let mut versions = keys + .list_versions(&group, &vault, &name, None)? + .into_stream(); + let mut count = 0; + while let Some(version) = versions.try_next().await? { + if let Some(properties) = version.properties { + if let Some(actual) = properties.kty { + assert_eq!(actual, JsonWebKeyType::Ec); + } + if let Some(actual) = properties.curve_name { + assert_eq!(actual, curve); + } + } + count += 1; + } + assert_eq!(count, 1); + } + let mut keys = keys.list(&group, &vault, None)?.into_stream(); + let mut count = 0; + while let Some(key) = keys.try_next().await? { + if let Some(kty) = key.properties.and_then(|properties| properties.kty) { + assert_eq!(kty, JsonWebKeyType::Ec); + } + count += 1; + } + assert_eq!(count, 4); + client + .get_key_vault_vaults_client() + .delete(&group, &vault, None) + .await?; + Ok(()) +} + +#[recorded::test] +async fn key_rotation_policy(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let vault = recording.random_string::<16>(Some("v")); + let name = recording.random_string::<16>(Some("k")); + create_vault(&ctx, &client, &vault).await?; + let keys = client.get_key_vault_keys_client(); + let policy = RotationPolicy { + attributes: Some(KeyRotationPolicyAttributes { + expiry_time: Some("P1Y".into()), + ..Default::default() + }), + lifetime_actions: Some(vec![ + LifetimeAction { + action: Some(Action { + type_prop: Some(KeyRotationPolicyActionType::Notify), + }), + trigger: Some(Trigger { + time_before_expiry: Some("P30D".into()), + ..Default::default() + }), + }, + LifetimeAction { + action: Some(Action { + type_prop: Some(KeyRotationPolicyActionType::Rotate), + }), + trigger: Some(Trigger { + time_after_create: Some("P90D".into()), + ..Default::default() + }), + }, + ]), + }; + let key = keys + .create_if_not_exist( + &group, + &vault, + &name, + KeyCreateParameters { + properties: Some(KeyProperties { + kty: Some(JsonWebKeyType::Rsa), + key_size: Some(2048), + rotation_policy: Some(policy), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await? + .into_model()?; + let version = key_version(&key)?; + let (key, raw) = model_and_json(keys.get(&group, &vault, &name, None).await?)?; + let actions = key + .properties + .unwrap() + .rotation_policy + .unwrap() + .lifetime_actions + .unwrap(); + let raw_actions = raw["properties"]["rotationPolicy"]["lifetimeActions"] + .as_array() + .unwrap(); + assert_eq!(actions.len(), 2); + for (expected, wire) in [ + (KeyRotationPolicyActionType::Notify, "Notify"), + (KeyRotationPolicyActionType::Rotate, "Rotate"), + ] { + assert!(actions.iter().any(|action| action + .action + .as_ref() + .and_then(|action| action.type_prop) + == Some(expected))); + assert!(raw_actions + .iter() + .any(|action| action["action"]["type"] == wire)); + } + let versioned = keys + .get_version(&group, &vault, &name, &version, None) + .await? + .into_model()?; + assert_eq!(key_version(&versioned)?, version); + assert_eq!(versioned.properties.unwrap().kty, Some(JsonWebKeyType::Rsa)); + client + .get_key_vault_vaults_client() + .delete(&group, &vault, None) + .await?; + Ok(()) +} + +#[recorded::test] +async fn vault_network_rules(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let name = recording.random_string::<16>(Some("v")); + create_vault(&ctx, &client, &name).await?; + let vaults = client.get_key_vault_vaults_client(); + for (action, bypass) in [ + (NetworkRuleAction::Deny, NetworkRuleBypassOptions::None), + ( + NetworkRuleAction::Deny, + NetworkRuleBypassOptions::AzureServices, + ), + (NetworkRuleAction::Allow, NetworkRuleBypassOptions::None), + ( + NetworkRuleAction::Allow, + NetworkRuleBypassOptions::AzureServices, + ), + ] { + let (vault, raw) = model_and_json( + vaults + .update( + &group, + &name, + VaultPatchParameters { + properties: Some(VaultPatchProperties { + network_acls: Some(NetworkRuleSet { + default_action: Some(action.clone()), + bypass: Some(bypass.clone()), + ..Default::default() + }), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await?, + )?; + for (vault, raw) in [ + (vault, raw), + model_and_json(vaults.get(&group, &name, None).await?)?, + ] { + let rules = vault.properties.unwrap().network_acls; + let Some(rules) = rules else { + // The service omits ACLs when restoring both defaults. + assert_eq!(action, NetworkRuleAction::Allow); + assert_eq!(bypass, NetworkRuleBypassOptions::AzureServices); + assert!(raw["properties"]["networkAcls"].is_null()); + continue; + }; + assert_eq!(rules.default_action.as_ref(), Some(&action)); + assert_eq!(rules.bypass.as_ref(), Some(&bypass)); + assert_eq!( + raw["properties"]["networkAcls"]["defaultAction"].as_str(), + Some(action.as_ref()) + ); + assert_eq!( + raw["properties"]["networkAcls"]["bypass"].as_str(), + Some(bypass.as_ref()) + ); + } + } + vaults.delete(&group, &name, None).await?; + Ok(()) +} + +#[recorded::test] +async fn vault_access_policies(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let name = recording.random_string::<16>(Some("v")); + let mut parameters = vault_parameters(&ctx)?; + parameters + .properties + .as_mut() + .unwrap() + .enable_rbac_authorization = Some(false); + let vaults = client.get_key_vault_vaults_client(); + let (vault, raw) = model_and_json( + vaults + .begin_create_or_update(&group, &name, parameters.try_into()?, None)? + .await?, + )?; + assert_vault(&vault, &raw); + let permissions = Permissions { + keys: Some(vec![ + KeyPermissions::Getrotationpolicy, + KeyPermissions::Setrotationpolicy, + KeyPermissions::WrapKey, + KeyPermissions::UnwrapKey, + ]), + secrets: Some(vec![SecretPermissions::Get, SecretPermissions::Set]), + certificates: Some(vec![ + CertificatePermissions::Getissuers, + CertificatePermissions::Managecontacts, + CertificatePermissions::Manageissuers, + ]), + storage: Some(vec![ + StoragePermissions::Getsas, + StoragePermissions::Setsas, + StoragePermissions::Regeneratekey, + ]), + }; + let mut entry = AccessPolicyEntry { + tenant_id: Some(recording.var("KEYVAULT_TENANT_ID", None).parse()?), + object_id: Some(recording.var("KEYVAULT_OBJECT_ID", None)), + permissions: Some(Permissions { + keys: Some(vec![KeyPermissions::Get]), + ..Default::default() + }), + ..Default::default() + }; + for kind in [ + AccessPolicyUpdateKind::Add, + AccessPolicyUpdateKind::Replace, + AccessPolicyUpdateKind::Remove, + ] { + if kind == AccessPolicyUpdateKind::Replace { + entry.permissions = Some(permissions.clone()); + } + vaults + .update_access_policy( + &group, + &name, + kind, + VaultAccessPolicyParameters { + properties: Some(VaultAccessPolicyProperties { + access_policies: Some(vec![entry.clone()]), + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await?; + let (vault, raw) = model_and_json(vaults.get(&group, &name, None).await?)?; + let policies = vault.properties.unwrap().access_policies.unwrap(); + if kind == AccessPolicyUpdateKind::Remove { + assert!(policies.is_empty()); + } else { + assert_eq!(policies.len(), 1); + let expected = entry.permissions.as_ref().unwrap(); + let actual = policies[0].permissions.as_ref().unwrap(); + let raw = &raw["properties"]["accessPolicies"][0]["permissions"]; + assert_enum_values( + actual.keys.as_deref(), + expected.keys.as_deref(), + &raw["keys"], + ); + assert_enum_values( + actual.secrets.as_deref(), + expected.secrets.as_deref(), + &raw["secrets"], + ); + assert_enum_values( + actual.certificates.as_deref(), + expected.certificates.as_deref(), + &raw["certificates"], + ); + assert_enum_values( + actual.storage.as_deref(), + expected.storage.as_deref(), + &raw["storage"], + ); + } + } + vaults.delete(&group, &name, None).await?; + Ok(()) +} + +#[recorded::test] +async fn vault_recovery(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let location = recording.var("KEYVAULT_LOCATION", None); + let name = recording.random_string::<16>(Some("v")); + create_vault(&ctx, &client, &name).await?; + let vaults = client.get_key_vault_vaults_client(); + vaults.delete(&group, &name, None).await?; + let mut retry = match recording.test_mode() { + TestMode::Playback => Retry::immediate(), + _ => Retry::progressive(None), + }; + for attempt in 0..10 { + match vaults.get_deleted(&location, &name, None).await { + Ok(response) => { + assert_eq!(response.into_model()?.name.as_deref(), Some(name.as_str())); + break; + } + Err(error) if error.http_status() == Some(StatusCode::NotFound) => { + eprintln!("Waiting for soft-deleted test vault to become visible"); + if attempt == 9 || retry.next().await.is_none() { + return Err(error); + } + } + Err(error) => return Err(error), + } + } + let mut parameters = vault_parameters(&ctx)?; + parameters.properties.as_mut().unwrap().create_mode = Some(CreateMode::Recover); + let (vault, raw) = model_and_json( + vaults + .begin_create_or_update(&group, &name, parameters.try_into()?, None)? + .await?, + )?; + assert_vault(&vault, &raw); + let (vault, raw) = model_and_json(vaults.get(&group, &name, None).await?)?; + assert_vault(&vault, &raw); + vaults.delete(&group, &name, None).await?; + Ok(()) +} + +#[recorded::test] +#[ignore = "the service returns undeclared reason Invalid; awaiting a TypeSpec contract correction"] +async fn vault_name_availability(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let endpoint: Url = recording.var("AZURE_KEYVAULT_URL", None).parse()?; + let name = endpoint.host_str().unwrap().split('.').next().unwrap(); + let vaults = client.get_key_vault_vaults_client(); + for (name, expected) in [ + ("invalid_vault_name", Reason::AccountNameInvalid), + (name, Reason::AlreadyExists), + ] { + let (result, raw) = model_and_json( + vaults + .check_name_availability( + VaultCheckNameAvailabilityParameters { + name: Some(name.into()), + ..Default::default() + } + .try_into()?, + None, + ) + .await?, + )?; + assert_eq!(result.name_available, Some(false)); + assert_eq!(raw["reason"].as_str(), Some(expected.as_ref())); + assert_eq!(result.reason, Some(expected)); + } + Ok(()) +} + +#[recorded::test] +async fn secret_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + let client = client(&ctx).await?; + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let vault_name = recording.random_string::<16>(Some("v")); + let secret_name = recording.random_string::<16>(Some("s")); + create_vault(&ctx, &client, &vault_name).await?; + let secrets = client.get_key_vault_secrets_client(); + let secret = secrets + .create_or_update( + &resource_group, + &vault_name, + &secret_name, + SecretCreateOrUpdateParameters { + properties: Some(SecretProperties { + value: Some("test-value".into()), + ..Default::default() + }), + ..Default::default() + } + .try_into()?, + None, + ) + .await? + .into_model()?; + assert_eq!(secret.name.as_deref(), Some(secret_name.as_str())); + let mut pager = secrets + .list(&resource_group, &vault_name, None)? + .into_stream(); + let mut found = false; + while let Some(secret) = pager.try_next().await? { + found |= secret.name.as_deref() == Some(secret_name.as_str()); + } + assert!(found); + let secret = secrets + .update( + &resource_group, + &vault_name, + &secret_name, + SecretPatchParameters { + properties: Some(SecretPatchProperties { + content_type: Some("text/plain".into()), + value: Some("test-value".into()), + ..Default::default() + }), + tags: Some(HashMap::from([("updated".into(), "true".into())])), + } + .try_into()?, + None, + ) + .await? + .into_model()?; + assert_eq!( + secret + .properties + .as_ref() + .and_then(|properties| properties.content_type.as_deref()), + Some("text/plain") + ); + assert_eq!( + secret + .tags + .as_ref() + .and_then(|tags| tags.get("updated")) + .map(String::as_str), + Some("true") + ); + let secret = secrets + .get(&resource_group, &vault_name, &secret_name, None) + .await? + .into_model()?; + assert_eq!(secret.name.as_deref(), Some(secret_name.as_str())); + client + .get_key_vault_vaults_client() + .delete(&resource_group, &vault_name, None) + .await?; + Ok(()) +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tsp-location.yaml b/sdk/keyvault/azure_resourcemanager_keyvault/tsp-location.yaml new file mode 100644 index 0000000000..5c34b8627c --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tsp-location.yaml @@ -0,0 +1,3 @@ +directory: specification/keyvault/resource-manager/Microsoft.KeyVault/KeyVault +commit: e35ce3d9e784cc6c298ae85608b9f79e7c833d28 +repo: Azure/azure-rest-api-specs diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 6ecd0157ac..fc79609662 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -14,6 +14,10 @@ parameters: displayName: Run live tests type: boolean default: false +- name: release_azure_resourcemanager_keyvault + displayName: azure_resourcemanager_keyvault + type: boolean + default: false - name: release_azure_security_keyvault_secrets displayName: azure_security_keyvault_secrets type: boolean @@ -33,6 +37,8 @@ extends: ServiceDirectory: keyvault RunLiveTests: ${{ or(parameters.RunLiveTests, eq(variables['Build.Reason'], 'Schedule')) }} Artifacts: + - name: azure_resourcemanager_keyvault + releaseInBatch: ${{ parameters.release_azure_resourcemanager_keyvault }} - name: azure_security_keyvault_secrets releaseInBatch: ${{ parameters.release_azure_security_keyvault_secrets }} - name: azure_security_keyvault_certificates diff --git a/sdk/keyvault/test-resources.bicep b/sdk/keyvault/test-resources.bicep index 83adc49023..b6b3759c95 100644 --- a/sdk/keyvault/test-resources.bicep +++ b/sdk/keyvault/test-resources.bicep @@ -2,7 +2,7 @@ // Licensed under the MIT License. param baseName string = resourceGroup().name -param tenantId string = '72f988bf-86f1-41af-91ab-2d7cd011db47' +param tenantId string = '70a036f6-8e4d-4615-bad6-149c02e7720d' param testApplicationOid string param location string = resourceGroup().location @allowed(['standard', 'premium']) @@ -34,3 +34,5 @@ resource kvAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = { } output AZURE_KEYVAULT_URL string = kv.properties.vaultUri +output KEYVAULT_TENANT_ID string = tenantId +output KEYVAULT_OBJECT_ID string = testApplicationOid