diff --git a/.github/instructions/resourcemanager.instructions.md b/.github/instructions/resourcemanager.instructions.md index 14ca5cb54f8..b657e86280c 100644 --- a/.github/instructions/resourcemanager.instructions.md +++ b/.github/instructions/resourcemanager.instructions.md @@ -5,24 +5,44 @@ applyTo: "sdk/*/azure_resourcemanager_*/" # Azure Resource Manager Instructions - Initialize new Azure Resource Manager (ARM) projects using instructions in `doc/dev/resourcemanager-generation.md`. -- Integration tests under `tests/` in the crate root directory should be generated for client type exported from the crate root e.g., `azure_resourcemanager_keyvault::KeyVaultClient` that show: +- Integration tests under `tests/` in the crate root directory should be generated for all clients exported from the `clients` module e.g., `azure_resourcemanager_keyvault::clients::KeyVaultClient` that show: - Creating a new resource. - - Listing existing resources available in the current subscription. + - Listing existing resources available in the resource group created for the tests. - Updating the properties of an existing resource. - Deleting a resource. - A `README.md` file in the crate root directory should follow the same structure as `sdk/keyvault/azure_security_keyvault_secrets/README.md` that includes: - A brief overview of which Azure Resource Provider (RP) it controls. - How to install the crate. - How to authenticate the client library using a `DeveloperToolsCredential`. - - Examples of creating, listing, updating, and deleting a resource controlled by the RP. + - Examples of creating, listing, updating, and deleting a resource controlled by the RP using clients exported only from the crate root e.g., `azure_resourcemanager_keyvault::KeyVaultClient` that show: - A listing of links to those examples should be in the parent heading. - Code such as `async fn main()` can be elided by using the `include-file` crate and `rust ignore ` code fences where `unique-section-name` can be imported from within a `tests/readme.rs` file e.g., `sdk/keyvault/azure_security_keyvault_secrets/tests/readme.rs`. - Do not include any references to the `recording` object; instead, create local variables for recorded properties in `tests/readme.rs` with appropriate names that are used by examples in the `README.md` e.g., - ```rust - let resource_group = recording.var("AZURE_RESOURCE_GROUP", None); - ``` + ```rust + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let tenant_id = recording.var("KEYVAULT_TENANT_ID", None); + ``` + + `KEYVAULT` is replaced with the uppercase `` name in the `sdk/` directory. + + - Generate a random name for the individual resource to create, update, and delete instead of getting it from a variable e.g., + + ```rust + let resource_name = recording.random_string::<16>(Some("t")); + ``` + + 12 is the maximum resource name length and "t" is an optional service name prefix since most cannot start with numbers. + These requirements vary by service. - Troubleshooting information. - Contributing information. - Run markdownlint on the `README.md` and fix all issues. + +- `Cargo.toml` should have a `dev-dependency` on `azure_core_test` to add the `tracing` feature: + + ```toml + azure_core_test = { workspace = true, features = [ + "tracing", + ] } + ``` diff --git a/Cargo.lock b/Cargo.lock index 672b157885f..82238f2f1c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -479,6 +479,21 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "azure_resourcemanager_keyvault" +version = "0.1.0" +dependencies = [ + "async-trait", + "azure_core", + "azure_core_test", + "azure_core_test_macros", + "azure_identity", + "futures", + "include-file", + "serde", + "tokio", +] + [[package]] name = "azure_security_keyvault_certificates" version = "0.14.0" diff --git a/Cargo.toml b/Cargo.toml index 8b2cec23aca..2cf9e84f03f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,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/keyvault/.cspell.json b/sdk/keyvault/.cspell.json index 56d79984897..86ce68c8e8f 100644 --- a/sdk/keyvault/.cspell.json +++ b/sdk/keyvault/.cspell.json @@ -3,6 +3,7 @@ "../../.vscode/cspell.json" ], "ignoreWords": [ + "byok", "canonicalizes", "cbcpad", "ciphertext", @@ -13,18 +14,28 @@ "deletedkeys", "deletedsecrets", "deleteissuers", + "deletesas", "diffie", + "eastus", "echsm", "ekus", "fips", "getissuers", + "getrotationpolicy", + "getsas", "innererror", "keyout", + "listissuers", + "listsas", "managecontacts", "manageissuers", + "mhsm", + "mhsmip", "newkey", "oaep", + "preprovisioning", "purgeable", + "regeneratekey", "rotationpolicy", "rsaaeskeywrap", "rsaes", @@ -35,8 +46,12 @@ "secg", "secp", "setissuers", + "setrotationpolicy", + "setsas", + "subid", "unwrapkey", "upns", - "wrapkey" + "vnet", + "wrapkey", ] } \ No newline at end of file diff --git a/sdk/keyvault/.dict.txt b/sdk/keyvault/.dict.txt new file mode 100644 index 00000000000..b683afbc2e8 --- /dev/null +++ b/sdk/keyvault/.dict.txt @@ -0,0 +1,50 @@ +byok +canonicalizes +cbcpad +ciphertext +ckmaeskeywrap +ckmaeskeywrappad +ckmrsaaeskeywrap +deletedcertificates +deleteissuers +deletedkeys +deletedsecrets +deletesas +diffie +eastus +echsm +ekus +fips +getissuers +getrotationpolicy +getsas +innererror +keyout +listissuers +listsas +managecontacts +manageissuers +mhsm +mhsmip +newkey +oaep +preprovisioning +purgeable +regeneratekey +rotationpolicy +rsaaeskeywrap +rsaes +rsahsm +rsaoaep +rsassa +rsnull +secg +secp +setissuers +setrotationpolicy +setsas +subid +unwrapkey +upns +vnet +wrapkey diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/Cargo.toml b/sdk/keyvault/azure_resourcemanager_keyvault/Cargo.toml new file mode 100644 index 00000000000..8bf92eefa4b --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "azure_resourcemanager_keyvault" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true + +[features] +default = ["azure_core/default"] + +[dependencies] +async-trait = { workspace = true } +azure_core = { workspace = true } +serde = { workspace = true } + +[dev-dependencies] +azure_core_test = { workspace = true, features = [ + "tracing", +] } +azure_core_test_macros = { workspace = true } +azure_identity = { workspace = true } +futures = { workspace = true } +include-file = { workspace = true } +tokio = { workspace = true } diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/README.md b/sdk/keyvault/azure_resourcemanager_keyvault/README.md new file mode 100644 index 00000000000..fcd0a7688a8 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/README.md @@ -0,0 +1,289 @@ +# Azure Key Vault management client library for Rust + +Azure Key Vault is a cloud service that provides secure storage of secrets, keys, and certificates. This library +provides Azure Resource Manager (ARM) operations for managing Key Vault resources. + +The Azure Key Vault management client library allows you to manage Key Vault resources, including vaults, managed +HSMs, keys, and secrets at the Azure Resource Provider level. This includes operations to create, retrieve, update, +delete, and list Key Vault resources. + +[Source code] | [Package (crates.io)] | [API reference documentation] | [Product documentation] + +## Getting started + +### Install the package + +Install the Azure Key Vault management client library for Rust with [Cargo]: + +```sh +cargo add azure_resourcemanager_keyvault +``` + +### Prerequisites + +- An [Azure subscription]. +- Authorization to manage Azure Key Vault resources using either [RBAC]. + +### Install dependencies + +Add the following crates to your project: + +```sh +cargo add azure_identity tokio +``` + +### Authenticate the client + +In order to interact with the Azure Key Vault management service, you'll need to create an instance of the +`KeyVaultClient`. You need an **endpoint** (typically `https://management.azure.com`), a **subscription ID**, and +credentials to instantiate a client object. + +The example shown below uses a `DeveloperToolsCredential`, which is appropriate for local development environments. +We recommend using a managed identity for authentication in production environments. You can find more information on +different ways of authenticating and their corresponding credential types in the [Azure Identity] documentation. + +The `DeveloperToolsCredential` will automatically pick up on an Azure CLI authentication. Ensure you are logged in +with the Azure CLI: + +```azurecli +az login +``` + +Instantiate a `DeveloperToolsCredential` to pass to the client. The same instance of a token credential can be used +with multiple clients if they will be authenticating with the same identity. + +### Instantiate a client + +```rust no_run +use azure_identity::DeveloperToolsCredential; +use azure_resourcemanager_keyvault::KeyVaultClient; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Create a new Key Vault management client + let credential = DeveloperToolsCredential::new(None)?; + let subscription_id = std::env::var("AZURE_SUBSCRIPTION_ID")?; + let client = KeyVaultClient::new( + "https://management.azure.com", + credential.into(), + subscription_id, + None, + )?; + + // Get a vault client + let vaults = client.get_key_vault_vaults_client(); + + // List vaults in the subscription + let mut pager = vaults.list_by_subscription(None)?.into_stream(); + + Ok(()) +} +``` + +## Key concepts + +### KeyVaultClient + +The `KeyVaultClient` is the main entry point for interacting with Azure Key Vault management operations. It provides +methods to access specialized clients for different resource types: + +- `get_key_vault_vaults_client()` - Manage Key Vault instances +- `get_key_vault_managed_hsms_client()` - Manage Managed HSM instances +- `get_key_vault_keys_client()` - Manage keys within vaults +- `get_key_vault_secrets_client()` - Manage secrets within vaults + +### Vault + +A `Vault` is an Azure Key Vault resource that can store keys, secrets, and certificates. The management API allows +you to create, configure, and manage vault properties such as access policies, network rules, and SKUs. + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other. This ensures that the +recommendation of reusing client instances is always safe, even across threads. + +## Examples + +The following section provides several code snippets using a `KeyVaultClient` like we +[instantiated above](#instantiate-a-client): + +- [Create a vault](#create-a-vault) +- [List vaults](#list-vaults) +- [Update a vault](#update-a-vault) +- [Delete a vault](#delete-a-vault) + +### Create a vault + +`create_or_update` creates a new Azure Key Vault in the specified resource group. If a vault with the same name +already exists, its properties are updated. + +```rust ignore create_vault +use azure_resourcemanager_keyvault::models::{ + Sku, SkuFamily, SkuName, VaultCreateOrUpdateParameters, VaultProperties, +}; +use std::collections::HashMap; + +// Get the vaults client +let vaults = client.get_key_vault_vaults_client(); + +// Create vault parameters +let vault_params = VaultCreateOrUpdateParameters { + location: Some("eastus".into()), + properties: Some(VaultProperties { + tenant_id: Some(tenant_id), + sku: Some(Sku { + family: Some(SkuFamily::A), + name: Some(SkuName::Standard), + }), + access_policies: Some(vec![]), + ..Default::default() + }), + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "test".into()), + ])), +}; + +// Create or update the vault (this is a long-running operation) +let vault = vaults + .create_or_update( + &resource_group, + &vault_name, + vault_params.try_into()?, + None, + )? + .await? + .into_model()?; + +println!("Created vault: {:?}", vault.name); +``` + +### List vaults + +This example lists all Key Vaults in a resource group. + +```rust ignore list_vaults +use futures::TryStreamExt; + +let vaults = client.get_key_vault_vaults_client(); + +// List all vaults in the resource group +let mut pager = vaults.list_by_resource_group(&resource_group, None)?.into_stream(); + +while let Some(vault) = pager.try_next().await? { + println!("Found vault: {:?}", vault.name); +} +``` + +### Update a vault + +`update` modifies the properties of an existing Azure Key Vault. + +```rust ignore update_vault +use azure_resourcemanager_keyvault::models::VaultPatchParameters; +use std::collections::HashMap; + +let vaults = client.get_key_vault_vaults_client(); + +// Update vault tags +let patch_params = VaultPatchParameters { + properties: None, + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "production".into()), + ("team".into(), "platform".into()), + ])), +}; + +let vault = vaults + .update( + &resource_group, + &vault_name, + patch_params.try_into()?, + None, + ) + .await? + .into_model()?; + +println!("Updated vault: {:?}", vault.name); +``` + +### Delete a vault + +`delete` removes an Azure Key Vault. Note that vaults are soft-deleted by default and can be recovered within the +retention period. + +```rust ignore delete_vault +let vaults = client.get_key_vault_vaults_client(); + +// Delete the vault +vaults + .delete( + &resource_group, + &vault_name, + None, + ) + .await?; + +println!("Deleted vault"); +``` + +## Troubleshooting + +### General + +When you interact with the Azure Key Vault management client library using the Rust SDK, errors returned by the +service correspond to the same HTTP status codes returned for [REST API] requests. + +For example, if you try to retrieve a vault that doesn't exist, a `404` error is returned, indicating `Not Found`. + +```rust ignore errors +let vaults = client.get_key_vault_vaults_client(); + +match vaults.get( + &resource_group, + "nonexistent-vault", + None, +).await { + Ok(response) => println!("Vault: {:?}", response.into_model()?.name), + Err(err) => println!("Error: {:#?}", err), +} +``` + +You will notice that additional information is logged, like the Client Request ID of the operation. + +### Authentication + +Ensure that the identity you're using has the necessary permissions to manage Key Vault resources. At minimum, +you'll need: + +- `Microsoft.KeyVault/vaults/read` to list and get vaults +- `Microsoft.KeyVault/vaults/write` to create or update vaults +- `Microsoft.KeyVault/vaults/delete` to delete vaults + +## 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 +[Azure subscription]: https://azure.microsoft.com/free/ +[Azure Identity]: https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/identity/azure_identity +[Microsoft Open Source Code of Conduct]: https://opensource.microsoft.com/codeofconduct/ +[Product documentation]: https://learn.microsoft.com/azure/key-vault/ +[REST API]: https://learn.microsoft.com/rest/api/keyvault/ +[Cargo]: https://crates.io/ +[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/ +[RBAC]: https://learn.microsoft.com/azure/role-based-access-control/overview diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/clients.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/clients.rs new file mode 100644 index 00000000000..a093136d574 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/clients.rs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. + +/// Clients used to communicate with the service. +#[allow(clippy::wildcard_imports)] +pub use crate::generated::clients::*; +mod key_vault_clients; + +use azure_core::{ + cloud::{CloudConfiguration, CustomConfiguration}, + error::ErrorKind, + Error, Result, +}; + +/// Audience for Azure Key Vault Resource Manager requests. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +pub struct Audience; + +/// Returns the default audience for the specified cloud configuration. +/// +/// Use this when requesting tokens for Azure Resource Manager. Custom clouds must define an +/// audience for `Audience` in the provided [`CustomConfiguration`]. +fn audience(cloud: &CloudConfiguration) -> Result<&str> { + match cloud { + CloudConfiguration::AzurePublic => Ok("https://management.core.windows.net/"), + CloudConfiguration::AzureGovernment => Ok("https://management.core.usgovcloudapi.net/"), + CloudConfiguration::AzureChina => Ok("https://management.core.chinacloudapi.cn/"), + CloudConfiguration::Custom(CustomConfiguration { audiences, .. }) => { + audiences.get::().ok_or_else(|| { + Error::with_message( + ErrorKind::Other, + "cloud CustomConfiguration doesn't have a value for audience", + ) + }) + } + _ => Err(Error::with_message( + ErrorKind::Other, + "cloud configuration is not supported", + )), + } +} + +/// Returns the default Azure Resource Manager endpoint for the specified cloud configuration. +/// +/// Custom clouds must supply their own endpoint when constructing clients. +fn endpoint(cloud: &CloudConfiguration) -> Result<&'static str> { + match cloud { + CloudConfiguration::AzurePublic => Ok("https://management.azure.com"), + CloudConfiguration::AzureGovernment => Ok("https://management.usgovcloudapi.net"), + CloudConfiguration::AzureChina => Ok("https://management.chinacloudapi.cn"), + CloudConfiguration::Custom(_) => Err(Error::with_message( + ErrorKind::Other, + "cloud CustomConfiguration doesn't have a value for endpoint", + )), + _ => Err(Error::with_message( + ErrorKind::Other, + "cloud configuration is not supported", + )), + } +} + +#[cfg(test)] +mod tests { + use super::*; + use azure_core::cloud::Audiences; + + #[test] + fn test_audience_azure_public() { + let cloud = CloudConfiguration::AzurePublic; + let result = audience(&cloud); + assert!(result.is_ok()); + assert_eq!( + result.unwrap(), + "https://management.core.windows.net/.default" + ); + } + + #[test] + fn test_audience_azure_government() { + let cloud = CloudConfiguration::AzureGovernment; + let result = audience(&cloud); + assert!(result.is_ok()); + assert_eq!( + result.unwrap(), + "https://management.core.usgovcloudapi.net/.default" + ); + } + + #[test] + fn test_audience_azure_china() { + let cloud = CloudConfiguration::AzureChina; + let result = audience(&cloud); + assert!(result.is_ok()); + assert_eq!( + result.unwrap(), + "https://management.core.chinacloudapi.cn/.default" + ); + } + + #[test] + fn test_audience_custom_with_audience() { + let mut custom = CustomConfiguration::default(); + custom.audiences = + Audiences::new().with::("https://custom.audience.local/".to_string()); + let cloud = CloudConfiguration::Custom(custom); + let result = audience(&cloud); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), "https://custom.audience.local/.default"); + } + + #[test] + fn test_audience_custom_without_audience() { + let custom = CustomConfiguration::default(); + let cloud = CloudConfiguration::Custom(custom); + let result = audience(&cloud); + assert!(result.is_err()); + } + + #[test] + fn test_endpoint_azure_public() { + let cloud = CloudConfiguration::AzurePublic; + let result = endpoint(&cloud); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), "https://management.azure.com"); + } + + #[test] + fn test_endpoint_azure_government() { + let cloud = CloudConfiguration::AzureGovernment; + let result = endpoint(&cloud); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), "https://management.usgovcloudapi.net"); + } + + #[test] + fn test_endpoint_azure_china() { + let cloud = CloudConfiguration::AzureChina; + let result = endpoint(&cloud); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), "https://management.chinacloudapi.cn"); + } + + #[test] + fn test_endpoint_custom_with_endpoint() { + let mut custom = CustomConfiguration::default(); + custom.authority_host = "https://login.custom.local".to_string(); + custom.audiences = + Audiences::new().with::("https://custom.audience.local/".to_string()); + let cloud = CloudConfiguration::Custom(custom); + let result = endpoint(&cloud); + assert!(result.is_err()); + } + + #[test] + fn test_endpoint_custom_without_endpoint() { + let custom = CustomConfiguration::default(); + let cloud = CloudConfiguration::Custom(custom); + let result = endpoint(&cloud); + assert!(result.is_err()); + } +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/src/clients/key_vault_clients.rs b/sdk/keyvault/azure_resourcemanager_keyvault/src/clients/key_vault_clients.rs new file mode 100644 index 00000000000..233b7843d3e --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/clients/key_vault_clients.rs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. + +use crate::KeyVaultClient; +use azure_core::{ + credentials::TokenCredential, + http::{ + policies::{auth::BearerTokenAuthorizationPolicy, Policy}, + Pipeline, Url, + }, + tracing, Result, +}; +use std::sync::Arc; + +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. + #[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() + .map_or_else(Default::default, Clone::clone); + let endpoint = super::endpoint(&cloud)?; + let scope = String::from(super::audience(&cloud)?) + "/.default"; + let auth_policy: Arc = + Arc::new(BearerTokenAuthorizationPolicy::new(credential, vec![scope])); + Ok(Self { + endpoint: Url::parse(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, + ), + }) + } +} 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 00000000000..daf51e3e771 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_client.rs @@ -0,0 +1,182 @@ +// 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::{ + fmt::SafeDebug, + http::{ClientOptions, Pipeline, Url}, + tracing, +}; + +/// 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 { + /// 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-02-01"; + +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 00000000000..3ea7e1cc81e --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_keys_client.rs @@ -0,0 +1,423 @@ +// 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(); + 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: KeyListResult = 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(); + 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: KeyListResult = 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 00000000000..9a4151b66db --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsm_keys_client.rs @@ -0,0 +1,428 @@ +// 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(); + 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: ManagedHsmKeyListResult = 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(); + 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: ManagedHsmKeyListResult = 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 00000000000..31da9d2f133 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_managed_hsms_client.rs @@ -0,0 +1,1126 @@ +// 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, KeyVaultManagedHsmsClientCheckMhsmNameAvailabilityOptions, + KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientCreateOrUpdateOptions, KeyVaultManagedHsmsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientDeleteOptions, KeyVaultManagedHsmsClientGetDeletedOptions, + KeyVaultManagedHsmsClientGetOptions, KeyVaultManagedHsmsClientListByResourceGroupOptions, + KeyVaultManagedHsmsClientListBySubscriptionOptions, + KeyVaultManagedHsmsClientListDeletedOptions, + KeyVaultManagedHsmsClientPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientPurgeDeletedOptions, KeyVaultManagedHsmsClientUpdateOperationStatus, + KeyVaultManagedHsmsClientUpdateOptions, ManagedHsm, ManagedHsmListResult, +}; +use azure_core::{ + error::{CheckSuccessOptions, Error, ErrorKind}, + http::{ + headers::{HeaderName, RETRY_AFTER, RETRY_AFTER_MS, X_MS_RETRY_AFTER_MS}, + pager::{PagerContinuation, PagerResult, PagerState}, + poller::{ + get_retry_after, PollerContinuation, PollerResult, PollerState, PollerStatus, + StatusMonitor, + }, + Method, Pager, Pipeline, PipelineSendOptions, Poller, RawResponse, Request, RequestContent, + Response, StatusCode, 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 + } + + /// 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()) + } + + /// 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 [`KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus, KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders}; + /// 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::KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.ManagedHsms.createOrUpdate")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let mut request = Request::new(next_link.clone(), Method::Get); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let mut request = Request::new(url.clone(), Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters.clone()); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::Done { response: rsp }, + }) + }) + }, + 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 [`KeyVaultManagedHsmsClientDeleteOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientDeleteOperationStatus, KeyVaultManagedHsmsClientDeleteOperationStatusHeaders}; + /// 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::KeyVaultManagedHsmsClientDeleteOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientDeleteOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientDeleteOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientDeleteOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.ManagedHsms.delete")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation.clone() { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let request = Request::new(next_link.clone(), Method::Get); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let request = Request::new(url.clone(), Method::Delete); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202, 204], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, mut body) = rsp.deconstruct(); + if body.is_empty() { + body = azure_core::http::response::ResponseBody::from_bytes( + if status == StatusCode::NoContent { + "{\"status\":\"Succeeded\"}" + } else { + "{}" + }, + ); + } + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultManagedHsmsClientDeleteOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::Done { response: rsp }, + }) + }) + }, + Some(options.method_options), + )) + } + + /// 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(); + 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: ManagedHsmListResult = 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(); + 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: ManagedHsmListResult = 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(); + 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: DeletedManagedHsmListResult = 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), + )) + } + + /// 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 [`KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientPurgeDeletedOperationStatus, KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders}; + /// 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::KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation.clone() { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let request = Request::new(next_link.clone(), Method::Get); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let request = Request::new(url.clone(), Method::Post); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultManagedHsmsClientPurgeDeletedOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::Done { response: rsp }, + }) + }) + }, + 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 [`KeyVaultManagedHsmsClientUpdateOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientUpdateOperationStatus, KeyVaultManagedHsmsClientUpdateOperationStatusHeaders}; + /// 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::KeyVaultManagedHsmsClientUpdateOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultManagedHsmsClientUpdateOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultManagedHsmsClientUpdateOperationStatusHeaders`]: crate::generated::models::KeyVaultManagedHsmsClientUpdateOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.ManagedHsms.update")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let mut request = Request::new(next_link.clone(), Method::Get); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let mut request = Request::new(url.clone(), Method::Patch); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters.clone()); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + let original_url = url.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, mut body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let next_link = match &continuation { + PollerContinuation::Links { next_link, .. } => next_link, + _ => { + unreachable!() + } + }; + let mut final_body = None; + if status == StatusCode::Ok && next_link.as_str() == original_url.as_str() { + final_body = Some(body); + body = azure_core::http::response::ResponseBody::from_bytes( + "{\"status\":\"Succeeded\"}", + ); + } + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultManagedHsmsClientUpdateOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + if let Some(final_body) = final_body { + final_body + } else { + body.clone() + }, + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::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 00000000000..2f81a110a48 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_private_endpoint_connections_client.rs @@ -0,0 +1,467 @@ +// 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::{ + KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions, + KeyVaultMHSMPrivateEndpointConnectionsClientGetOptions, + KeyVaultMHSMPrivateEndpointConnectionsClientListByResourceOptions, + KeyVaultMHSMPrivateEndpointConnectionsClientPutOptions, MHSMPrivateEndpointConnection, + MHSMPrivateEndpointConnectionsListResult, +}; +use azure_core::{ + error::{CheckSuccessOptions, Error, ErrorKind}, + http::{ + headers::{HeaderName, RETRY_AFTER, RETRY_AFTER_MS, X_MS_RETRY_AFTER_MS}, + pager::{PagerContinuation, PagerResult, PagerState}, + poller::{ + get_retry_after, PollerContinuation, PollerResult, PollerState, PollerStatus, + StatusMonitor, + }, + 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 [`KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus, KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders}; + /// 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::KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders`]: crate::generated::models::KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation.clone() { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let mut request = Request::new(next_link.clone(), Method::Get); + request.insert_header("accept", "application/json"); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let mut request = Request::new(url.clone(), Method::Delete); + request.insert_header("accept", "application/json"); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202, 204], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::Done { response: rsp }, + }) + }) + }, + 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(); + 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: MHSMPrivateEndpointConnectionsListResult = 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 00000000000..9fd89212d17 --- /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 00000000000..9cff9c271ef --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_mhsm_regions_client.rs @@ -0,0 +1,118 @@ +// 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(); + 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: MHSMRegionsListResult = 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 00000000000..2caf8203656 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_operations_client.rs @@ -0,0 +1,95 @@ +// 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(); + 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: OperationListResult = 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 00000000000..0d1251d40a3 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_private_endpoint_connections_client.rs @@ -0,0 +1,467 @@ +// 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::{ + KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultPrivateEndpointConnectionsClientDeleteOptions, + KeyVaultPrivateEndpointConnectionsClientGetOptions, + KeyVaultPrivateEndpointConnectionsClientListByResourceOptions, + KeyVaultPrivateEndpointConnectionsClientPutOptions, PrivateEndpointConnection, + PrivateEndpointConnectionListResult, +}; +use azure_core::{ + error::{CheckSuccessOptions, Error, ErrorKind}, + http::{ + headers::{HeaderName, RETRY_AFTER, RETRY_AFTER_MS, X_MS_RETRY_AFTER_MS}, + pager::{PagerContinuation, PagerResult, PagerState}, + poller::{ + get_retry_after, PollerContinuation, PollerResult, PollerState, PollerStatus, + StatusMonitor, + }, + 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 [`KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus, KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders}; + /// 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::KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders`]: crate::generated::models::KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.PrivateEndpointConnections.delete")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation.clone() { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let mut request = Request::new(next_link.clone(), Method::Get); + request.insert_header("accept", "application/json"); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let mut request = Request::new(url.clone(), Method::Delete); + request.insert_header("accept", "application/json"); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202, 204], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::Done { response: rsp }, + }) + }) + }, + 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(); + 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: PrivateEndpointConnectionListResult = 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 00000000000..2c4b5b2b028 --- /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 00000000000..24b2d3765cb --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_secrets_client.rs @@ -0,0 +1,328 @@ +// 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 + /// ARM 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 ARM 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 ARM 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(); + 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: SecretListResult = 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 ARM 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 00000000000..67604fe95dd --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/clients/key_vault_vaults_client.rs @@ -0,0 +1,1004 @@ +// 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, + KeyVaultVaultsClientCheckNameAvailabilityOptions, + KeyVaultVaultsClientCreateOrUpdateOperationStatus, KeyVaultVaultsClientCreateOrUpdateOptions, + KeyVaultVaultsClientDeleteOptions, KeyVaultVaultsClientGetDeletedOptions, + KeyVaultVaultsClientGetOptions, KeyVaultVaultsClientListByResourceGroupOptions, + KeyVaultVaultsClientListBySubscriptionOptions, KeyVaultVaultsClientListDeletedOptions, + KeyVaultVaultsClientListOptions, KeyVaultVaultsClientPurgeDeletedOperationStatus, + KeyVaultVaultsClientPurgeDeletedOptions, KeyVaultVaultsClientUpdateAccessPolicyOptions, + KeyVaultVaultsClientUpdateOptions, ResourceListResult, Vault, VaultAccessPolicyParameters, + VaultCheckNameAvailabilityParameters, VaultCreateOrUpdateParameters, VaultListResult, + VaultPatchParameters, +}; +use azure_core::{ + error::{CheckSuccessOptions, Error, ErrorKind}, + http::{ + headers::{HeaderName, RETRY_AFTER, RETRY_AFTER_MS, X_MS_RETRY_AFTER_MS}, + pager::{PagerContinuation, PagerResult, PagerState}, + poller::{ + get_retry_after, PollerContinuation, PollerResult, PollerState, PollerStatus, + StatusMonitor, + }, + 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 + } + + /// 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()) + } + + /// 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 [`KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientCreateOrUpdateOperationStatus, KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders}; + /// 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::KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders`]: crate::generated::models::KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.Vaults.createOrUpdate")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let mut request = Request::new(next_link.clone(), Method::Get); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let mut request = Request::new(url.clone(), Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters.clone()); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 201], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultVaultsClientCreateOrUpdateOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::Done { response: rsp }, + }) + }) + }, + Some(options.method_options), + )) + } + + /// 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(); + 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: ResourceListResult = 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(); + 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: VaultListResult = 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(); + 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: VaultListResult = 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(); + 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: DeletedVaultListResult = 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), + )) + } + + /// 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 [`KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders`] trait, which provides + /// access to response headers. For example: + /// + /// ```no_run + /// use azure_core::{Result, http::Response}; + /// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientPurgeDeletedOperationStatus, KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders}; + /// 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::KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders::location) - location + /// * [`retry_after`()](crate::generated::models::KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders::retry_after) - retry-after + /// + /// [`KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders`]: crate::generated::models::KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders + #[tracing::function("Microsoft.KeyVault.DeletedVaults.purgeDeleted")] + pub fn 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 api_version = self.api_version.clone(); + Ok(Poller::new( + move |poller_state: PollerState, poller_options| { + let (mut request, continuation) = match poller_state { + PollerState::More(continuation) => { + let (mut next_link, final_link) = match continuation.clone() { + PollerContinuation::Links { + next_link, + final_link, + } => (next_link, final_link), + _ => { + unreachable!() + } + }; + let mut query_builder = next_link.query_builder(); + query_builder.set_pair("api-version", &api_version); + query_builder.build(); + let request = Request::new(next_link.clone(), Method::Get); + ( + request, + PollerContinuation::Links { + next_link, + final_link, + }, + ) + } + PollerState::Initial => { + let request = Request::new(url.clone(), Method::Post); + ( + request, + PollerContinuation::Links { + next_link: url.clone(), + final_link: None, + }, + ) + } + }; + let ctx = poller_options.context.clone(); + let pipeline = pipeline.clone(); + Box::pin(async move { + let rsp = pipeline + .send( + &ctx, + &mut request, + Some(PipelineSendOptions { + check_success: CheckSuccessOptions { + success_codes: &[200, 202], + }, + ..Default::default() + }), + ) + .await?; + let (status, headers, body) = rsp.deconstruct(); + let continuation = if let Some(operation_location) = + headers.get_optional_string(&HeaderName::from_static("location")) + { + let next_link = Url::parse(&operation_location)?; + match continuation { + PollerContinuation::Links { final_link, .. } => { + PollerContinuation::Links { + next_link, + final_link, + } + } + _ => { + unreachable!() + } + } + } else { + continuation + }; + let retry_after = get_retry_after( + &headers, + &[X_MS_RETRY_AFTER_MS, RETRY_AFTER_MS, RETRY_AFTER], + &poller_options, + ); + let res: KeyVaultVaultsClientPurgeDeletedOperationStatus = + json::from_json(&body)?; + let mut final_rsp: Option = None; + if res.status() == PollerStatus::Succeeded { + final_rsp = Some(RawResponse::from_bytes( + status, + headers.clone(), + body.clone(), + )); + } + let rsp = RawResponse::from_bytes(status, headers, body).into(); + Ok(match res.status() { + PollerStatus::InProgress => PollerResult::InProgress { + response: rsp, + retry_after, + continuation, + }, + PollerStatus::Succeeded => PollerResult::Succeeded { + response: rsp, + target: Box::new(move || { + Box::pin(async move { + Ok(final_rsp + .ok_or_else(|| { + Error::new(ErrorKind::Other, "missing final response") + })? + .into()) + }) + }), + }, + _ => PollerResult::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 00000000000..e8474acbcb8 --- /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 00000000000..e97722ef876 --- /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 00000000000..8f1779f7af1 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums.rs @@ -0,0 +1,510 @@ +// 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, + + 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, Copy, Debug, Eq, PartialEq)] +pub enum ManagedHsmSkuName { + CustomB32, + + CustomB6, + + CustomC10, + + CustomC42, + + StandardB1, +} + +/// 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 00000000000..e17e2c1adad --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/enums_impl.rs @@ -0,0 +1,1542 @@ +// 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, ManagedHsmSkuName, + 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::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, + "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::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::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 FromStr for ManagedHsmSkuName { + type Err = Error; + fn from_str(s: &str) -> ::core::result::Result::Err> { + Ok(match s { + "Custom_B32" => ManagedHsmSkuName::CustomB32, + "Custom_B6" => ManagedHsmSkuName::CustomB6, + "Custom_C10" => ManagedHsmSkuName::CustomC10, + "Custom_C42" => ManagedHsmSkuName::CustomC42, + "Standard_B1" => ManagedHsmSkuName::StandardB1, + _ => { + return Err(Error::with_message_fn(ErrorKind::DataConversion, || { + format!("unknown variant of ManagedHsmSkuName found: \"{s}\"") + })) + } + }) + } +} + +impl AsRef for ManagedHsmSkuName { + fn as_ref(&self) -> &str { + match self { + ManagedHsmSkuName::CustomB32 => "Custom_B32", + ManagedHsmSkuName::CustomB6 => "Custom_B6", + ManagedHsmSkuName::CustomC10 => "Custom_C10", + ManagedHsmSkuName::CustomC42 => "Custom_C42", + ManagedHsmSkuName::StandardB1 => "Standard_B1", + } + } +} + +impl Display for ManagedHsmSkuName { + fn fmt(&self, f: &mut Formatter<'_>) -> ::std::fmt::Result { + match self { + ManagedHsmSkuName::CustomB32 => Display::fmt("Custom_B32", f), + ManagedHsmSkuName::CustomB6 => Display::fmt("Custom_B6", f), + ManagedHsmSkuName::CustomC10 => Display::fmt("Custom_C10", f), + ManagedHsmSkuName::CustomC42 => Display::fmt("Custom_C42", f), + ManagedHsmSkuName::StandardB1 => Display::fmt("Standard_B1", f), + } + } +} + +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 00000000000..30c5af878f9 --- /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, ManagedHsmSkuName, + 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 ManagedHsmSkuName { + 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 ManagedHsmSkuName { + 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 00000000000..10adc41e335 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/header_traits.rs @@ -0,0 +1,437 @@ +// 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::{ + KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientUpdateOperationStatus, + KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultVaultsClientCreateOrUpdateOperationStatus, + KeyVaultVaultsClientPurgeDeletedOperationStatus, 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::delete()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::delete()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus, KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders}; +/// 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 KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders: + private::Sealed +{ + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatusHeaders + 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::create_or_update()`](crate::generated::clients::KeyVaultManagedHsmsClient::create_or_update()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus, KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders}; +/// 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 KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientCreateOrUpdateOperationStatusHeaders + 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::delete()`](crate::generated::clients::KeyVaultManagedHsmsClient::delete()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientDeleteOperationStatus, KeyVaultManagedHsmsClientDeleteOperationStatusHeaders}; +/// 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 KeyVaultManagedHsmsClientDeleteOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientDeleteOperationStatusHeaders + 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::purge_deleted()`](crate::generated::clients::KeyVaultManagedHsmsClient::purge_deleted()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientPurgeDeletedOperationStatus, KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders}; +/// 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 KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientPurgeDeletedOperationStatusHeaders + 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::update()`](crate::generated::clients::KeyVaultManagedHsmsClient::update()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultManagedHsmsClientUpdateOperationStatus, KeyVaultManagedHsmsClientUpdateOperationStatusHeaders}; +/// 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 KeyVaultManagedHsmsClientUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultManagedHsmsClientUpdateOperationStatusHeaders + 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::delete()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::delete()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus, KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders}; +/// 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 KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders: + private::Sealed +{ + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatusHeaders + 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::create_or_update()`](crate::generated::clients::KeyVaultVaultsClient::create_or_update()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientCreateOrUpdateOperationStatus, KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders}; +/// 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 KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultVaultsClientCreateOrUpdateOperationStatusHeaders + 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::purge_deleted()`](crate::generated::clients::KeyVaultVaultsClient::purge_deleted()) +/// +/// # Examples +/// +/// ```no_run +/// use azure_core::{Result, http::Response}; +/// use azure_resourcemanager_keyvault::models::{KeyVaultVaultsClientPurgeDeletedOperationStatus, KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders}; +/// 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 KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders: private::Sealed { + fn location(&self) -> Result>; + fn retry_after(&self) -> Result>; +} + +impl KeyVaultVaultsClientPurgeDeletedOperationStatusHeaders + 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::{ + KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientUpdateOperationStatus, + KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultVaultsClientCreateOrUpdateOperationStatus, + KeyVaultVaultsClientPurgeDeletedOperationStatus, 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 00000000000..b25474eb5d8 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/generated/models/method_options.rs @@ -0,0 +1,661 @@ +// 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::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::delete()`](crate::generated::clients::KeyVaultMHSMPrivateEndpointConnectionsClient::delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions<'_> { + /// Transforms this [`KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions`] into a new `KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions<'static> { + KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOptions { + 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::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::create_or_update()`](crate::generated::clients::KeyVaultManagedHsmsClient::create_or_update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientCreateOrUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientCreateOrUpdateOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientCreateOrUpdateOptions`] into a new `KeyVaultManagedHsmsClientCreateOrUpdateOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientCreateOrUpdateOptions<'static> { + KeyVaultManagedHsmsClientCreateOrUpdateOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::delete()`](crate::generated::clients::KeyVaultManagedHsmsClient::delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientDeleteOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientDeleteOptions`] into a new `KeyVaultManagedHsmsClientDeleteOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientDeleteOptions<'static> { + KeyVaultManagedHsmsClientDeleteOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// 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 [`KeyVaultManagedHsmsClient::purge_deleted()`](crate::generated::clients::KeyVaultManagedHsmsClient::purge_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientPurgeDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientPurgeDeletedOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientPurgeDeletedOptions`] into a new `KeyVaultManagedHsmsClientPurgeDeletedOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientPurgeDeletedOptions<'static> { + KeyVaultManagedHsmsClientPurgeDeletedOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// Options to be passed to [`KeyVaultManagedHsmsClient::update()`](crate::generated::clients::KeyVaultManagedHsmsClient::update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultManagedHsmsClientUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultManagedHsmsClientUpdateOptions<'_> { + /// Transforms this [`KeyVaultManagedHsmsClientUpdateOptions`] into a new `KeyVaultManagedHsmsClientUpdateOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultManagedHsmsClientUpdateOptions<'static> { + KeyVaultManagedHsmsClientUpdateOptions { + method_options: PollerOptions { + 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::delete()`](crate::generated::clients::KeyVaultPrivateEndpointConnectionsClient::delete()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultPrivateEndpointConnectionsClientDeleteOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultPrivateEndpointConnectionsClientDeleteOptions<'_> { + /// Transforms this [`KeyVaultPrivateEndpointConnectionsClientDeleteOptions`] into a new `KeyVaultPrivateEndpointConnectionsClientDeleteOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultPrivateEndpointConnectionsClientDeleteOptions<'static> { + KeyVaultPrivateEndpointConnectionsClientDeleteOptions { + 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::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::create_or_update()`](crate::generated::clients::KeyVaultVaultsClient::create_or_update()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientCreateOrUpdateOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultVaultsClientCreateOrUpdateOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientCreateOrUpdateOptions`] into a new `KeyVaultVaultsClientCreateOrUpdateOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientCreateOrUpdateOptions<'static> { + KeyVaultVaultsClientCreateOrUpdateOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// 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::purge_deleted()`](crate::generated::clients::KeyVaultVaultsClient::purge_deleted()) +#[derive(Clone, Default, SafeDebug)] +pub struct KeyVaultVaultsClientPurgeDeletedOptions<'a> { + /// Allows customization of the method call. + pub method_options: PollerOptions<'a>, +} + +impl KeyVaultVaultsClientPurgeDeletedOptions<'_> { + /// Transforms this [`KeyVaultVaultsClientPurgeDeletedOptions`] into a new `KeyVaultVaultsClientPurgeDeletedOptions` that owns the underlying data, cloning it if necessary. + pub fn into_owned(self) -> KeyVaultVaultsClientPurgeDeletedOptions<'static> { + KeyVaultVaultsClientPurgeDeletedOptions { + method_options: PollerOptions { + context: self.method_options.context.into_owned(), + ..self.method_options + }, + } + } +} + +/// 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 00000000000..f5a684bdf20 --- /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 00000000000..a74f68c6503 --- /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, ManagedHsmSkuName, + 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 KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus { + /// 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 KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus { + /// 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 KeyVaultManagedHsmsClientDeleteOperationStatus { + /// 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 KeyVaultManagedHsmsClientPurgeDeletedOperationStatus { + /// 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 KeyVaultManagedHsmsClientUpdateOperationStatus { + /// 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 KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus { + /// 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 KeyVaultVaultsClientCreateOrUpdateOperationStatus { + /// 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 KeyVaultVaultsClientPurgeDeletedOperationStatus { + /// 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 ARM 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 00000000000..b9c5699e84a --- /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, + KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus, + KeyVaultManagedHsmsClientDeleteOperationStatus, + KeyVaultManagedHsmsClientPurgeDeletedOperationStatus, + KeyVaultManagedHsmsClientUpdateOperationStatus, + KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus, + KeyVaultVaultsClientCreateOrUpdateOperationStatus, + KeyVaultVaultsClientPurgeDeletedOperationStatus, 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, 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 KeyVaultMHSMPrivateEndpointConnectionsClientDeleteOperationStatus { + 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 KeyVaultManagedHsmsClientCreateOrUpdateOperationStatus { + 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 KeyVaultManagedHsmsClientDeleteOperationStatus { + type Output = (); + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultManagedHsmsClientPurgeDeletedOperationStatus { + type Output = (); + type Format = JsonFormat; + fn status(&self) -> PollerStatus { + match &self.status { + Some(v) => PollerStatus::from(v.as_ref()), + None => PollerStatus::InProgress, + } + } +} + +impl StatusMonitor for KeyVaultManagedHsmsClientUpdateOperationStatus { + 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 KeyVaultPrivateEndpointConnectionsClientDeleteOperationStatus { + 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 KeyVaultVaultsClientCreateOrUpdateOperationStatus { + 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 KeyVaultVaultsClientPurgeDeletedOperationStatus { + type Output = (); + type Format = JsonFormat; + 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 00000000000..0056041e70a --- /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 00000000000..34174f06daf --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/src/lib.rs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. + +#![cfg_attr(docsrs, feature(doc_cfg))] + +pub mod clients; +#[allow( + unused_imports, + reason = "Publicly exported generated/clients are instead exported from clients" +)] +mod generated; + +pub use clients::{KeyVaultClient, KeyVaultClientOptions}; +pub use generated::*; diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tests/keys.rs b/sdk/keyvault/azure_resourcemanager_keyvault/tests/keys.rs new file mode 100644 index 00000000000..150920a95a6 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/keys.rs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core::error::Result; +use azure_core_test::{recorded, TestContext}; +use azure_resourcemanager_keyvault::models::{ + JsonWebKeyType, KeyCreateParameters, KeyProperties, Sku, SkuFamily, SkuName, + VaultCreateOrUpdateParameters, VaultProperties, +}; +use azure_resourcemanager_keyvault::KeyVaultClient; +use futures::TryStreamExt; +use std::collections::HashMap; + +#[recorded::test] +async fn key_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + + let mut options = azure_resourcemanager_keyvault::KeyVaultClientOptions::default(); + recording.instrument(&mut options.client_options); + + let subscription_id = recording.var("KEYVAULT_SUBSCRIPTION_ID", None); + let client = KeyVaultClient::new(subscription_id, recording.credential(), Some(options))?; + + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let location = recording.var("KEYVAULT_LOCATION", None); + let vault_name = recording.random_string::<16>(Some("t")); + let key_name = recording.random_string::<16>(Some("k")); + let tenant_id = recording.var("KEYVAULT_TENANT_ID", None); + + let vaults = client.get_key_vault_vaults_client(); + let keys = client.get_key_vault_keys_client(); + + // Parse tenant ID + let tenant_id = tenant_id + .parse() + .map_err(|e| azure_core::Error::new(azure_core::error::ErrorKind::Other, e))?; + + // First, create a vault to hold the key + println!("Creating vault: {}", vault_name); + let vault_params = VaultCreateOrUpdateParameters { + location: Some(location), + properties: Some(VaultProperties { + tenant_id: Some(tenant_id), + sku: Some(Sku { + family: Some(SkuFamily::A), + name: Some(SkuName::Standard), + }), + access_policies: Some(vec![]), + ..Default::default() + }), + tags: Some(HashMap::from_iter(vec![( + "purpose".into(), + "key-test".into(), + )])), + }; + + let vault = vaults + .create_or_update(&resource_group, &vault_name, vault_params.try_into()?, None)? + .await? + .into_model()?; + + println!("Created vault: {:?}", vault.name); + + // Create a key in the vault + println!("Creating key: {}", key_name); + let key_params = KeyCreateParameters { + properties: Some(KeyProperties { + kty: Some(JsonWebKeyType::Rsa), + key_size: Some(2048), + ..Default::default() + }), + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "test".into()), + ("type".into(), "rsa".into()), + ])), + }; + + let key = keys + .create_if_not_exist( + &resource_group, + &vault_name, + &key_name, + key_params.try_into()?, + None, + ) + .await? + .into_model()?; + + println!("Created key: {:?}", key.name); + assert_eq!(key.name.as_deref(), Some(key_name.as_str())); + + // List keys in the vault + println!("Listing keys in vault"); + let mut pager = keys.list(&resource_group, &vault_name, None)?.into_stream(); + + let mut found = false; + while let Some(key) = pager.try_next().await? { + println!("Found key: {:?}", key.name); + if key.name.as_deref() == Some(key_name.as_str()) { + found = true; + } + } + assert!(found, "Created key not found in list"); + + // Get the key + println!("Getting key"); + let retrieved_key = keys + .get(&resource_group, &vault_name, &key_name, None) + .await? + .into_model()?; + + println!("Retrieved key: {:?}", retrieved_key.name); + assert_eq!(retrieved_key.name.as_deref(), Some(key_name.as_str())); + assert_eq!( + retrieved_key.tags.as_ref().and_then(|t| t.get("type")), + Some(&"rsa".to_string()) + ); + + // Delete the vault (which will also delete the key) + println!("Deleting vault"); + vaults.delete(&resource_group, &vault_name, None).await?; + + println!("Deleted vault and key"); + + Ok(()) +} 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 00000000000..1ee210e7fe4 --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/managed_hsms.rs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core::error::Result; +use azure_core_test::{recorded, TestContext}; +use azure_resourcemanager_keyvault::models::{ + ManagedHsm, ManagedHsmProperties, ManagedHsmSku, ManagedHsmSkuFamily, ManagedHsmSkuName, +}; +use azure_resourcemanager_keyvault::KeyVaultClient; +use futures::TryStreamExt; +use std::collections::HashMap; + +#[recorded::test] +#[ignore = "requires special provisioning"] +async fn managed_hsm_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + + let mut options = azure_resourcemanager_keyvault::KeyVaultClientOptions::default(); + recording.instrument(&mut options.client_options); + + let subscription_id = recording.var("KEYVAULT_SUBSCRIPTION_ID", None); + let client = KeyVaultClient::new(subscription_id, recording.credential(), Some(options))?; + + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let location = recording.var("KEYVAULT_LOCATION", None); + let hsm_name = recording.random_string::<16>(Some("t")); + let tenant_id = recording.var("KEYVAULT_TENANT_ID", None); + let object_id = recording.var("KEYVAULT_OBJECT_ID", None); + + let managed_hsms = client.get_key_vault_managed_hsms_client(); + + // Parse tenant ID + let tenant_id = tenant_id + .parse() + .map_err(|e| azure_core::Error::new(azure_core::error::ErrorKind::Other, e))?; + + // Create managed HSM parameters + println!("Creating managed HSM: {}", hsm_name); + let hsm_params = ManagedHsm { + location: Some(location), + properties: Some(ManagedHsmProperties { + tenant_id: Some(tenant_id), + initial_admin_object_ids: Some(vec![object_id.clone()]), + ..Default::default() + }), + sku: Some(ManagedHsmSku { + family: Some(ManagedHsmSkuFamily::B), + name: Some(ManagedHsmSkuName::StandardB1), + }), + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "test".into()), + ("purpose".into(), "integration-test".into()), + ])), + ..Default::default() + }; + + // Create the managed HSM (this is a long-running operation) + let hsm = managed_hsms + .create_or_update(&resource_group, &hsm_name, hsm_params.try_into()?, None)? + .await? + .into_model()?; + + println!("Created managed HSM: {:?}", hsm.name); + assert_eq!(hsm.name.as_deref(), Some(hsm_name.as_str())); + + // List managed HSMs in the resource group + println!("Listing managed HSMs in resource group"); + let mut pager = managed_hsms + .list_by_resource_group(&resource_group, None)? + .into_stream(); + + let mut found = false; + while let Some(hsm) = pager.try_next().await? { + println!("Found managed HSM: {:?}", hsm.name); + if hsm.name.as_deref() == Some(hsm_name.as_str()) { + found = true; + } + } + assert!(found, "Created managed HSM not found in list"); + + // Update managed HSM tags + println!("Updating managed HSM tags"); + let update_params = ManagedHsm { + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "production".into()), + ("team".into(), "platform".into()), + ("updated".into(), "true".into()), + ])), + ..Default::default() + }; + + let updated_hsm = managed_hsms + .update(&resource_group, &hsm_name, update_params.try_into()?, None)? + .await? + .into_model()?; + + println!("Updated managed HSM: {:?}", updated_hsm.name); + assert_eq!( + updated_hsm.tags.as_ref().and_then(|t| t.get("environment")), + Some(&"production".to_string()) + ); + assert_eq!( + updated_hsm.tags.as_ref().and_then(|t| t.get("updated")), + Some(&"true".to_string()) + ); + + // Delete the managed HSM + println!("Deleting managed HSM"); + managed_hsms + .delete(&resource_group, &hsm_name, None)? + .await?; + + println!("Deleted managed HSM"); + + 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 00000000000..e99009896ea --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/readme.rs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core::error::Result; +use azure_core_test::{recorded, TestContext}; +use azure_resourcemanager_keyvault::KeyVaultClient; +use include_file::include_markdown; + +#[recorded::test] +async fn readme(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + + let mut options = azure_resourcemanager_keyvault::KeyVaultClientOptions::default(); + recording.instrument(&mut options.client_options); + + let subscription_id = recording.var("KEYVAULT_SUBSCRIPTION_ID", None); + let client = KeyVaultClient::new(subscription_id, recording.credential(), Some(options))?; + + // Define variables used in README examples + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let vault_name = recording.random_string::<16>(Some("t")); + let tenant_id = recording.var("KEYVAULT_TENANT_ID", None); + + // Each macro invocation is in its own block to prevent errors with duplicate imports. + println!("Create a vault"); + include_markdown!("README.md", "create_vault", scope); + + println!("List vaults"); + include_markdown!("README.md", "list_vaults", scope); + + println!("Update a vault"); + include_markdown!("README.md", "update_vault", scope); + + println!("Handle errors"); + include_markdown!("README.md", "errors", scope); + + println!("Delete a vault"); + include_markdown!("README.md", "delete_vault", scope); + + Ok(()) +} diff --git a/sdk/keyvault/azure_resourcemanager_keyvault/tests/secrets.rs b/sdk/keyvault/azure_resourcemanager_keyvault/tests/secrets.rs new file mode 100644 index 00000000000..d8e317fe9bb --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tests/secrets.rs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +use azure_core::error::Result; +use azure_core_test::{recorded, TestContext}; +use azure_resourcemanager_keyvault::models::{ + SecretCreateOrUpdateParameters, SecretPatchParameters, SecretProperties, Sku, SkuFamily, + SkuName, VaultCreateOrUpdateParameters, VaultProperties, +}; +use azure_resourcemanager_keyvault::KeyVaultClient; +use futures::TryStreamExt; +use std::collections::HashMap; + +#[recorded::test] +async fn secret_lifecycle(ctx: TestContext) -> Result<()> { + let recording = ctx.recording(); + + let mut options = azure_resourcemanager_keyvault::KeyVaultClientOptions::default(); + recording.instrument(&mut options.client_options); + + let subscription_id = recording.var("KEYVAULT_SUBSCRIPTION_ID", None); + let client = KeyVaultClient::new(subscription_id, recording.credential(), Some(options))?; + + let resource_group = recording.var("KEYVAULT_RESOURCE_GROUP", None); + let location = recording.var("KEYVAULT_LOCATION", None); + let vault_name = recording.random_string::<16>(Some("t")); + let secret_name = recording.random_string::<16>(Some("s")); + let tenant_id = recording.var("KEYVAULT_TENANT_ID", None); + + let vaults = client.get_key_vault_vaults_client(); + let secrets = client.get_key_vault_secrets_client(); + + // Parse tenant ID + let tenant_id = tenant_id + .parse() + .map_err(|e| azure_core::Error::new(azure_core::error::ErrorKind::Other, e))?; + + // First, create a vault to hold the secret + println!("Creating vault: {}", vault_name); + let vault_params = VaultCreateOrUpdateParameters { + location: Some(location), + properties: Some(VaultProperties { + tenant_id: Some(tenant_id), + sku: Some(Sku { + family: Some(SkuFamily::A), + name: Some(SkuName::Standard), + }), + access_policies: Some(vec![]), + ..Default::default() + }), + tags: Some(HashMap::from_iter(vec![( + "purpose".into(), + "secret-test".into(), + )])), + }; + + let vault = vaults + .create_or_update(&resource_group, &vault_name, vault_params.try_into()?, None)? + .await? + .into_model()?; + + println!("Created vault: {:?}", vault.name); + + // Create a secret in the vault + println!("Creating secret: {}", secret_name); + let secret_params = SecretCreateOrUpdateParameters { + properties: Some(SecretProperties { + value: Some("my-secret-value".into()), + ..Default::default() + }), + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "test".into()), + ("classification".into(), "confidential".into()), + ])), + }; + + let secret = secrets + .create_or_update( + &resource_group, + &vault_name, + &secret_name, + secret_params.try_into()?, + None, + ) + .await? + .into_model()?; + + println!("Created secret: {:?}", secret.name); + assert_eq!(secret.name.as_deref(), Some(secret_name.as_str())); + + // List secrets in the vault + println!("Listing secrets in vault"); + let mut pager = secrets + .list(&resource_group, &vault_name, None)? + .into_stream(); + + let mut found = false; + while let Some(secret) = pager.try_next().await? { + println!("Found secret: {:?}", secret.name); + if secret.name.as_deref() == Some(secret_name.as_str()) { + found = true; + } + } + assert!(found, "Created secret not found in list"); + + // Update the secret tags + println!("Updating secret tags"); + let patch_params = SecretPatchParameters { + tags: Some(HashMap::from_iter(vec![ + ("environment".into(), "production".into()), + ("classification".into(), "secret".into()), + ("updated".into(), "true".into()), + ])), + ..Default::default() + }; + + let updated_secret = secrets + .update( + &resource_group, + &vault_name, + &secret_name, + patch_params.try_into()?, + None, + ) + .await? + .into_model()?; + + println!("Updated secret: {:?}", updated_secret.name); + assert_eq!( + updated_secret + .tags + .as_ref() + .and_then(|t| t.get("environment")), + Some(&"production".to_string()) + ); + assert_eq!( + updated_secret.tags.as_ref().and_then(|t| t.get("updated")), + Some(&"true".to_string()) + ); + + // Get the secret + println!("Getting secret"); + let retrieved_secret = secrets + .get(&resource_group, &vault_name, &secret_name, None) + .await? + .into_model()?; + + println!("Retrieved secret: {:?}", retrieved_secret.name); + assert_eq!(retrieved_secret.name.as_deref(), Some(secret_name.as_str())); + + // Delete the vault (which will also delete the secret) + println!("Deleting vault"); + vaults.delete(&resource_group, &vault_name, None).await?; + + println!("Deleted vault and secret"); + + 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 00000000000..60562662a6f --- /dev/null +++ b/sdk/keyvault/azure_resourcemanager_keyvault/tsp-location.yaml @@ -0,0 +1,3 @@ +directory: specification/keyvault/resource-manager/Microsoft.KeyVault/KeyVault +commit: c3ea6c260efef4897cb0ea5cc2f570d85bd2041e +repo: Azure/azure-rest-api-specs diff --git a/sdk/keyvault/test-resources.bicep b/sdk/keyvault/test-resources.bicep index 83adc490232..32fd8bea608 100644 --- a/sdk/keyvault/test-resources.bicep +++ b/sdk/keyvault/test-resources.bicep @@ -34,3 +34,4 @@ resource kvAdmin 'Microsoft.Authorization/roleAssignments@2022-04-01' = { } output AZURE_KEYVAULT_URL string = kv.properties.vaultUri +output KEYVAULT_TENANT_ID string = subscription().tenantId