From b66d3342362dbf754cf4a8a160108c17230d115e Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 12:55:21 -0800 Subject: [PATCH 01/13] Initial populate of keyvault keys client --- Cargo.lock | 24 + Cargo.toml | 1 + .../azure_security_keyvault_keys/Cargo.toml | 16 + .../src/generated/clients/key_vault_client.rs | 814 ++++++++++++++++++ .../src/generated/clients/mod.rs | 6 + .../src/generated/enums.rs | 99 +++ .../src/generated/mod.rs | 9 + .../src/generated/models.rs | 623 ++++++++++++++ .../src/generated/models_serde.rs | 83 ++ .../azure_security_keyvault_keys/src/lib.rs | 15 + .../azure_security_keyvault_keys/src/main.rs | 3 + .../tsp-location.yaml | 5 + 12 files changed, 1698 insertions(+) create mode 100644 sdk/keyvault/azure_security_keyvault_keys/Cargo.toml create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/lib.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/main.rs create mode 100644 sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml diff --git a/Cargo.lock b/Cargo.lock index 4c6c892656..553157ad63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -460,6 +460,30 @@ dependencies = [ "uuid", ] +[[package]] +name = "azure_security_keyvault_keys" +version = "0.0.1" +dependencies = [ + "azure_core", + "futures", + "serde", + "serde_json", + "time", + "typespec_client_core", +] + +[[package]] +name = "azure_security_keyvault_keys" +version = "0.0.1" +dependencies = [ + "azure_core", + "futures", + "serde", + "serde_json", + "time", + "typespec_client_core", +] + [[package]] name = "azure_security_keyvault_secrets" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index e77662b2ff..9c8a4f519f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "sdk/cosmos/azure_data_cosmos", "sdk/identity/azure_identity", "sdk/eventhubs/azure_messaging_eventhubs", + "sdk/keyvault/azure_security_keyvault_keys", "sdk/keyvault/azure_security_keyvault_secrets", "eng/test/mock_transport", "sdk/storage", diff --git a/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml b/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml new file mode 100644 index 0000000000..7b5285b6ff --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "azure_security_keyvault_keys" +version = "0.0.1" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true + +[dependencies] +azure_core = { workspace = true } +futures = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +time = { workspace = true } +typespec_client_core = { workspace = true, features = ["derive"] } diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs new file mode 100644 index 0000000000..fab74751e9 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs @@ -0,0 +1,814 @@ +// 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. DO NOT EDIT. + +use azure_core::{ + BearerTokenCredentialPolicy, ClientMethodOptions, ClientOptions, Context, Method, Pager, Pipeline, Policy, Request, RequestContent, Response, Result, Url, +}; +use azure_core::credentials::TokenCredential; +use crate::models::{ + BackupKeyResult, DeletedKeyBundle, DeletedKeyListResult, GetRandomBytesRequest, KeyBundle, KeyCreateParameters, KeyImportParameters, KeyListResult, KeyOperationResult, KeyOperationsParameters, KeyReleaseParameters, KeyReleaseResult, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, KeyVerifyResult, RandomBytes, +}; +use std::sync::Arc; +use typespec_client_core::json; +use typespec_client_core::http::PagerResult; + +pub struct KeyVaultClient { + api_version: String, + endpoint: Url, + pipeline: Pipeline, +} + +#[derive(Clone, Debug)] +pub struct KeyVaultClientOptions { + pub api_version: String, + pub client_options: ClientOptions, +} + +impl KeyVaultClient { + pub fn new(endpoint: &str, credential: Arc, options: Option) -> Result { + let options = options.unwrap_or_default(); + let mut endpoint = Url::parse(endpoint)?; + endpoint.set_query(None); + let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new(credential, vec!["https://vault.azure.net/.default"])); + Ok(Self { + endpoint, + 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], + ), + }) + } + + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Requests that a backup of the specified key be downloaded to the client. +/// +/// The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return +/// key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected +/// to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a +/// key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP +/// operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot +/// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical +/// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored +/// in an EU geographical area. This operation requires the key/backup permission. + pub async fn backup_key(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/backup"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Creates a new key, stores it, then returns key parameters and attributes to the client. +/// +/// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure +/// Key Vault creates a new version of the key. It requires the keys/create permission. + pub async fn create_key(&self, key_name: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/create"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Decrypts a single block of encrypted data. +/// +/// The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. +/// This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this +/// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric +/// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt +/// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the +/// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode +/// for more information. + pub async fn decrypt(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/decrypt"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Deletes a key of any type from storage in Azure Key Vault. +/// +/// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic +/// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. +/// This operation requires the keys/delete permission. + pub async fn delete_key(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. +/// +/// The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. +/// Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key +/// and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in +/// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation +/// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the +/// public key material. This operation requires the keys/encrypt permission. + pub async fn encrypt(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/encrypt"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Gets the public part of a deleted key. +/// +/// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any +/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. + pub async fn get_deleted_key(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Lists the deleted keys in the specified vault. +/// +/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. +/// This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled +/// for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete +/// enabled vault. This operation requires the keys/list permission. + pub fn get_deleted_keys(&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 = first_url.join("deletedkeys")?; + first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + } + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + next_link + }, + None => { + first_url.clone() + }, + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: DeletedKeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { + response: rsp, + }, + }) + } + })) + } + + /// Gets the public part of a stored key. +/// +/// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released +/// in the response. This operation requires the keys/get permission. + pub async fn get_key(&self, key_name: String, key_version: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Lists the policy for a key. +/// +/// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation +/// requires the keys/get permission. + pub async fn get_key_rotation_policy(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotationpolicy"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Retrieves a list of individual key versions with the same key name. +/// +/// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. + pub fn get_key_versions(&self, key_name: String, 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("keys/{key-name}/versions"); + path = path.replace("{key-name}", &key_name); + first_url = first_url.join(&path)?; + first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + } + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + next_link + }, + None => { + first_url.clone() + }, + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: KeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { + response: rsp, + }, + }) + } + })) + } + + /// List keys in the specified vault. +/// +/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. +/// The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided +/// in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. + pub fn get_keys(&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 = first_url.join("keys")?; + first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + } + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + next_link + }, + None => { + first_url.clone() + }, + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: KeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { + response: rsp, + }, + }) + } + })) + } + + /// Get the requested number of bytes containing random values. +/// +/// Get the requested number of bytes containing random values from a managed HSM. + pub async fn get_random_bytes(&self, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + url = url.join("rng")?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Imports an externally created key, stores it, and returns key parameters and attributes to the client. +/// +/// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, +/// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. + pub async fn import_key(&self, key_name: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + 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); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Permanently deletes the specified key. +/// +/// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any +/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. + pub async fn purge_deleted_key(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Recovers the deleted key to its latest version. +/// +/// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted +/// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this +/// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. + pub async fn recover_deleted_key(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}/recover"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Releases a key. +/// +/// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires +/// the keys/release permission. + pub async fn release(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/release"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Restores a backed up key to a vault. +/// +/// Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access +/// control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key +/// cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the +/// key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained +/// during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore +/// all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key +/// Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission +/// in the target Key Vault. This operation requires the keys/restore permission. + pub async fn restore_key(&self, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + url = url.join("keys/restore")?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. +/// +/// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. + pub async fn rotate_key(&self, key_name: String, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotate"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Creates a signature from a digest using the specified key. +/// +/// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses +/// the private portion of the key. This operation requires the keys/sign permission. + pub async fn sign(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/sign"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Unwraps a symmetric key using the specified key that was initially used for wrapping that key. +/// +/// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the +/// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault +/// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. + pub async fn unwrap_key(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/unwrapkey"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// The update key operation changes specified attributes of a stored key and can be applied to any key type and key version +/// stored in Azure Key Vault. +/// +/// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a +/// key itself cannot be changed. This operation requires the keys/update permission. + pub async fn update_key(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + 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); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Updates the rotation policy for a key. +/// +/// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. + pub async fn update_key_rotation_policy(&self, key_name: String, key_rotation_policy: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotationpolicy"); + path = path.replace("{key-name}", &key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(key_rotation_policy); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Verifies a signature using a specified key. +/// +/// The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric +/// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this +/// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. +/// This operation requires the keys/verify permission. + pub async fn verify(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/verify"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Wraps a symmetric key using a specified key. +/// +/// The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in +/// an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection +/// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric +/// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation +/// requires the keys/wrapKey permission. + pub async fn wrap_key(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/wrapkey"); + path = path.replace("{key-name}", &key_name); + path = path.replace("{key-version}", &key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } +} + +impl Default for KeyVaultClientOptions { + fn default() -> Self { + Self { + api_version: String::from("7.6-preview.1"), + client_options: ClientOptions::default(), + } + } +} + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientBackupKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientCreateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientDecryptOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientDeleteKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientEncryptOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetDeletedKeysOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyVaultClientGetDeletedKeysOptions<'_> { + pub fn into_owned(self) -> KeyVaultClientGetDeletedKeysOptions<'static> { + KeyVaultClientGetDeletedKeysOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetKeyRotationPolicyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetKeyVersionsOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyVaultClientGetKeyVersionsOptions<'_> { + pub fn into_owned(self) -> KeyVaultClientGetKeyVersionsOptions<'static> { + KeyVaultClientGetKeyVersionsOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetKeysOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyVaultClientGetKeysOptions<'_> { + pub fn into_owned(self) -> KeyVaultClientGetKeysOptions<'static> { + KeyVaultClientGetKeysOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientGetRandomBytesOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientImportKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientPurgeDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientRecoverDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientReleaseOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientRestoreKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientRotateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientSignOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientUnwrapKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientUpdateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientUpdateKeyRotationPolicyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientVerifyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Debug, Default)] +pub struct KeyVaultClientWrapKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs new file mode 100644 index 0000000000..96eb4b26c1 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs @@ -0,0 +1,6 @@ +// 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. DO NOT EDIT. + +pub mod key_vault_client; diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs new file mode 100644 index 0000000000..f681c9e8b0 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs @@ -0,0 +1,99 @@ +// 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. DO NOT EDIT. + +use typespec_client_core::{ + create_enum, create_extensible_enum, +}; + +create_extensible_enum!( + DeletionRecoveryLevel, + (CustomizedRecoverable, "CustomizedRecoverable"), + (CustomizedRecoverableProtectedSubscription, "CustomizedRecoverable+ProtectedSubscription"), + (CustomizedRecoverablePurgeable, "CustomizedRecoverable+Purgeable"), + (Purgeable, "Purgeable"), + (Recoverable, "Recoverable"), + (RecoverableProtectedSubscription, "Recoverable+ProtectedSubscription"), + (RecoverablePurgeable, "Recoverable+Purgeable") +); + +create_extensible_enum!( + JsonWebKeyCurveName, + (P256, "P-256"), + (P256K, "P-256K"), + (P384, "P-384"), + (P521, "P-521") +); + +create_extensible_enum!( + JsonWebKeyEncryptionAlgorithm, + (A128CBC, "A128CBC"), + (A128CBCPAD, "A128CBCPAD"), + (A128GCM, "A128GCM"), + (A128KW, "A128KW"), + (A192CBC, "A192CBC"), + (A192CBCPAD, "A192CBCPAD"), + (A192GCM, "A192GCM"), + (A192KW, "A192KW"), + (A256CBC, "A256CBC"), + (A256CBCPAD, "A256CBCPAD"), + (A256GCM, "A256GCM"), + (A256KW, "A256KW"), + (CKMAESKEYWRAP, "CKM_AES_KEY_WRAP"), + (CKMAESKEYWRAPPAD, "CKM_AES_KEY_WRAP_PAD"), + (RSA1_5, "RSA1_5"), + (RSAOAEP, "RSA-OAEP"), + (RSAOAEP256, "RSA-OAEP-256") +); + +create_extensible_enum!( + JsonWebKeyOperation, + (Decrypt, "decrypt"), + (Encrypt, "encrypt"), + (Export, "export"), + (Import, "import"), + (Sign, "sign"), + (UnwrapKey, "unwrapKey"), + (Verify, "verify"), + (WrapKey, "wrapKey") +); + +create_extensible_enum!( + JsonWebKeySignatureAlgorithm, + (ES256, "ES256"), + (ES256K, "ES256K"), + (ES384, "ES384"), + (ES512, "ES512"), + (PS256, "PS256"), + (PS384, "PS384"), + (PS512, "PS512"), + (RS256, "RS256"), + (RS384, "RS384"), + (RS512, "RS512"), + (RSNULL, "RSNULL") +); + +create_extensible_enum!( + JsonWebKeyType, + (EC, "EC"), + (ECHSM, "EC-HSM"), + (Oct, "oct"), + (OctHSM, "oct-HSM"), + (RSA, "RSA"), + (RSAHSM, "RSA-HSM") +); + +create_extensible_enum!( + KeyEncryptionAlgorithm, + (CKMRSAAESKEYWRAP, "CKM_RSA_AES_KEY_WRAP"), + (RSAAESKEYWRAP_256, "RSA_AES_KEY_WRAP_256"), + (RSAAESKEYWRAP_384, "RSA_AES_KEY_WRAP_384") +); + +create_enum!( + KeyRotationPolicyAction, + (Notify, "Notify"), + (Rotate, "Rotate") +); + diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs new file mode 100644 index 0000000000..e3c9c5fa4a --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs @@ -0,0 +1,9 @@ +// 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. DO NOT EDIT. + +pub mod clients; +pub mod enums; +pub mod models; +pub mod models_serde; diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs new file mode 100644 index 0000000000..f4762e6572 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs @@ -0,0 +1,623 @@ +// 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. DO NOT EDIT. + +use azure_core::base64; +use crate::models::{ + DeletionRecoveryLevel, JsonWebKeyCurveName, JsonWebKeyEncryptionAlgorithm, JsonWebKeyOperation, JsonWebKeySignatureAlgorithm, JsonWebKeyType, KeyEncryptionAlgorithm, KeyRotationPolicyAction, +}; +use serde::{ + Deserialize, Serialize, +}; +use std::collections::HashMap; +use time::OffsetDateTime; + +/// The backup key result, containing the backup blob. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct BackupKeyResult { +/// The backup blob containing the backed up key. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub value: Option>, + +} + +/// A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct DeletedKeyBundle { +/// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + +/// The time when the key was deleted, in UTC + #[serde(default, rename = "deletedDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub deleted_date: Option, + +/// The Json web key. + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option, + +/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + +/// The url of the recovery object, used to identify and recover the deleted key. + #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")] + pub recovery_id: Option, + +/// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + +/// The time when the key is scheduled to be purged, in UTC + #[serde(default, rename = "scheduledPurgeDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub scheduled_purge_date: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// The deleted key item containing the deleted key metadata and information about deletion. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct DeletedKeyItem { +/// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + +/// The time when the key was deleted, in UTC + #[serde(default, rename = "deletedDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub deleted_date: Option, + +/// Key identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + +/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + +/// The url of the recovery object, used to identify and recover the deleted key. + #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")] + pub recovery_id: Option, + +/// The time when the key is scheduled to be purged, in UTC + #[serde(default, rename = "scheduledPurgeDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub scheduled_purge_date: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// A list of keys that have been deleted in this vault. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct DeletedKeyListResult { +/// The URL to get the next set of deleted keys. + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + +/// A response message containing a list of deleted keys in the key vault along with a link to the next page of deleted keys. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, + +} + +/// The get random bytes request object. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct GetRandomBytesRequest { +/// The requested number of random bytes. + #[serde(skip_serializing_if = "Option::is_none")] + pub count: Option, + +} + +/// As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct JsonWebKey { +/// Elliptic curve name. For valid values, see JsonWebKeyCurveName. + #[serde(skip_serializing_if = "Option::is_none")] + pub crv: Option, + +/// RSA private exponent, or the D component of an EC private key. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub d: Option>, + +/// RSA private key parameter. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub dp: Option>, + +/// RSA private key parameter. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub dq: Option>, + +/// RSA public exponent. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub e: Option>, + +/// Symmetric key. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub k: Option>, + +/// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + +/// Key identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + +/// JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + +/// RSA modulus. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub n: Option>, + +/// RSA secret prime. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub p: Option>, + +/// RSA secret prime, with p < q. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub q: Option>, + +/// RSA private key parameter. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub qi: Option>, + +/// Protected Key, used with 'Bring Your Own Key'. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "key_hsm", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub t: Option>, + +/// X component of an EC public key. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub x: Option>, + +/// Y component of an EC public key. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub y: Option>, + +} + +/// The attributes of a key managed by the key vault service. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyAttributes { +/// Creation time in UTC. + #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::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 UTC. + #[serde(default, rename = "exp", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub expires: Option, + +/// Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable +/// key. + #[serde(skip_serializing_if = "Option::is_none")] + pub exportable: Option, + +/// The underlying HSM Platform. + #[serde(rename = "hsmPlatform", skip_serializing_if = "Option::is_none")] + pub hsm_platform: Option, + +/// Not before date in UTC. + #[serde(default, rename = "nbf", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub not_before: Option, + +/// softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. + #[serde(rename = "recoverableDays", skip_serializing_if = "Option::is_none")] + pub recoverable_days: Option, + +/// Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the +/// key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention +/// interval. + #[serde(rename = "recoveryLevel", skip_serializing_if = "Option::is_none")] + pub recovery_level: Option, + +/// Last updated time in UTC. + #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub updated: Option, + +} + +/// A KeyBundle consisting of a WebKey plus its attributes. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyBundle { +/// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + +/// The Json web key. + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option, + +/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + +/// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// The key create parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyCreateParameters { +/// Elliptic curve name. For valid values, see JsonWebKeyCurveName. + #[serde(rename = "crv", skip_serializing_if = "Option::is_none")] + pub curve: Option, + +/// The attributes of a key managed by the key vault service. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub key_attributes: Option, + +/// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + +/// The key size in bits. For example: 2048, 3072, or 4096 for RSA. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_size: Option, + +/// The type of key to create. For valid values, see JsonWebKeyType. + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + +/// The public exponent for a RSA key. + #[serde(skip_serializing_if = "Option::is_none")] + pub public_exponent: Option, + +/// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// The key import parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyImportParameters { +/// Whether to import as a hardware key (HSM) or software key. + #[serde(rename = "Hsm", skip_serializing_if = "Option::is_none")] + pub hsm: Option, + +/// The Json web key + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option, + +/// The key management attributes. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub key_attributes: Option, + +/// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// The key item containing key metadata. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyItem { +/// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + +/// Key identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + +/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// The key list result. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyListResult { +/// The URL to get the next set of keys. + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + +/// A response message containing a list of keys in the key vault along with a link to the next page of keys. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, + +} + +/// The key operation result. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyOperationResult { +/// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "aad", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub additional_authenticated_data: Option>, + +/// The tag to authenticate when performing decryption with an authenticated algorithm. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "tag", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub authentication_tag: Option>, + +/// Cryptographically random, non-repeating initialization vector for symmetric algorithms. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub iv: Option>, + +/// Key identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + +/// The result of the operation. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub result: Option>, + +} + +/// The key operations parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyOperationsParameters { +/// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub aad: Option>, + +/// algorithm identifier + #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + +/// Cryptographically random, non-repeating initialization vector for symmetric algorithms. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub iv: Option>, + +/// The tag to authenticate when performing decryption with an authenticated algorithm. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub tag: Option>, + +/// The value to operate on. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub value: Option>, + +} + +/// The release key parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyReleaseParameters { +/// The encryption algorithm to use to protected the exported key material + #[serde(skip_serializing_if = "Option::is_none")] + pub enc: Option, + +/// A client provided nonce for freshness. + #[serde(skip_serializing_if = "Option::is_none")] + pub nonce: Option, + +/// The attestation assertion for the target of the key release. + #[serde(rename = "target", skip_serializing_if = "Option::is_none")] + pub target_attestation_token: Option, + +} + +/// The policy rules under which the key can be exported. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +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. Blob must be base64 URL encoded. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "data", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub encoded_policy: Option>, + +/// Defines the mutability state of the policy. Once marked immutable, this flag cannot be reset and the policy cannot be +/// changed under any circumstances. + #[serde(skip_serializing_if = "Option::is_none")] + pub immutable: Option, + +} + +/// The release result, containing the released key. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyReleaseResult { +/// A signed object containing the released key. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + +} + +/// The key restore parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyRestoreParameters { +/// The backup blob associated with a key bundle. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub key_bundle_backup: Option>, + +} + +/// Management policy for a key. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyRotationPolicy { +/// The key rotation policy attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + +/// The key policy id. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + +/// Actions that will be performed by Key Vault over the lifetime of a key. For preview, lifetimeActions can only have two +/// items at maximum: one for rotate, one for notify. Notification time would be default to 30 days before expiry and it is +/// not configurable. + #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] + pub lifetime_actions: Option>, + +} + +/// The key rotation policy attributes. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyRotationPolicyAttributes { +/// The key rotation policy created time in UTC. + #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub created: Option, + +/// The expiryTime will be applied on the new key version. It should be at least 28 days. It will be in ISO 8601 Format. Examples: +/// 90 days: P90D, 3 months: P3M, 48 hours: PT48H, 1 year and 10 days: P1Y10D + #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + +/// The key rotation policy's last updated time in UTC. + #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + pub updated: Option, + +} + +/// The key operations parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeySignParameters { +/// The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + +/// The value to operate on. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub value: Option>, + +} + +/// The key update parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyUpdateParameters { +/// The attributes of a key managed by the key vault service. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub key_attributes: Option, + +/// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + +/// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + +/// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, + +} + +/// The key verify parameters. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyVerifyParameters { +/// The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + +/// The digest used for signing. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub digest: Option>, + +/// The signature to be verified. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub signature: Option>, + +} + +/// The key verify result. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyVerifyResult { +/// True if the signature is verified, otherwise false. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, + +} + +/// Action and its trigger that will be performed by Key Vault over the lifetime of a key. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct LifetimeActions { +/// The action that will be executed. + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + +/// The condition that will execute the action. + #[serde(skip_serializing_if = "Option::is_none")] + pub trigger: Option, + +} + +/// A condition to be satisfied for an action to be executed. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct LifetimeActionsTrigger { +/// Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: +/// 90 days : "P90D" + #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] + pub time_after_create: Option, + +/// Time before expiry to attempt to rotate or notify. It will be in ISO 8601 duration format. Example: 90 days : "P90D" + #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] + pub time_before_expiry: Option, + +} + +/// The action that will be executed. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct LifetimeActionsType { +/// The type of the action. The value should be compared case-insensitively. + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, + +} + +/// The get random bytes response object containing the bytes. +#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct RandomBytes { +/// The bytes encoded as a base64url string. + #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + pub value: Option>, + +} + diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs new file mode 100644 index 0000000000..af33ef563d --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs @@ -0,0 +1,83 @@ +// 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. DO NOT EDIT. + +use azure_core::{ + RequestContent, Result, +}; +use crate::models::{ + GetRandomBytesRequest, KeyCreateParameters, KeyImportParameters, KeyOperationsParameters, KeyReleaseParameters, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, +}; +use typespec_client_core::json::to_json; + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: GetRandomBytesRequest) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyCreateParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyImportParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyOperationsParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyReleaseParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyRestoreParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyRotationPolicy) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeySignParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyUpdateParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyVerifyParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs new file mode 100644 index 0000000000..e58cb39e90 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs @@ -0,0 +1,15 @@ +// 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. DO NOT EDIT. + +mod generated; + +pub use crate::generated::clients::*; + +pub mod models { + pub use crate::generated::enums::*; + pub use crate::generated::models::*; +} + +pub use key_vault_client::KeyVaultClient; diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/main.rs b/sdk/keyvault/azure_security_keyvault_keys/src/main.rs new file mode 100644 index 0000000000..e7a11a969c --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml b/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml new file mode 100644 index 0000000000..a2270abd35 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/keyvault/Security.KeyVault.Keys +commit: 4744046cdc26b7e60ba4615bc79dc1fdfce4ea71 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/keyvault/Security.KeyVault.Common/ From d68b795a877ee1e6a869c3a46929d0ff6d4cca40 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 13:08:55 -0800 Subject: [PATCH 02/13] Add spelling exclusions --- sdk/keyvault/.dict.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sdk/keyvault/.dict.txt b/sdk/keyvault/.dict.txt index df4c129d2d..83fe583a71 100644 --- a/sdk/keyvault/.dict.txt +++ b/sdk/keyvault/.dict.txt @@ -1,2 +1,17 @@ +cbcpad +ckmaeskeywrap +ckmaeskeywrappad +ckmrsaaeskeywrap +ciphertext +deletedkeys deletedsecrets +echsm +oaep purgeable +rotationpolicy +rsaaeskeywrap +rsahsm +rsnull +rsaoaep +unwrapkey +wrapkey From 60039251f9b189267678d71de94b9adcea64da02 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 13:19:19 -0800 Subject: [PATCH 03/13] Add spelling exclusions and alphabetize --- sdk/keyvault/.dict.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/.dict.txt b/sdk/keyvault/.dict.txt index 83fe583a71..8739c96fc5 100644 --- a/sdk/keyvault/.dict.txt +++ b/sdk/keyvault/.dict.txt @@ -1,8 +1,8 @@ cbcpad +ciphertext ckmaeskeywrap ckmaeskeywrappad ckmrsaaeskeywrap -ciphertext deletedkeys deletedsecrets echsm @@ -11,7 +11,7 @@ purgeable rotationpolicy rsaaeskeywrap rsahsm -rsnull rsaoaep +rsnull unwrapkey wrapkey From 09eade1cdde138d7e8ce2efea886cd492617115a Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 13:45:08 -0800 Subject: [PATCH 04/13] Remove duplicate entry --- Cargo.lock | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 553157ad63..ae78beba1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -472,18 +472,6 @@ dependencies = [ "typespec_client_core", ] -[[package]] -name = "azure_security_keyvault_keys" -version = "0.0.1" -dependencies = [ - "azure_core", - "futures", - "serde", - "serde_json", - "time", - "typespec_client_core", -] - [[package]] name = "azure_security_keyvault_secrets" version = "0.1.0" From 12a8b5a150d28d0a03846f9367fca3b103e06f00 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 14:28:24 -0800 Subject: [PATCH 05/13] Regenerate using latest Rust emitter --- eng/emitter-package-lock.json | 240 +++++++++--------- eng/emitter-package.json | 4 +- .../src/generated/clients/key_vault_client.rs | 167 ++++++------ .../src/generated/clients/mod.rs | 3 +- .../src/generated/models.rs | 74 +++--- .../azure_security_keyvault_keys/src/lib.rs | 33 ++- 6 files changed, 274 insertions(+), 247 deletions(-) diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index ee5593741b..0e24169088 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-rust": "0.7.0" + "@azure-tools/typespec-rust": "0.8.0" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.50.0", @@ -152,17 +152,17 @@ } }, "node_modules/@azure-tools/typespec-rust": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.7.0.tgz", - "integrity": "sha512-M+AWPLzZI6ZJa7l8hGQO4wBKPbc8ptQBQtBLqeunzKJ1lzD79jReLzBBXUtnQw+zlj9wXUt5kiM43Dqo6QX4aw==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.8.0.tgz", + "integrity": "sha512-nYLqe6YdDuAA8c/jh6Qq8MtDF/D2x8PCKLDekOHCTk3r3/WO+BuOWwNJjAy0Cik77lLxGEtI4PTpBlMFnq2IDA==", "license": "MIT", "dependencies": { "@azure-tools/codegen": "~2.9.2", "@azure-tools/linq": "~3.1.263", - "js-yaml": "~4.1.0", + "js-yaml": "^4.1.0", "query-string": "9.1.1", "source-map-support": "0.5.21", - "vitest": "^1.6.0" + "vitest": "^1.6.1" }, "engines": { "node": ">=20.0.0" @@ -631,9 +631,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.30.1.tgz", - "integrity": "sha512-pSWY+EVt3rJ9fQ3IqlrEUtXh3cGqGtPDH1FQlNZehO2yYxCHEX1SPsz1M//NXwYfbTlcKr9WObLnJX9FsS9K1Q==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.1.tgz", + "integrity": "sha512-kwctwVlswSEsr4ljpmxKrRKp1eG1v2NAhlzFzDf1x1OdYaMjBYjDCbHkzWm57ZXzTwqn8stMXgROrnMw8dJK3w==", "cpu": [ "arm" ], @@ -644,9 +644,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.30.1.tgz", - "integrity": "sha512-/NA2qXxE3D/BRjOJM8wQblmArQq1YoBVJjrjoTSBS09jgUisq7bqxNHJ8kjCHeV21W/9WDGwJEWSN0KQ2mtD/w==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.1.tgz", + "integrity": "sha512-4H5ZtZitBPlbPsTv6HBB8zh1g5d0T8TzCmpndQdqq20Ugle/nroOyDMf9p7f88Gsu8vBLU78/cuh8FYHZqdXxw==", "cpu": [ "arm64" ], @@ -657,9 +657,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.30.1.tgz", - "integrity": "sha512-r7FQIXD7gB0WJ5mokTUgUWPl0eYIH0wnxqeSAhuIwvnnpjdVB8cRRClyKLQr7lgzjctkbp5KmswWszlwYln03Q==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.1.tgz", + "integrity": "sha512-f2AJ7Qwx9z25hikXvg+asco8Sfuc5NCLg8rmqQBIOUoWys5sb/ZX9RkMZDPdnnDevXAMJA5AWLnRBmgdXGEUiA==", "cpu": [ "arm64" ], @@ -670,9 +670,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.30.1.tgz", - "integrity": "sha512-x78BavIwSH6sqfP2xeI1hd1GpHL8J4W2BXcVM/5KYKoAD3nNsfitQhvWSw+TFtQTLZ9OmlF+FEInEHyubut2OA==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.1.tgz", + "integrity": "sha512-+/2JBrRfISCsWE4aEFXxd+7k9nWGXA8+wh7ZUHn/u8UDXOU9LN+QYKKhd57sIn6WRcorOnlqPMYFIwie/OHXWw==", "cpu": [ "x64" ], @@ -683,9 +683,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.30.1.tgz", - "integrity": "sha512-HYTlUAjbO1z8ywxsDFWADfTRfTIIy/oUlfIDmlHYmjUP2QRDTzBuWXc9O4CXM+bo9qfiCclmHk1x4ogBjOUpUQ==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.1.tgz", + "integrity": "sha512-SUeB0pYjIXwT2vfAMQ7E4ERPq9VGRrPR7Z+S4AMssah5EHIilYqjWQoTn5dkDtuIJUSTs8H+C9dwoEcg3b0sCA==", "cpu": [ "arm64" ], @@ -696,9 +696,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.30.1.tgz", - "integrity": "sha512-1MEdGqogQLccphhX5myCJqeGNYTNcmTyaic9S7CG3JhwuIByJ7J05vGbZxsizQthP1xpVx7kd3o31eOogfEirw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.1.tgz", + "integrity": "sha512-L3T66wAZiB/ooiPbxz0s6JEX6Sr2+HfgPSK+LMuZkaGZFAFCQAHiP3dbyqovYdNaiUXcl9TlgnIbcsIicAnOZg==", "cpu": [ "x64" ], @@ -709,9 +709,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.30.1.tgz", - "integrity": "sha512-PaMRNBSqCx7K3Wc9QZkFx5+CX27WFpAMxJNiYGAXfmMIKC7jstlr32UhTgK6T07OtqR+wYlWm9IxzennjnvdJg==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.1.tgz", + "integrity": "sha512-UBXdQ4+ATARuFgsFrQ+tAsKvBi/Hly99aSVdeCUiHV9dRTTpMU7OrM3WXGys1l40wKVNiOl0QYY6cZQJ2xhKlQ==", "cpu": [ "arm" ], @@ -722,9 +722,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.30.1.tgz", - "integrity": "sha512-B8Rcyj9AV7ZlEFqvB5BubG5iO6ANDsRKlhIxySXcF1axXYUyqwBok+XZPgIYGBgs7LDXfWfifxhw0Ik57T0Yug==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.1.tgz", + "integrity": "sha512-m/yfZ25HGdcCSwmopEJm00GP7xAUyVcBPjttGLRAqZ60X/bB4Qn6gP7XTwCIU6bITeKmIhhwZ4AMh2XLro+4+w==", "cpu": [ "arm" ], @@ -735,9 +735,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.30.1.tgz", - "integrity": "sha512-hqVyueGxAj3cBKrAI4aFHLV+h0Lv5VgWZs9CUGqr1z0fZtlADVV1YPOij6AhcK5An33EXaxnDLmJdQikcn5NEw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.1.tgz", + "integrity": "sha512-Wy+cUmFuvziNL9qWRRzboNprqSQ/n38orbjRvd6byYWridp5TJ3CD+0+HUsbcWVSNz9bxkDUkyASGP0zS7GAvg==", "cpu": [ "arm64" ], @@ -748,9 +748,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.30.1.tgz", - "integrity": "sha512-i4Ab2vnvS1AE1PyOIGp2kXni69gU2DAUVt6FSXeIqUCPIR3ZlheMW3oP2JkukDfu3PsexYRbOiJrY+yVNSk9oA==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.1.tgz", + "integrity": "sha512-CQ3MAGgiFmQW5XJX5W3wnxOBxKwFlUAgSXFA2SwgVRjrIiVt5LHfcQLeNSHKq5OEZwv+VCBwlD1+YKCjDG8cpg==", "cpu": [ "arm64" ], @@ -761,9 +761,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.30.1.tgz", - "integrity": "sha512-fARcF5g296snX0oLGkVxPmysetwUk2zmHcca+e9ObOovBR++9ZPOhqFUM61UUZ2EYpXVPN1redgqVoBB34nTpQ==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.1.tgz", + "integrity": "sha512-rSzb1TsY4lSwH811cYC3OC2O2mzNMhM13vcnA7/0T6Mtreqr3/qs6WMDriMRs8yvHDI54qxHgOk8EV5YRAHFbw==", "cpu": [ "loong64" ], @@ -774,9 +774,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.30.1.tgz", - "integrity": "sha512-GLrZraoO3wVT4uFXh67ElpwQY0DIygxdv0BNW9Hkm3X34wu+BkqrDrkcsIapAY+N2ATEbvak0XQ9gxZtCIA5Rw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.1.tgz", + "integrity": "sha512-fwr0n6NS0pG3QxxlqVYpfiY64Fd1Dqd8Cecje4ILAV01ROMp4aEdCj5ssHjRY3UwU7RJmeWd5fi89DBqMaTawg==", "cpu": [ "ppc64" ], @@ -787,9 +787,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.30.1.tgz", - "integrity": "sha512-0WKLaAUUHKBtll0wvOmh6yh3S0wSU9+yas923JIChfxOaaBarmb/lBKPF0w/+jTVozFnOXJeRGZ8NvOxvk/jcw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.1.tgz", + "integrity": "sha512-4uJb9qz7+Z/yUp5RPxDGGGUcoh0PnKF33QyWgEZ3X/GocpWb6Mb+skDh59FEt5d8+Skxqs9mng6Swa6B2AmQZg==", "cpu": [ "riscv64" ], @@ -800,9 +800,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.1.tgz", - "integrity": "sha512-GWFs97Ruxo5Bt+cvVTQkOJ6TIx0xJDD/bMAOXWJg8TCSTEK8RnFeOeiFTxKniTc4vMIaWvCplMAFBt9miGxgkA==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.1.tgz", + "integrity": "sha512-QlIo8ndocWBEnfmkYqj8vVtIUpIqJjfqKggjy7IdUncnt8BGixte1wDON7NJEvLg3Kzvqxtbo8tk+U1acYEBlw==", "cpu": [ "s390x" ], @@ -813,9 +813,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.30.1.tgz", - "integrity": "sha512-UtgGb7QGgXDIO+tqqJ5oZRGHsDLO8SlpE4MhqpY9Llpzi5rJMvrK6ZGhsRCST2abZdBqIBeXW6WPD5fGK5SDwg==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.1.tgz", + "integrity": "sha512-hzpleiKtq14GWjz3ahWvJXgU1DQC9DteiwcsY4HgqUJUGxZThlL66MotdUEK9zEo0PK/2ADeZGM9LIondE302A==", "cpu": [ "x64" ], @@ -826,9 +826,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.30.1.tgz", - "integrity": "sha512-V9U8Ey2UqmQsBT+xTOeMzPzwDzyXmnAoO4edZhL7INkwQcaW1Ckv3WJX3qrrp/VHaDkEWIBWhRwP47r8cdrOow==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.1.tgz", + "integrity": "sha512-jqtKrO715hDlvUcEsPn55tZt2TEiBvBtCMkUuU0R6fO/WPT7lO9AONjPbd8II7/asSiNVQHCMn4OLGigSuxVQA==", "cpu": [ "x64" ], @@ -839,9 +839,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.30.1.tgz", - "integrity": "sha512-WabtHWiPaFF47W3PkHnjbmWawnX/aE57K47ZDT1BXTS5GgrBUEpvOzq0FI0V/UYzQJgdb8XlhVNH8/fwV8xDjw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.1.tgz", + "integrity": "sha512-RnHy7yFf2Wz8Jj1+h8klB93N0NHNHXFhNwAmiy9zJdpY7DE01VbEVtPdrK1kkILeIbHGRJjvfBDBhnxBr8kD4g==", "cpu": [ "arm64" ], @@ -852,9 +852,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.30.1.tgz", - "integrity": "sha512-pxHAU+Zv39hLUTdQQHUVHf4P+0C47y/ZloorHpzs2SXMRqeAWmGghzAhfOlzFHHwjvgokdFAhC4V+6kC1lRRfw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.1.tgz", + "integrity": "sha512-i7aT5HdiZIcd7quhzvwQ2oAuX7zPYrYfkrd1QFfs28Po/i0q6kas/oRrzGlDhAEyug+1UfUtkWdmoVlLJj5x9Q==", "cpu": [ "ia32" ], @@ -865,9 +865,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.30.1.tgz", - "integrity": "sha512-D6qjsXGcvhTjv0kI4fU8tUuBDF/Ueee4SVX79VfNDXZa64TfCW1Slkb6Z7O1p7vflqZjcmOVdZlqf8gvJxc6og==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.1.tgz", + "integrity": "sha512-k3MVFD9Oq+laHkw2N2v7ILgoa9017ZMF/inTtHzyTVZjYs9cSH18sdyAf6spBAJIGwJ5UaC7et2ZH1WCdlhkMw==", "cpu": [ "x64" ], @@ -1000,13 +1000,13 @@ } }, "node_modules/@vitest/expect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", - "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.1.tgz", + "integrity": "sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==", "license": "MIT", "dependencies": { - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", "chai": "^4.3.10" }, "funding": { @@ -1014,12 +1014,12 @@ } }, "node_modules/@vitest/runner": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", - "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.1.tgz", + "integrity": "sha512-3nSnYXkVkf3mXFfE7vVyPmi3Sazhb/2cfZGGs0JRzFsPFvAMBEcrweV1V1GsrstdXeKCTXlJbvnQwGWgEIHmOA==", "license": "MIT", "dependencies": { - "@vitest/utils": "1.6.0", + "@vitest/utils": "1.6.1", "p-limit": "^5.0.0", "pathe": "^1.1.1" }, @@ -1028,9 +1028,9 @@ } }, "node_modules/@vitest/snapshot": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", - "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.1.tgz", + "integrity": "sha512-WvidQuWAzU2p95u8GAKlRMqMyN1yOJkGHnx3M1PL9Raf7AQ1kwLKg04ADlCa3+OXUZE7BceOhVZiuWAbzCKcUQ==", "license": "MIT", "dependencies": { "magic-string": "^0.30.5", @@ -1042,9 +1042,9 @@ } }, "node_modules/@vitest/spy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", - "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.1.tgz", + "integrity": "sha512-MGcMmpGkZebsMZhbQKkAf9CX5zGvjkBTqf8Zx3ApYWXr3wG+QvEu2eXWfnIIWYSJExIp4V9FCKDEeygzkYrXMw==", "license": "MIT", "dependencies": { "tinyspy": "^2.2.0" @@ -1054,9 +1054,9 @@ } }, "node_modules/@vitest/utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", - "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-jOrrUvXM4Av9ZWiG1EajNto0u96kWAhJ1LmPmJhXXQx/32MecEKd10pOLYgS2BQx1TgkGhloPU1ArDW2vvaY6g==", "license": "MIT", "dependencies": { "diff-sequences": "^29.6.3", @@ -2119,9 +2119,9 @@ } }, "node_modules/rollup": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.1.tgz", - "integrity": "sha512-mlJ4glW020fPuLi7DkM/lN97mYEZGWeqBnrljzN0gs7GLctqX3lNWxKQ7Gl712UAX+6fog/L3jh4gb7R6aVi3w==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.1.tgz", + "integrity": "sha512-iYZ/+PcdLYSGfH3S+dGahlW/RWmsqDhLgj1BT9DH/xXJ0ggZN7xkdP9wipPNjjNLczI+fmMLmTB9pye+d2r4GQ==", "license": "MIT", "dependencies": { "@types/estree": "1.0.6" @@ -2134,25 +2134,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.30.1", - "@rollup/rollup-android-arm64": "4.30.1", - "@rollup/rollup-darwin-arm64": "4.30.1", - "@rollup/rollup-darwin-x64": "4.30.1", - "@rollup/rollup-freebsd-arm64": "4.30.1", - "@rollup/rollup-freebsd-x64": "4.30.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.30.1", - "@rollup/rollup-linux-arm-musleabihf": "4.30.1", - "@rollup/rollup-linux-arm64-gnu": "4.30.1", - "@rollup/rollup-linux-arm64-musl": "4.30.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.30.1", - "@rollup/rollup-linux-powerpc64le-gnu": "4.30.1", - "@rollup/rollup-linux-riscv64-gnu": "4.30.1", - "@rollup/rollup-linux-s390x-gnu": "4.30.1", - "@rollup/rollup-linux-x64-gnu": "4.30.1", - "@rollup/rollup-linux-x64-musl": "4.30.1", - "@rollup/rollup-win32-arm64-msvc": "4.30.1", - "@rollup/rollup-win32-ia32-msvc": "4.30.1", - "@rollup/rollup-win32-x64-msvc": "4.30.1", + "@rollup/rollup-android-arm-eabi": "4.34.1", + "@rollup/rollup-android-arm64": "4.34.1", + "@rollup/rollup-darwin-arm64": "4.34.1", + "@rollup/rollup-darwin-x64": "4.34.1", + "@rollup/rollup-freebsd-arm64": "4.34.1", + "@rollup/rollup-freebsd-x64": "4.34.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.1", + "@rollup/rollup-linux-arm-musleabihf": "4.34.1", + "@rollup/rollup-linux-arm64-gnu": "4.34.1", + "@rollup/rollup-linux-arm64-musl": "4.34.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.1", + "@rollup/rollup-linux-riscv64-gnu": "4.34.1", + "@rollup/rollup-linux-s390x-gnu": "4.34.1", + "@rollup/rollup-linux-x64-gnu": "4.34.1", + "@rollup/rollup-linux-x64-musl": "4.34.1", + "@rollup/rollup-win32-arm64-msvc": "4.34.1", + "@rollup/rollup-win32-ia32-msvc": "4.34.1", + "@rollup/rollup-win32-x64-msvc": "4.34.1", "fsevents": "~2.3.2" } }, @@ -2447,9 +2447,9 @@ } }, "node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "license": "MIT", "dependencies": { "esbuild": "^0.21.3", @@ -2506,9 +2506,9 @@ } }, "node_modules/vite-node": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", - "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.1.tgz", + "integrity": "sha512-YAXkfvGtuTzwWbDSACdJSg4A4DZiAqckWe90Zapc/sEX3XvHcw1NdurM/6od8J207tSDqNbSsgdCacBgvJKFuA==", "license": "MIT", "dependencies": { "cac": "^6.7.14", @@ -2528,16 +2528,16 @@ } }, "node_modules/vitest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", - "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.1.tgz", + "integrity": "sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==", "license": "MIT", "dependencies": { - "@vitest/expect": "1.6.0", - "@vitest/runner": "1.6.0", - "@vitest/snapshot": "1.6.0", - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", + "@vitest/expect": "1.6.1", + "@vitest/runner": "1.6.1", + "@vitest/snapshot": "1.6.1", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", "acorn-walk": "^8.3.2", "chai": "^4.3.10", "debug": "^4.3.4", @@ -2551,7 +2551,7 @@ "tinybench": "^2.5.1", "tinypool": "^0.8.3", "vite": "^5.0.0", - "vite-node": "1.6.0", + "vite-node": "1.6.1", "why-is-node-running": "^2.2.2" }, "bin": { @@ -2566,8 +2566,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "1.6.0", - "@vitest/ui": "1.6.0", + "@vitest/browser": "1.6.1", + "@vitest/ui": "1.6.1", "happy-dom": "*", "jsdom": "*" }, diff --git a/eng/emitter-package.json b/eng/emitter-package.json index de8bd2ff43..b9d530aff1 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,7 +1,7 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-rust": "0.7.0" + "@azure-tools/typespec-rust": "0.8.0" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.50.0", @@ -14,4 +14,4 @@ "@typespec/versioning": "0.64.0", "@typespec/xml": "0.64.0" } -} \ No newline at end of file +} diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs index fab74751e9..562dba01e0 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs @@ -12,6 +12,7 @@ use crate::models::{ }; use std::sync::Arc; use typespec_client_core::json; +use typespec_client_core::fmt::SafeDebug; use typespec_client_core::http::PagerResult; pub struct KeyVaultClient { @@ -20,7 +21,7 @@ pub struct KeyVaultClient { pipeline: Pipeline, } -#[derive(Clone, Debug)] +#[derive(Clone, SafeDebug)] pub struct KeyVaultClientOptions { pub api_version: String, pub client_options: ClientOptions, @@ -60,12 +61,12 @@ impl KeyVaultClient { /// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical /// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored /// in an EU geographical area. This operation requires the key/backup permission. - pub async fn backup_key(&self, key_name: String, options: Option>) -> Result> { + pub async fn backup_key(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/backup"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -78,12 +79,12 @@ impl KeyVaultClient { /// /// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure /// Key Vault creates a new version of the key. It requires the keys/create permission. - pub async fn create_key(&self, key_name: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn create_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/create"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -103,13 +104,13 @@ impl KeyVaultClient { /// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the /// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode /// for more information. - pub async fn decrypt(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn decrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/decrypt"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -125,12 +126,12 @@ impl KeyVaultClient { /// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic /// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. /// This operation requires the keys/delete permission. - pub async fn delete_key(&self, key_name: String, options: Option>) -> Result> { + pub async fn delete_key(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Delete); @@ -147,13 +148,13 @@ impl KeyVaultClient { /// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation /// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the /// public key material. This operation requires the keys/encrypt permission. - pub async fn encrypt(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn encrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/encrypt"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -168,12 +169,12 @@ impl KeyVaultClient { /// /// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any /// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. - pub async fn get_deleted_key(&self, key_name: String, options: Option>) -> Result> { + pub async fn get_deleted_key(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("deletedkeys/{key-name}"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Get); @@ -197,10 +198,14 @@ impl KeyVaultClient { if let Some(maxresults) = options.maxresults { first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); } + let api_version = self.api_version.clone(); Ok(Pager::from_callback(move |next_link: Option| { let url = match next_link { Some(next_link) => { - next_link + let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); + next_link }, None => { first_url.clone() @@ -233,13 +238,13 @@ impl KeyVaultClient { /// /// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released /// in the response. This operation requires the keys/get permission. - pub async fn get_key(&self, key_name: String, key_version: String, options: Option>) -> Result> { + pub async fn get_key(&self, key_name: &str, key_version: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Get); @@ -252,12 +257,12 @@ impl KeyVaultClient { /// /// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation /// requires the keys/get permission. - pub async fn get_key_rotation_policy(&self, key_name: String, options: Option>) -> Result> { + pub async fn get_key_rotation_policy(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/rotationpolicy"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Get); @@ -269,21 +274,25 @@ impl KeyVaultClient { /// Retrieves a list of individual key versions with the same key name. /// /// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. - pub fn get_key_versions(&self, key_name: String, options: Option>) -> Result> { + pub fn get_key_versions(&self, key_name: &str, 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("keys/{key-name}/versions"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); first_url = first_url.join(&path)?; first_url.query_pairs_mut().append_pair("api-version", &self.api_version); if let Some(maxresults) = options.maxresults { first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); } + let api_version = self.api_version.clone(); Ok(Pager::from_callback(move |next_link: Option| { let url = match next_link { Some(next_link) => { - next_link + let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); + next_link }, None => { first_url.clone() @@ -326,10 +335,14 @@ impl KeyVaultClient { if let Some(maxresults) = options.maxresults { first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); } + let api_version = self.api_version.clone(); Ok(Pager::from_callback(move |next_link: Option| { let url = match next_link { Some(next_link) => { - next_link + let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); + next_link }, None => { first_url.clone() @@ -379,12 +392,12 @@ impl KeyVaultClient { /// /// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, /// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. - pub async fn import_key(&self, key_name: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn import_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Put); @@ -399,12 +412,12 @@ impl KeyVaultClient { /// /// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any /// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. - pub async fn purge_deleted_key(&self, key_name: String, options: Option>) -> Result> { + pub async fn purge_deleted_key(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("deletedkeys/{key-name}"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Delete); @@ -418,12 +431,12 @@ impl KeyVaultClient { /// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted /// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this /// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. - pub async fn recover_deleted_key(&self, key_name: String, options: Option>) -> Result> { + pub async fn recover_deleted_key(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("deletedkeys/{key-name}/recover"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -436,13 +449,13 @@ impl KeyVaultClient { /// /// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires /// the keys/release permission. - pub async fn release(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn release(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/release"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -480,12 +493,12 @@ impl KeyVaultClient { /// Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. /// /// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - pub async fn rotate_key(&self, key_name: String, options: Option>) -> Result> { + pub async fn rotate_key(&self, key_name: &str, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/rotate"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -498,13 +511,13 @@ impl KeyVaultClient { /// /// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses /// the private portion of the key. This operation requires the keys/sign permission. - pub async fn sign(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn sign(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/sign"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -520,13 +533,13 @@ impl KeyVaultClient { /// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the /// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault /// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. - pub async fn unwrap_key(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn unwrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/unwrapkey"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -542,13 +555,13 @@ impl KeyVaultClient { /// /// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a /// key itself cannot be changed. This operation requires the keys/update permission. - pub async fn update_key(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn update_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Patch); @@ -562,12 +575,12 @@ impl KeyVaultClient { /// Updates the rotation policy for a key. /// /// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. - pub async fn update_key_rotation_policy(&self, key_name: String, key_rotation_policy: RequestContent, options: Option>) -> Result> { + pub async fn update_key_rotation_policy(&self, key_name: &str, key_rotation_policy: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/rotationpolicy"); - path = path.replace("{key-name}", &key_name); + path = path.replace("{key-name}", key_name); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Put); @@ -584,13 +597,13 @@ impl KeyVaultClient { /// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this /// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. /// This operation requires the keys/verify permission. - pub async fn verify(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn verify(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/verify"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -608,13 +621,13 @@ impl KeyVaultClient { /// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric /// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation /// requires the keys/wrapKey permission. - pub async fn wrap_key(&self, key_name: String, key_version: String, parameters: RequestContent, options: Option>) -> Result> { + pub async fn wrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/{key-version}/wrapkey"); - path = path.replace("{key-name}", &key_name); - path = path.replace("{key-version}", &key_version); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); url = url.join(&path)?; url.query_pairs_mut().append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); @@ -635,43 +648,43 @@ impl Default for KeyVaultClientOptions { } } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientBackupKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientCreateKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientDecryptOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientDeleteKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientEncryptOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetDeletedKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetDeletedKeysOptions<'a> { pub maxresults: Option, pub method_options: ClientMethodOptions<'a>, @@ -688,19 +701,19 @@ impl KeyVaultClientGetDeletedKeysOptions<'_> { } } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetKeyRotationPolicyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetKeyVersionsOptions<'a> { pub maxresults: Option, pub method_options: ClientMethodOptions<'a>, @@ -717,7 +730,7 @@ impl KeyVaultClientGetKeyVersionsOptions<'_> { } } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetKeysOptions<'a> { pub maxresults: Option, pub method_options: ClientMethodOptions<'a>, @@ -734,79 +747,79 @@ impl KeyVaultClientGetKeysOptions<'_> { } } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientGetRandomBytesOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientImportKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientPurgeDeletedKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientRecoverDeletedKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientReleaseOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientRestoreKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientRotateKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientSignOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientUnwrapKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientUpdateKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientUpdateKeyRotationPolicyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientVerifyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } -#[derive(Clone, Debug, Default)] +#[derive(Clone, Default, SafeDebug)] pub struct KeyVaultClientWrapKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs index 96eb4b26c1..acf207716a 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs @@ -3,4 +3,5 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -pub mod key_vault_client; +mod key_vault_client; +pub use key_vault_client::*; \ No newline at end of file diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs index f4762e6572..ddb3d02ab1 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs @@ -12,9 +12,10 @@ use serde::{ }; use std::collections::HashMap; use time::OffsetDateTime; +use typespec_client_core::fmt::SafeDebug; /// The backup key result, containing the backup blob. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct BackupKeyResult { /// The backup blob containing the backed up key. @@ -24,7 +25,7 @@ pub struct BackupKeyResult { } /// A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct DeletedKeyBundle { /// The key management attributes. @@ -62,7 +63,7 @@ pub struct DeletedKeyBundle { } /// The deleted key item containing the deleted key metadata and information about deletion. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct DeletedKeyItem { /// The key management attributes. @@ -96,7 +97,7 @@ pub struct DeletedKeyItem { } /// A list of keys that have been deleted in this vault. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct DeletedKeyListResult { /// The URL to get the next set of deleted keys. @@ -110,8 +111,7 @@ pub struct DeletedKeyListResult { } /// The get random bytes request object. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct GetRandomBytesRequest { /// The requested number of random bytes. #[serde(skip_serializing_if = "Option::is_none")] @@ -120,8 +120,7 @@ pub struct GetRandomBytesRequest { } /// As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct JsonWebKey { /// Elliptic curve name. For valid values, see JsonWebKeyCurveName. #[serde(skip_serializing_if = "Option::is_none")] @@ -190,8 +189,7 @@ pub struct JsonWebKey { } /// The attributes of a key managed by the key vault service. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyAttributes { /// Creation time in UTC. #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] @@ -235,7 +233,7 @@ pub struct KeyAttributes { } /// A KeyBundle consisting of a WebKey plus its attributes. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyBundle { /// The key management attributes. @@ -261,8 +259,7 @@ pub struct KeyBundle { } /// The key create parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyCreateParameters { /// Elliptic curve name. For valid values, see JsonWebKeyCurveName. #[serde(rename = "crv", skip_serializing_if = "Option::is_none")] @@ -299,8 +296,7 @@ pub struct KeyCreateParameters { } /// The key import parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyImportParameters { /// Whether to import as a hardware key (HSM) or software key. #[serde(rename = "Hsm", skip_serializing_if = "Option::is_none")] @@ -325,7 +321,7 @@ pub struct KeyImportParameters { } /// The key item containing key metadata. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyItem { /// The key management attributes. @@ -347,7 +343,7 @@ pub struct KeyItem { } /// The key list result. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyListResult { /// The URL to get the next set of keys. @@ -361,7 +357,7 @@ pub struct KeyListResult { } /// The key operation result. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyOperationResult { /// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. @@ -387,8 +383,7 @@ pub struct KeyOperationResult { } /// The key operations parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyOperationsParameters { /// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] @@ -413,8 +408,7 @@ pub struct KeyOperationsParameters { } /// The release key parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyReleaseParameters { /// The encryption algorithm to use to protected the exported key material #[serde(skip_serializing_if = "Option::is_none")] @@ -431,8 +425,7 @@ pub struct KeyReleaseParameters { } /// The policy rules under which the key can be exported. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyReleasePolicy { /// Content type and version of key release policy #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] @@ -450,7 +443,7 @@ pub struct KeyReleasePolicy { } /// The release result, containing the released key. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyReleaseResult { /// A signed object containing the released key. @@ -460,8 +453,7 @@ pub struct KeyReleaseResult { } /// The key restore parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyRestoreParameters { /// The backup blob associated with a key bundle. #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] @@ -470,8 +462,7 @@ pub struct KeyRestoreParameters { } /// Management policy for a key. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyRotationPolicy { /// The key rotation policy attributes. #[serde(skip_serializing_if = "Option::is_none")] @@ -490,8 +481,7 @@ pub struct KeyRotationPolicy { } /// The key rotation policy attributes. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyRotationPolicyAttributes { /// The key rotation policy created time in UTC. #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] @@ -509,8 +499,7 @@ pub struct KeyRotationPolicyAttributes { } /// The key operations parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeySignParameters { /// The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] @@ -523,8 +512,7 @@ pub struct KeySignParameters { } /// The key update parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyUpdateParameters { /// The attributes of a key managed by the key vault service. #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] @@ -545,8 +533,7 @@ pub struct KeyUpdateParameters { } /// The key verify parameters. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyVerifyParameters { /// The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] @@ -563,7 +550,7 @@ pub struct KeyVerifyParameters { } /// The key verify result. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyVerifyResult { /// True if the signature is verified, otherwise false. @@ -573,8 +560,7 @@ pub struct KeyVerifyResult { } /// Action and its trigger that will be performed by Key Vault over the lifetime of a key. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct LifetimeActions { /// The action that will be executed. #[serde(skip_serializing_if = "Option::is_none")] @@ -587,8 +573,7 @@ pub struct LifetimeActions { } /// A condition to be satisfied for an action to be executed. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct LifetimeActionsTrigger { /// Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: /// 90 days : "P90D" @@ -602,8 +587,7 @@ pub struct LifetimeActionsTrigger { } /// The action that will be executed. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] -#[non_exhaustive] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct LifetimeActionsType { /// The type of the action. The value should be compared case-insensitively. #[serde(rename = "type", skip_serializing_if = "Option::is_none")] @@ -612,7 +596,7 @@ pub struct LifetimeActionsType { } /// The get random bytes response object containing the bytes. -#[derive(Clone, Debug, Default, Deserialize, Serialize, azure_core::Model)] +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct RandomBytes { /// The bytes encoded as a base64url string. diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs index e58cb39e90..9048f25cb7 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs @@ -5,11 +5,40 @@ mod generated; -pub use crate::generated::clients::*; +pub mod clients { + pub use crate::generated::clients::*; +} pub mod models { pub use crate::generated::enums::*; pub use crate::generated::models::*; } -pub use key_vault_client::KeyVaultClient; +pub use crate::generated::clients::{ + KeyVaultClient, KeyVaultClientOptions, + KeyVaultClientBackupKeyOptions, + KeyVaultClientCreateKeyOptions, + KeyVaultClientDecryptOptions, + KeyVaultClientDeleteKeyOptions, + KeyVaultClientEncryptOptions, + KeyVaultClientGetDeletedKeyOptions, + KeyVaultClientGetDeletedKeysOptions, + KeyVaultClientGetKeyOptions, + KeyVaultClientGetKeyRotationPolicyOptions, + KeyVaultClientGetKeyVersionsOptions, + KeyVaultClientGetKeysOptions, + KeyVaultClientGetRandomBytesOptions, + KeyVaultClientImportKeyOptions, + KeyVaultClientPurgeDeletedKeyOptions, + KeyVaultClientRecoverDeletedKeyOptions, + KeyVaultClientReleaseOptions, + KeyVaultClientRestoreKeyOptions, + KeyVaultClientRotateKeyOptions, + KeyVaultClientSignOptions, + KeyVaultClientUnwrapKeyOptions, + KeyVaultClientUpdateKeyOptions, + KeyVaultClientUpdateKeyRotationPolicyOptions, + KeyVaultClientVerifyOptions, + KeyVaultClientWrapKeyOptions, +}; + From 9e2a5f4d43405d8b3918ab4e20de3f321b46c929 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 14:30:23 -0800 Subject: [PATCH 06/13] Remove file --- sdk/keyvault/azure_security_keyvault_keys/src/main.rs | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/main.rs diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/main.rs b/sdk/keyvault/azure_security_keyvault_keys/src/main.rs deleted file mode 100644 index e7a11a969c..0000000000 --- a/sdk/keyvault/azure_security_keyvault_keys/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} From a59764f24791e283f31d4139a51e1c3b42244e13 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 15:14:35 -0800 Subject: [PATCH 07/13] Fix client name --- .../src/generated/clients/key_client.rs | 827 ++++++++++++++++++ .../src/generated/clients/mod.rs | 4 +- .../azure_security_keyvault_keys/src/lib.rs | 50 +- .../tsp-location.yaml | 2 +- 4 files changed, 855 insertions(+), 28 deletions(-) create mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs new file mode 100644 index 0000000000..4f0050bd09 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs @@ -0,0 +1,827 @@ +// 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. DO NOT EDIT. + +use azure_core::{ + BearerTokenCredentialPolicy, ClientMethodOptions, ClientOptions, Context, Method, Pager, Pipeline, Policy, Request, RequestContent, Response, Result, Url, +}; +use azure_core::credentials::TokenCredential; +use crate::models::{ + BackupKeyResult, DeletedKeyBundle, DeletedKeyListResult, GetRandomBytesRequest, KeyBundle, KeyCreateParameters, KeyImportParameters, KeyListResult, KeyOperationResult, KeyOperationsParameters, KeyReleaseParameters, KeyReleaseResult, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, KeyVerifyResult, RandomBytes, +}; +use std::sync::Arc; +use typespec_client_core::json; +use typespec_client_core::fmt::SafeDebug; +use typespec_client_core::http::PagerResult; + +pub struct KeyClient { + api_version: String, + endpoint: Url, + pipeline: Pipeline, +} + +#[derive(Clone, SafeDebug)] +pub struct KeyClientOptions { + pub api_version: String, + pub client_options: ClientOptions, +} + +impl KeyClient { + pub fn new(endpoint: &str, credential: Arc, options: Option) -> Result { + let options = options.unwrap_or_default(); + let mut endpoint = Url::parse(endpoint)?; + endpoint.set_query(None); + let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new(credential, vec!["https://vault.azure.net/.default"])); + Ok(Self { + endpoint, + 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], + ), + }) + } + + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Requests that a backup of the specified key be downloaded to the client. +/// +/// The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return +/// key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected +/// to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a +/// key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP +/// operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot +/// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical +/// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored +/// in an EU geographical area. This operation requires the key/backup permission. + pub async fn backup_key(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/backup"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Creates a new key, stores it, then returns key parameters and attributes to the client. +/// +/// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure +/// Key Vault creates a new version of the key. It requires the keys/create permission. + pub async fn create_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/create"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Decrypts a single block of encrypted data. +/// +/// The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. +/// This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this +/// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric +/// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt +/// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the +/// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode +/// for more information. + pub async fn decrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/decrypt"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Deletes a key of any type from storage in Azure Key Vault. +/// +/// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic +/// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. +/// This operation requires the keys/delete permission. + pub async fn delete_key(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. +/// +/// The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. +/// Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key +/// and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in +/// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation +/// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the +/// public key material. This operation requires the keys/encrypt permission. + pub async fn encrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/encrypt"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Gets the public part of a deleted key. +/// +/// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any +/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. + pub async fn get_deleted_key(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Lists the deleted keys in the specified vault. +/// +/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. +/// This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled +/// for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete +/// enabled vault. This operation requires the keys/list permission. + pub fn get_deleted_keys(&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 = first_url.join("deletedkeys")?; + first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + } + let api_version = self.api_version.clone(); + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); + next_link + }, + None => { + first_url.clone() + }, + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: DeletedKeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { + response: rsp, + }, + }) + } + })) + } + + /// Gets the public part of a stored key. +/// +/// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released +/// in the response. This operation requires the keys/get permission. + pub async fn get_key(&self, key_name: &str, key_version: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Lists the policy for a key. +/// +/// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation +/// requires the keys/get permission. + pub async fn get_key_rotation_policy(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotationpolicy"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Retrieves a list of individual key versions with the same key name. +/// +/// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. + pub fn get_key_versions(&self, key_name: &str, 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("keys/{key-name}/versions"); + path = path.replace("{key-name}", key_name); + first_url = first_url.join(&path)?; + first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + } + let api_version = self.api_version.clone(); + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); + next_link + }, + None => { + first_url.clone() + }, + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: KeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { + response: rsp, + }, + }) + } + })) + } + + /// List keys in the specified vault. +/// +/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. +/// The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided +/// in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. + pub fn get_keys(&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 = first_url.join("keys")?; + first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + } + let api_version = self.api_version.clone(); + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); + next_link + }, + None => { + first_url.clone() + }, + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: KeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { + response: rsp, + }, + }) + } + })) + } + + /// Get the requested number of bytes containing random values. +/// +/// Get the requested number of bytes containing random values from a managed HSM. + pub async fn get_random_bytes(&self, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + url = url.join("rng")?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Imports an externally created key, stores it, and returns key parameters and attributes to the client. +/// +/// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, +/// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. + pub async fn import_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + 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); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Permanently deletes the specified key. +/// +/// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any +/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. + pub async fn purge_deleted_key(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Recovers the deleted key to its latest version. +/// +/// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted +/// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this +/// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. + pub async fn recover_deleted_key(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}/recover"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Releases a key. +/// +/// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires +/// the keys/release permission. + pub async fn release(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/release"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Restores a backed up key to a vault. +/// +/// Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access +/// control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key +/// cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the +/// key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained +/// during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore +/// all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key +/// Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission +/// in the target Key Vault. This operation requires the keys/restore permission. + pub async fn restore_key(&self, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + url = url.join("keys/restore")?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. +/// +/// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. + pub async fn rotate_key(&self, key_name: &str, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotate"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Creates a signature from a digest using the specified key. +/// +/// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses +/// the private portion of the key. This operation requires the keys/sign permission. + pub async fn sign(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/sign"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Unwraps a symmetric key using the specified key that was initially used for wrapping that key. +/// +/// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the +/// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault +/// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. + pub async fn unwrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/unwrapkey"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// The update key operation changes specified attributes of a stored key and can be applied to any key type and key version +/// stored in Azure Key Vault. +/// +/// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a +/// key itself cannot be changed. This operation requires the keys/update permission. + pub async fn update_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + 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); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Updates the rotation policy for a key. +/// +/// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. + pub async fn update_key_rotation_policy(&self, key_name: &str, key_rotation_policy: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotationpolicy"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(key_rotation_policy); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Verifies a signature using a specified key. +/// +/// The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric +/// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this +/// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. +/// This operation requires the keys/verify permission. + pub async fn verify(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/verify"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } + + /// Wraps a symmetric key using a specified key. +/// +/// The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in +/// an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection +/// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric +/// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation +/// requires the keys/wrapKey permission. + pub async fn wrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/wrapkey"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut().append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + + } +} + +impl Default for KeyClientOptions { + fn default() -> Self { + Self { + api_version: String::from("7.6-preview.1"), + client_options: ClientOptions::default(), + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientBackupKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientCreateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientDecryptOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientDeleteKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientEncryptOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetDeletedKeysOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyClientGetDeletedKeysOptions<'_> { + pub fn into_owned(self) -> KeyClientGetDeletedKeysOptions<'static> { + KeyClientGetDeletedKeysOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeyRotationPolicyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeyVersionsOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyClientGetKeyVersionsOptions<'_> { + pub fn into_owned(self) -> KeyClientGetKeyVersionsOptions<'static> { + KeyClientGetKeyVersionsOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeysOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyClientGetKeysOptions<'_> { + pub fn into_owned(self) -> KeyClientGetKeysOptions<'static> { + KeyClientGetKeysOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetRandomBytesOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientImportKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientPurgeDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientRecoverDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientReleaseOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientRestoreKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientRotateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientSignOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientUnwrapKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientUpdateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientUpdateKeyRotationPolicyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientVerifyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientWrapKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + + diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs index acf207716a..50df89f4a5 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs @@ -3,5 +3,5 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -mod key_vault_client; -pub use key_vault_client::*; \ No newline at end of file +mod key_client; +pub use key_client::*; \ No newline at end of file diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs index 9048f25cb7..3e934434a3 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs @@ -15,30 +15,30 @@ pub mod models { } pub use crate::generated::clients::{ - KeyVaultClient, KeyVaultClientOptions, - KeyVaultClientBackupKeyOptions, - KeyVaultClientCreateKeyOptions, - KeyVaultClientDecryptOptions, - KeyVaultClientDeleteKeyOptions, - KeyVaultClientEncryptOptions, - KeyVaultClientGetDeletedKeyOptions, - KeyVaultClientGetDeletedKeysOptions, - KeyVaultClientGetKeyOptions, - KeyVaultClientGetKeyRotationPolicyOptions, - KeyVaultClientGetKeyVersionsOptions, - KeyVaultClientGetKeysOptions, - KeyVaultClientGetRandomBytesOptions, - KeyVaultClientImportKeyOptions, - KeyVaultClientPurgeDeletedKeyOptions, - KeyVaultClientRecoverDeletedKeyOptions, - KeyVaultClientReleaseOptions, - KeyVaultClientRestoreKeyOptions, - KeyVaultClientRotateKeyOptions, - KeyVaultClientSignOptions, - KeyVaultClientUnwrapKeyOptions, - KeyVaultClientUpdateKeyOptions, - KeyVaultClientUpdateKeyRotationPolicyOptions, - KeyVaultClientVerifyOptions, - KeyVaultClientWrapKeyOptions, + KeyClient, KeyClientOptions, + KeyClientBackupKeyOptions, + KeyClientCreateKeyOptions, + KeyClientDecryptOptions, + KeyClientDeleteKeyOptions, + KeyClientEncryptOptions, + KeyClientGetDeletedKeyOptions, + KeyClientGetDeletedKeysOptions, + KeyClientGetKeyOptions, + KeyClientGetKeyRotationPolicyOptions, + KeyClientGetKeyVersionsOptions, + KeyClientGetKeysOptions, + KeyClientGetRandomBytesOptions, + KeyClientImportKeyOptions, + KeyClientPurgeDeletedKeyOptions, + KeyClientRecoverDeletedKeyOptions, + KeyClientReleaseOptions, + KeyClientRestoreKeyOptions, + KeyClientRotateKeyOptions, + KeyClientSignOptions, + KeyClientUnwrapKeyOptions, + KeyClientUpdateKeyOptions, + KeyClientUpdateKeyRotationPolicyOptions, + KeyClientVerifyOptions, + KeyClientWrapKeyOptions, }; diff --git a/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml b/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml index a2270abd35..b2d23824fc 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml +++ b/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/keyvault/Security.KeyVault.Keys -commit: 4744046cdc26b7e60ba4615bc79dc1fdfce4ea71 +commit: 96ddfd68b9d2baabe3d3678094ae37bd33d23d4a repo: Azure/azure-rest-api-specs additionalDirectories: - specification/keyvault/Security.KeyVault.Common/ From 26e2bc4f347cfc9d24e33e7e2822d33ee16dad31 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 16:41:37 -0800 Subject: [PATCH 08/13] Update to latest emitter --- eng/emitter-package-lock.json | 26 +++++------ eng/emitter-package.json | 2 +- .../src/generated/enums.rs | 44 +++++++++---------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 0e24169088..ffeaee3340 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-rust": "0.8.0" + "@azure-tools/typespec-rust": "0.8.1" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.50.0", @@ -152,9 +152,9 @@ } }, "node_modules/@azure-tools/typespec-rust": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.8.0.tgz", - "integrity": "sha512-nYLqe6YdDuAA8c/jh6Qq8MtDF/D2x8PCKLDekOHCTk3r3/WO+BuOWwNJjAy0Cik77lLxGEtI4PTpBlMFnq2IDA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.8.1.tgz", + "integrity": "sha512-TsNJ+Or1PrlMhdUmHRl6MLU1NVoTo3rfAqMzJTwGNio60b7EYpgCPs+ljU8VanUWnc80Ve/o2t+zQNGWrNK22Q==", "license": "MIT", "dependencies": { "@azure-tools/codegen": "~2.9.2", @@ -1434,9 +1434,9 @@ } }, "node_modules/fast-uri": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.5.tgz", - "integrity": "sha512-5JnBCWpFlMo0a3ciDy/JckMzzv1U9coZrIhedq+HXxxUfDTAiS0LA8OKVao4G9BxmCVck/jtA5r3KAtRWEyD8Q==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", "funding": [ { "type": "github", @@ -1450,9 +1450,9 @@ "license": "BSD-3-Clause" }, "node_modules/fastq": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", - "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", + "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", "license": "ISC", "dependencies": { "reusify": "^1.0.4" @@ -2180,9 +2180,9 @@ } }, "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "license": "ISC", "bin": { "semver": "bin/semver.js" diff --git a/eng/emitter-package.json b/eng/emitter-package.json index b9d530aff1..4f43ed41fd 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,7 +1,7 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-rust": "0.8.0" + "@azure-tools/typespec-rust": "0.8.1" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.50.0", diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs index f681c9e8b0..59793758eb 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs @@ -28,23 +28,23 @@ create_extensible_enum!( create_extensible_enum!( JsonWebKeyEncryptionAlgorithm, - (A128CBC, "A128CBC"), - (A128CBCPAD, "A128CBCPAD"), - (A128GCM, "A128GCM"), - (A128KW, "A128KW"), - (A192CBC, "A192CBC"), - (A192CBCPAD, "A192CBCPAD"), - (A192GCM, "A192GCM"), - (A192KW, "A192KW"), - (A256CBC, "A256CBC"), - (A256CBCPAD, "A256CBCPAD"), - (A256GCM, "A256GCM"), - (A256KW, "A256KW"), - (CKMAESKEYWRAP, "CKM_AES_KEY_WRAP"), - (CKMAESKEYWRAPPAD, "CKM_AES_KEY_WRAP_PAD"), + (A128Cbc, "A128CBC"), + (A128Cbcpad, "A128CBCPAD"), + (A128Gcm, "A128GCM"), + (A128Kw, "A128KW"), + (A192Cbc, "A192CBC"), + (A192Cbcpad, "A192CBCPAD"), + (A192Gcm, "A192GCM"), + (A192Kw, "A192KW"), + (A256Cbc, "A256CBC"), + (A256Cbcpad, "A256CBCPAD"), + (A256Gcm, "A256GCM"), + (A256Kw, "A256KW"), + (CkmAesKeyWrap, "CKM_AES_KEY_WRAP"), + (CkmAesKeyWrapPad, "CKM_AES_KEY_WRAP_PAD"), (RSA1_5, "RSA1_5"), - (RSAOAEP, "RSA-OAEP"), - (RSAOAEP256, "RSA-OAEP-256") + (RsaOAEP256, "RSA-OAEP-256"), + (RsaOaep, "RSA-OAEP") ); create_extensible_enum!( @@ -77,18 +77,18 @@ create_extensible_enum!( create_extensible_enum!( JsonWebKeyType, (EC, "EC"), - (ECHSM, "EC-HSM"), + (EcHsm, "EC-HSM"), (Oct, "oct"), - (OctHSM, "oct-HSM"), + (OctHsm, "oct-HSM"), (RSA, "RSA"), - (RSAHSM, "RSA-HSM") + (RsaHsm, "RSA-HSM") ); create_extensible_enum!( KeyEncryptionAlgorithm, - (CKMRSAAESKEYWRAP, "CKM_RSA_AES_KEY_WRAP"), - (RSAAESKEYWRAP_256, "RSA_AES_KEY_WRAP_256"), - (RSAAESKEYWRAP_384, "RSA_AES_KEY_WRAP_384") + (CkmRsaAesKeyWrap, "CKM_RSA_AES_KEY_WRAP"), + (RsaAesKeyWrap256, "RSA_AES_KEY_WRAP_256"), + (RsaAesKeyWrap384, "RSA_AES_KEY_WRAP_384") ); create_enum!( From 4a819d87d3b5665d8c1a4bc65289678e9df4efb1 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 16:44:34 -0800 Subject: [PATCH 09/13] Update the version --- Cargo.lock | 2 +- sdk/keyvault/azure_security_keyvault_keys/Cargo.toml | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae78beba1a..597f5cbb85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "azure_security_keyvault_keys" -version = "0.0.1" +version = "0.1.0" dependencies = [ "azure_core", "futures", diff --git a/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml b/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml index 7b5285b6ff..4144026754 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml +++ b/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml @@ -1,11 +1,17 @@ [package] name = "azure_security_keyvault_keys" -version = "0.0.1" +version = "0.1.0" +description = "Rust wrappers around Microsoft Azure REST APIs - Azure KeyVault Keys" +readme = "README.md" authors.workspace = true edition.workspace = true license.workspace = true repository.workspace = true rust-version.workspace = true +homepage = "https://github.com/azure/azure-sdk-for-rust" +documentation = "https://docs.rs/azure_security_keyvault_keys" +keywords = ["sdk", "azure", "rest", "cloud", "keyvault", "security", "keys"] +categories = ["api-bindings"] [dependencies] azure_core = { workspace = true } From bccf94a6608aa696233506b3684bafd65c557834 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 16:47:45 -0800 Subject: [PATCH 10/13] Remove out of date file --- .../src/generated/clients/key_vault_client.rs | 827 ------------------ 1 file changed, 827 deletions(-) delete mode 100644 sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs deleted file mode 100644 index 562dba01e0..0000000000 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_vault_client.rs +++ /dev/null @@ -1,827 +0,0 @@ -// 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. DO NOT EDIT. - -use azure_core::{ - BearerTokenCredentialPolicy, ClientMethodOptions, ClientOptions, Context, Method, Pager, Pipeline, Policy, Request, RequestContent, Response, Result, Url, -}; -use azure_core::credentials::TokenCredential; -use crate::models::{ - BackupKeyResult, DeletedKeyBundle, DeletedKeyListResult, GetRandomBytesRequest, KeyBundle, KeyCreateParameters, KeyImportParameters, KeyListResult, KeyOperationResult, KeyOperationsParameters, KeyReleaseParameters, KeyReleaseResult, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, KeyVerifyResult, RandomBytes, -}; -use std::sync::Arc; -use typespec_client_core::json; -use typespec_client_core::fmt::SafeDebug; -use typespec_client_core::http::PagerResult; - -pub struct KeyVaultClient { - api_version: String, - endpoint: Url, - pipeline: Pipeline, -} - -#[derive(Clone, SafeDebug)] -pub struct KeyVaultClientOptions { - pub api_version: String, - pub client_options: ClientOptions, -} - -impl KeyVaultClient { - pub fn new(endpoint: &str, credential: Arc, options: Option) -> Result { - let options = options.unwrap_or_default(); - let mut endpoint = Url::parse(endpoint)?; - endpoint.set_query(None); - let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new(credential, vec!["https://vault.azure.net/.default"])); - Ok(Self { - endpoint, - 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], - ), - }) - } - - /// Returns the Url associated with this client. - pub fn endpoint(&self) -> &Url { - &self.endpoint - } - - /// Requests that a backup of the specified key be downloaded to the client. -/// -/// The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return -/// key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected -/// to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a -/// key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP -/// operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot -/// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical -/// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored -/// in an EU geographical area. This operation requires the key/backup permission. - pub async fn backup_key(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/backup"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Creates a new key, stores it, then returns key parameters and attributes to the client. -/// -/// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure -/// Key Vault creates a new version of the key. It requires the keys/create permission. - pub async fn create_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/create"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Decrypts a single block of encrypted data. -/// -/// The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. -/// This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this -/// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric -/// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt -/// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the -/// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode -/// for more information. - pub async fn decrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/decrypt"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Deletes a key of any type from storage in Azure Key Vault. -/// -/// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic -/// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. -/// This operation requires the keys/delete permission. - pub async fn delete_key(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Delete); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. -/// -/// The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. -/// Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key -/// and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in -/// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation -/// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the -/// public key material. This operation requires the keys/encrypt permission. - pub async fn encrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/encrypt"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Gets the public part of a deleted key. -/// -/// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any -/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. - pub async fn get_deleted_key(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("deletedkeys/{key-name}"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Lists the deleted keys in the specified vault. -/// -/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. -/// This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled -/// for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete -/// enabled vault. This operation requires the keys/list permission. - pub fn get_deleted_keys(&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 = first_url.join("deletedkeys")?; - first_url.query_pairs_mut().append_pair("api-version", &self.api_version); - if let Some(maxresults) = options.maxresults { - first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); - } - let api_version = self.api_version.clone(); - Ok(Pager::from_callback(move |next_link: Option| { - let url = match next_link { - Some(next_link) => { - let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); - let mut next_link = next_link.clone(); - next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); - next_link - }, - None => { - first_url.clone() - }, - }; - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); - let ctx = options.method_options.context.clone(); - let pipeline = pipeline.clone(); - async move { - let rsp: Response = pipeline.send(&ctx, &mut request).await?; - let (status, headers, body) = rsp.deconstruct(); - let bytes = body.collect().await?; - let res: DeletedKeyListResult = json::from_json(bytes.clone())?; - let rsp = Response::from_bytes(status, headers, bytes); - Ok(match res.next_link { - Some(next_link) => PagerResult::Continue { - response: rsp, - continuation: next_link.parse()?, - }, - None => PagerResult::Complete { - response: rsp, - }, - }) - } - })) - } - - /// Gets the public part of a stored key. -/// -/// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released -/// in the response. This operation requires the keys/get permission. - pub async fn get_key(&self, key_name: &str, key_version: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Lists the policy for a key. -/// -/// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation -/// requires the keys/get permission. - pub async fn get_key_rotation_policy(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/rotationpolicy"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Retrieves a list of individual key versions with the same key name. -/// -/// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. - pub fn get_key_versions(&self, key_name: &str, 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("keys/{key-name}/versions"); - path = path.replace("{key-name}", key_name); - first_url = first_url.join(&path)?; - first_url.query_pairs_mut().append_pair("api-version", &self.api_version); - if let Some(maxresults) = options.maxresults { - first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); - } - let api_version = self.api_version.clone(); - Ok(Pager::from_callback(move |next_link: Option| { - let url = match next_link { - Some(next_link) => { - let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); - let mut next_link = next_link.clone(); - next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); - next_link - }, - None => { - first_url.clone() - }, - }; - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); - let ctx = options.method_options.context.clone(); - let pipeline = pipeline.clone(); - async move { - let rsp: Response = pipeline.send(&ctx, &mut request).await?; - let (status, headers, body) = rsp.deconstruct(); - let bytes = body.collect().await?; - let res: KeyListResult = json::from_json(bytes.clone())?; - let rsp = Response::from_bytes(status, headers, bytes); - Ok(match res.next_link { - Some(next_link) => PagerResult::Continue { - response: rsp, - continuation: next_link.parse()?, - }, - None => PagerResult::Complete { - response: rsp, - }, - }) - } - })) - } - - /// List keys in the specified vault. -/// -/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. -/// The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided -/// in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. - pub fn get_keys(&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 = first_url.join("keys")?; - first_url.query_pairs_mut().append_pair("api-version", &self.api_version); - if let Some(maxresults) = options.maxresults { - first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); - } - let api_version = self.api_version.clone(); - Ok(Pager::from_callback(move |next_link: Option| { - let url = match next_link { - Some(next_link) => { - let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); - let mut next_link = next_link.clone(); - next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); - next_link - }, - None => { - first_url.clone() - }, - }; - let mut request = Request::new(url, Method::Get); - request.insert_header("accept", "application/json"); - let ctx = options.method_options.context.clone(); - let pipeline = pipeline.clone(); - async move { - let rsp: Response = pipeline.send(&ctx, &mut request).await?; - let (status, headers, body) = rsp.deconstruct(); - let bytes = body.collect().await?; - let res: KeyListResult = json::from_json(bytes.clone())?; - let rsp = Response::from_bytes(status, headers, bytes); - Ok(match res.next_link { - Some(next_link) => PagerResult::Continue { - response: rsp, - continuation: next_link.parse()?, - }, - None => PagerResult::Complete { - response: rsp, - }, - }) - } - })) - } - - /// Get the requested number of bytes containing random values. -/// -/// Get the requested number of bytes containing random values from a managed HSM. - pub async fn get_random_bytes(&self, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - url = url.join("rng")?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Imports an externally created key, stores it, and returns key parameters and attributes to the client. -/// -/// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, -/// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. - pub async fn import_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - 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); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Permanently deletes the specified key. -/// -/// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any -/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. - pub async fn purge_deleted_key(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("deletedkeys/{key-name}"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Delete); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Recovers the deleted key to its latest version. -/// -/// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted -/// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this -/// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. - pub async fn recover_deleted_key(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("deletedkeys/{key-name}/recover"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Releases a key. -/// -/// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires -/// the keys/release permission. - pub async fn release(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/release"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Restores a backed up key to a vault. -/// -/// Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access -/// control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key -/// cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the -/// key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained -/// during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore -/// all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key -/// Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission -/// in the target Key Vault. This operation requires the keys/restore permission. - pub async fn restore_key(&self, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - url = url.join("keys/restore")?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. -/// -/// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - pub async fn rotate_key(&self, key_name: &str, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/rotate"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Creates a signature from a digest using the specified key. -/// -/// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses -/// the private portion of the key. This operation requires the keys/sign permission. - pub async fn sign(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/sign"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Unwraps a symmetric key using the specified key that was initially used for wrapping that key. -/// -/// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the -/// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault -/// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. - pub async fn unwrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/unwrapkey"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// The update key operation changes specified attributes of a stored key and can be applied to any key type and key version -/// stored in Azure Key Vault. -/// -/// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a -/// key itself cannot be changed. This operation requires the keys/update permission. - pub async fn update_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - 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); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Updates the rotation policy for a key. -/// -/// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. - pub async fn update_key_rotation_policy(&self, key_name: &str, key_rotation_policy: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/rotationpolicy"); - path = path.replace("{key-name}", key_name); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Put); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(key_rotation_policy); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Verifies a signature using a specified key. -/// -/// The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric -/// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this -/// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. -/// This operation requires the keys/verify permission. - pub async fn verify(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/verify"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } - - /// Wraps a symmetric key using a specified key. -/// -/// The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in -/// an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection -/// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric -/// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation -/// requires the keys/wrapKey permission. - pub async fn wrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { - let options = options.unwrap_or_default(); - let ctx = Context::with_context(&options.method_options.context); - let mut url = self.endpoint.clone(); - let mut path = String::from("keys/{key-name}/{key-version}/wrapkey"); - path = path.replace("{key-name}", key_name); - path = path.replace("{key-version}", key_version); - url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); - let mut request = Request::new(url, Method::Post); - request.insert_header("accept", "application/json"); - request.insert_header("content-type", "application/json"); - request.set_body(parameters); - self.pipeline.send(&ctx, &mut request).await - - } -} - -impl Default for KeyVaultClientOptions { - fn default() -> Self { - Self { - api_version: String::from("7.6-preview.1"), - client_options: ClientOptions::default(), - } - } -} - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientBackupKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientCreateKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientDecryptOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientDeleteKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientEncryptOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetDeletedKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetDeletedKeysOptions<'a> { - pub maxresults: Option, - pub method_options: ClientMethodOptions<'a>, -} - -impl KeyVaultClientGetDeletedKeysOptions<'_> { - pub fn into_owned(self) -> KeyVaultClientGetDeletedKeysOptions<'static> { - KeyVaultClientGetDeletedKeysOptions { - maxresults: self.maxresults, - method_options: ClientMethodOptions { - context: self.method_options.context.into_owned(), - }, - } - } -} - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetKeyRotationPolicyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetKeyVersionsOptions<'a> { - pub maxresults: Option, - pub method_options: ClientMethodOptions<'a>, -} - -impl KeyVaultClientGetKeyVersionsOptions<'_> { - pub fn into_owned(self) -> KeyVaultClientGetKeyVersionsOptions<'static> { - KeyVaultClientGetKeyVersionsOptions { - maxresults: self.maxresults, - method_options: ClientMethodOptions { - context: self.method_options.context.into_owned(), - }, - } - } -} - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetKeysOptions<'a> { - pub maxresults: Option, - pub method_options: ClientMethodOptions<'a>, -} - -impl KeyVaultClientGetKeysOptions<'_> { - pub fn into_owned(self) -> KeyVaultClientGetKeysOptions<'static> { - KeyVaultClientGetKeysOptions { - maxresults: self.maxresults, - method_options: ClientMethodOptions { - context: self.method_options.context.into_owned(), - }, - } - } -} - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientGetRandomBytesOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientImportKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientPurgeDeletedKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientRecoverDeletedKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientReleaseOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientRestoreKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientRotateKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientSignOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientUnwrapKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientUpdateKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientUpdateKeyRotationPolicyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientVerifyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - -#[derive(Clone, Default, SafeDebug)] -pub struct KeyVaultClientWrapKeyOptions<'a> { - pub method_options: ClientMethodOptions<'a>, -} - - From 8407ad2c72701a5167f0c71d89fd0541c12499b6 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 16:59:47 -0800 Subject: [PATCH 11/13] Cargo fmt all files --- .../src/generated/clients/key_client.rs | 582 +++++++++++------- .../src/generated/clients/mod.rs | 2 +- .../src/generated/enums.rs | 20 +- .../src/generated/models.rs | 532 ++++++++++------ .../src/generated/models_serde.rs | 9 +- .../azure_security_keyvault_keys/src/lib.rs | 33 +- 6 files changed, 723 insertions(+), 455 deletions(-) diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs index 4f0050bd09..264ad08a53 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs @@ -3,17 +3,22 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use azure_core::{ - BearerTokenCredentialPolicy, ClientMethodOptions, ClientOptions, Context, Method, Pager, Pipeline, Policy, Request, RequestContent, Response, Result, Url, +use crate::models::{ + BackupKeyResult, DeletedKeyBundle, DeletedKeyListResult, GetRandomBytesRequest, KeyBundle, + KeyCreateParameters, KeyImportParameters, KeyListResult, KeyOperationResult, + KeyOperationsParameters, KeyReleaseParameters, KeyReleaseResult, KeyRestoreParameters, + KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, + KeyVerifyResult, RandomBytes, }; use azure_core::credentials::TokenCredential; -use crate::models::{ - BackupKeyResult, DeletedKeyBundle, DeletedKeyListResult, GetRandomBytesRequest, KeyBundle, KeyCreateParameters, KeyImportParameters, KeyListResult, KeyOperationResult, KeyOperationsParameters, KeyReleaseParameters, KeyReleaseResult, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, KeyVerifyResult, RandomBytes, +use azure_core::{ + BearerTokenCredentialPolicy, ClientMethodOptions, ClientOptions, Context, Method, Pager, + Pipeline, Policy, Request, RequestContent, Response, Result, Url, }; use std::sync::Arc; -use typespec_client_core::json; use typespec_client_core::fmt::SafeDebug; use typespec_client_core::http::PagerResult; +use typespec_client_core::json; pub struct KeyClient { api_version: String, @@ -28,11 +33,18 @@ pub struct KeyClientOptions { } impl KeyClient { - pub fn new(endpoint: &str, credential: Arc, options: Option) -> Result { - let options = options.unwrap_or_default(); + pub fn new( + endpoint: &str, + credential: Arc, + options: Option, + ) -> Result { + let options = options.unwrap_or_default(); let mut endpoint = Url::parse(endpoint)?; endpoint.set_query(None); - let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new(credential, vec!["https://vault.azure.net/.default"])); + let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new( + credential, + vec!["https://vault.azure.net/.default"], + )); Ok(Self { endpoint, api_version: options.api_version, @@ -52,59 +64,74 @@ impl KeyClient { } /// Requests that a backup of the specified key be downloaded to the client. -/// -/// The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return -/// key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected -/// to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a -/// key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP -/// operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot -/// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical -/// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored -/// in an EU geographical area. This operation requires the key/backup permission. - pub async fn backup_key(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return + /// key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected + /// to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a + /// key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP + /// operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot + /// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical + /// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored + /// in an EU geographical area. This operation requires the key/backup permission. + pub async fn backup_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/backup"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Creates a new key, stores it, then returns key parameters and attributes to the client. -/// -/// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure -/// Key Vault creates a new version of the key. It requires the keys/create permission. - pub async fn create_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure + /// Key Vault creates a new version of the key. It requires the keys/create permission. + pub async fn create_key( + &self, + key_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/create"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Decrypts a single block of encrypted data. -/// -/// The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. -/// This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this -/// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric -/// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt -/// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the -/// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode -/// for more information. - pub async fn decrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. + /// This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this + /// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric + /// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt + /// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the + /// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode + /// for more information. + pub async fn decrypt( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -112,43 +139,53 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Deletes a key of any type from storage in Azure Key Vault. -/// -/// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic -/// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. -/// This operation requires the keys/delete permission. - pub async fn delete_key(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic + /// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. + /// This operation requires the keys/delete permission. + pub async fn delete_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Delete); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. -/// -/// The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. -/// Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key -/// and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in -/// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation -/// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the -/// public key material. This operation requires the keys/encrypt permission. - pub async fn encrypt(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. + /// Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key + /// and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in + /// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation + /// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the + /// public key material. This operation requires the keys/encrypt permission. + pub async fn encrypt( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -156,60 +193,75 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Gets the public part of a deleted key. -/// -/// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any -/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. - pub async fn get_deleted_key(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any + /// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. + pub async fn get_deleted_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("deletedkeys/{key-name}"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Lists the deleted keys in the specified vault. -/// -/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. -/// This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled -/// for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete -/// enabled vault. This operation requires the keys/list permission. - pub fn get_deleted_keys(&self, options: Option>) -> Result> { + /// + /// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. + /// This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled + /// for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + /// enabled vault. This operation requires the keys/list permission. + pub fn get_deleted_keys( + &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 = first_url.join("deletedkeys")?; - first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + first_url + .query_pairs_mut() + .append_pair("api-version", &self.api_version); if let Some(maxresults) = options.maxresults { - first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + first_url + .query_pairs_mut() + .append_pair("maxresults", &maxresults.to_string()); } let api_version = self.api_version.clone(); Ok(Pager::from_callback(move |next_link: Option| { let url = match next_link { Some(next_link) => { - let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let qp = next_link + .query_pairs() + .filter(|(name, _)| name.ne("api-version")); let mut next_link = next_link.clone(); - next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); next_link - }, - None => { - first_url.clone() - }, + .query_pairs_mut() + .clear() + .extend_pairs(qp) + .append_pair("api-version", &api_version); + next_link + } + None => first_url.clone(), }; let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/json"); @@ -226,19 +278,22 @@ impl KeyClient { response: rsp, continuation: next_link.parse()?, }, - None => PagerResult::Complete { - response: rsp, - }, + None => PagerResult::Complete { response: rsp }, }) } })) } /// Gets the public part of a stored key. -/// -/// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released -/// in the response. This operation requires the keys/get permission. - pub async fn get_key(&self, key_name: &str, key_version: &str, options: Option>) -> Result> { + /// + /// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released + /// in the response. This operation requires the keys/get permission. + pub async fn get_key( + &self, + key_name: &str, + key_version: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -246,57 +301,73 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Lists the policy for a key. -/// -/// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation -/// requires the keys/get permission. - pub async fn get_key_rotation_policy(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation + /// requires the keys/get permission. + pub async fn get_key_rotation_policy( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/rotationpolicy"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Retrieves a list of individual key versions with the same key name. -/// -/// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. - pub fn get_key_versions(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. + pub fn get_key_versions( + &self, + key_name: &str, + 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("keys/{key-name}/versions"); path = path.replace("{key-name}", key_name); first_url = first_url.join(&path)?; - first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + first_url + .query_pairs_mut() + .append_pair("api-version", &self.api_version); if let Some(maxresults) = options.maxresults { - first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + first_url + .query_pairs_mut() + .append_pair("maxresults", &maxresults.to_string()); } let api_version = self.api_version.clone(); Ok(Pager::from_callback(move |next_link: Option| { let url = match next_link { Some(next_link) => { - let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let qp = next_link + .query_pairs() + .filter(|(name, _)| name.ne("api-version")); let mut next_link = next_link.clone(); - next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); next_link - }, - None => { - first_url.clone() - }, + .query_pairs_mut() + .clear() + .extend_pairs(qp) + .append_pair("api-version", &api_version); + next_link + } + None => first_url.clone(), }; let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/json"); @@ -313,40 +384,49 @@ impl KeyClient { response: rsp, continuation: next_link.parse()?, }, - None => PagerResult::Complete { - response: rsp, - }, + None => PagerResult::Complete { response: rsp }, }) } })) } /// List keys in the specified vault. -/// -/// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. -/// The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided -/// in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. - pub fn get_keys(&self, options: Option>) -> Result> { + /// + /// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. + /// The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided + /// in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. + pub fn get_keys( + &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 = first_url.join("keys")?; - first_url.query_pairs_mut().append_pair("api-version", &self.api_version); + first_url + .query_pairs_mut() + .append_pair("api-version", &self.api_version); if let Some(maxresults) = options.maxresults { - first_url.query_pairs_mut().append_pair("maxresults", &maxresults.to_string()); + first_url + .query_pairs_mut() + .append_pair("maxresults", &maxresults.to_string()); } let api_version = self.api_version.clone(); Ok(Pager::from_callback(move |next_link: Option| { let url = match next_link { Some(next_link) => { - let qp = next_link.query_pairs().filter(|(name, _)| name.ne("api-version")); + let qp = next_link + .query_pairs() + .filter(|(name, _)| name.ne("api-version")); let mut next_link = next_link.clone(); - next_link.query_pairs_mut().clear().extend_pairs(qp).append_pair("api-version", &api_version); next_link - }, - None => { - first_url.clone() - }, + .query_pairs_mut() + .clear() + .extend_pairs(qp) + .append_pair("api-version", &api_version); + next_link + } + None => first_url.clone(), }; let mut request = Request::new(url, Method::Get); request.insert_header("accept", "application/json"); @@ -363,93 +443,114 @@ impl KeyClient { response: rsp, continuation: next_link.parse()?, }, - None => PagerResult::Complete { - response: rsp, - }, + None => PagerResult::Complete { response: rsp }, }) } })) } /// Get the requested number of bytes containing random values. -/// -/// Get the requested number of bytes containing random values from a managed HSM. - pub async fn get_random_bytes(&self, parameters: RequestContent, options: Option>) -> Result> { + /// + /// Get the requested number of bytes containing random values from a managed HSM. + pub async fn get_random_bytes( + &self, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); url = url.join("rng")?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Imports an externally created key, stores it, and returns key parameters and attributes to the client. -/// -/// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, -/// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. - pub async fn import_key(&self, key_name: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, + /// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. + pub async fn import_key( + &self, + key_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); 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); self.pipeline.send(&ctx, &mut request).await - } /// Permanently deletes the specified key. -/// -/// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any -/// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. - pub async fn purge_deleted_key(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any + /// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. + pub async fn purge_deleted_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("deletedkeys/{key-name}"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Delete); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Recovers the deleted key to its latest version. -/// -/// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted -/// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this -/// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. - pub async fn recover_deleted_key(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted + /// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this + /// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. + pub async fn recover_deleted_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("deletedkeys/{key-name}/recover"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Releases a key. -/// -/// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires -/// the keys/release permission. - pub async fn release(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires + /// the keys/release permission. + pub async fn release( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -457,61 +558,75 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Restores a backed up key to a vault. -/// -/// Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access -/// control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key -/// cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the -/// key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained -/// during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore -/// all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key -/// Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission -/// in the target Key Vault. This operation requires the keys/restore permission. - pub async fn restore_key(&self, parameters: RequestContent, options: Option>) -> Result> { + /// + /// Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access + /// control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key + /// cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the + /// key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained + /// during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore + /// all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key + /// Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + /// in the target Key Vault. This operation requires the keys/restore permission. + pub async fn restore_key( + &self, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); url = url.join("keys/restore")?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. -/// -/// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. - pub async fn rotate_key(&self, key_name: &str, options: Option>) -> Result> { + /// + /// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. + pub async fn rotate_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/rotate"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); self.pipeline.send(&ctx, &mut request).await - } /// Creates a signature from a digest using the specified key. -/// -/// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses -/// the private portion of the key. This operation requires the keys/sign permission. - pub async fn sign(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses + /// the private portion of the key. This operation requires the keys/sign permission. + pub async fn sign( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -519,21 +634,27 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Unwraps a symmetric key using the specified key that was initially used for wrapping that key. -/// -/// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the -/// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault -/// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. - pub async fn unwrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the + /// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault + /// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. + pub async fn unwrap_key( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -541,21 +662,27 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// The update key operation changes specified attributes of a stored key and can be applied to any key type and key version -/// stored in Azure Key Vault. -/// -/// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a -/// key itself cannot be changed. This operation requires the keys/update permission. - pub async fn update_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// stored in Azure Key Vault. + /// + /// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a + /// key itself cannot be changed. This operation requires the keys/update permission. + pub async fn update_key( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -563,41 +690,52 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); 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); self.pipeline.send(&ctx, &mut request).await - } /// Updates the rotation policy for a key. -/// -/// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. - pub async fn update_key_rotation_policy(&self, key_name: &str, key_rotation_policy: RequestContent, options: Option>) -> Result> { + /// + /// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. + pub async fn update_key_rotation_policy( + &self, + key_name: &str, + key_rotation_policy: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); let mut path = String::from("keys/{key-name}/rotationpolicy"); path = path.replace("{key-name}", key_name); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Put); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(key_rotation_policy); self.pipeline.send(&ctx, &mut request).await - } /// Verifies a signature using a specified key. -/// -/// The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric -/// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this -/// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. -/// This operation requires the keys/verify permission. - pub async fn verify(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric + /// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this + /// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. + /// This operation requires the keys/verify permission. + pub async fn verify( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -605,23 +743,29 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } /// Wraps a symmetric key using a specified key. -/// -/// The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in -/// an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection -/// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric -/// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation -/// requires the keys/wrapKey permission. - pub async fn wrap_key(&self, key_name: &str, key_version: &str, parameters: RequestContent, options: Option>) -> Result> { + /// + /// The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in + /// an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection + /// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric + /// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation + /// requires the keys/wrapKey permission. + pub async fn wrap_key( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { let options = options.unwrap_or_default(); let ctx = Context::with_context(&options.method_options.context); let mut url = self.endpoint.clone(); @@ -629,13 +773,13 @@ impl KeyClient { path = path.replace("{key-name}", key_name); path = path.replace("{key-version}", key_version); url = url.join(&path)?; - url.query_pairs_mut().append_pair("api-version", &self.api_version); + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); let mut request = Request::new(url, Method::Post); request.insert_header("accept", "application/json"); request.insert_header("content-type", "application/json"); request.set_body(parameters); self.pipeline.send(&ctx, &mut request).await - } } @@ -653,37 +797,31 @@ pub struct KeyClientBackupKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientCreateKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientDecryptOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientDeleteKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientEncryptOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientGetDeletedKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientGetDeletedKeysOptions<'a> { pub maxresults: Option, @@ -706,13 +844,11 @@ pub struct KeyClientGetKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientGetKeyRotationPolicyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientGetKeyVersionsOptions<'a> { pub maxresults: Option, @@ -752,76 +888,62 @@ pub struct KeyClientGetRandomBytesOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientImportKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientPurgeDeletedKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientRecoverDeletedKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientReleaseOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientRestoreKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientRotateKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientSignOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientUnwrapKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientUpdateKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientUpdateKeyRotationPolicyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientVerifyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - #[derive(Clone, Default, SafeDebug)] pub struct KeyClientWrapKeyOptions<'a> { pub method_options: ClientMethodOptions<'a>, } - - diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs index 50df89f4a5..103b4f7fca 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs @@ -4,4 +4,4 @@ // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. mod key_client; -pub use key_client::*; \ No newline at end of file +pub use key_client::*; diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs index 59793758eb..276f0fbfc2 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs @@ -3,18 +3,25 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use typespec_client_core::{ - create_enum, create_extensible_enum, -}; +use typespec_client_core::{create_enum, create_extensible_enum}; create_extensible_enum!( DeletionRecoveryLevel, (CustomizedRecoverable, "CustomizedRecoverable"), - (CustomizedRecoverableProtectedSubscription, "CustomizedRecoverable+ProtectedSubscription"), - (CustomizedRecoverablePurgeable, "CustomizedRecoverable+Purgeable"), + ( + CustomizedRecoverableProtectedSubscription, + "CustomizedRecoverable+ProtectedSubscription" + ), + ( + CustomizedRecoverablePurgeable, + "CustomizedRecoverable+Purgeable" + ), (Purgeable, "Purgeable"), (Recoverable, "Recoverable"), - (RecoverableProtectedSubscription, "Recoverable+ProtectedSubscription"), + ( + RecoverableProtectedSubscription, + "Recoverable+ProtectedSubscription" + ), (RecoverablePurgeable, "Recoverable+Purgeable") ); @@ -96,4 +103,3 @@ create_enum!( (Notify, "Notify"), (Rotate, "Rotate") ); - diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs index ddb3d02ab1..5ce3f105db 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs @@ -3,13 +3,12 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use azure_core::base64; use crate::models::{ - DeletionRecoveryLevel, JsonWebKeyCurveName, JsonWebKeyEncryptionAlgorithm, JsonWebKeyOperation, JsonWebKeySignatureAlgorithm, JsonWebKeyType, KeyEncryptionAlgorithm, KeyRotationPolicyAction, -}; -use serde::{ - Deserialize, Serialize, + DeletionRecoveryLevel, JsonWebKeyCurveName, JsonWebKeyEncryptionAlgorithm, JsonWebKeyOperation, + JsonWebKeySignatureAlgorithm, JsonWebKeyType, KeyEncryptionAlgorithm, KeyRotationPolicyAction, }; +use azure_core::base64; +use serde::{Deserialize, Serialize}; use std::collections::HashMap; use time::OffsetDateTime; use typespec_client_core::fmt::SafeDebug; @@ -18,590 +17,749 @@ use typespec_client_core::fmt::SafeDebug; #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct BackupKeyResult { -/// The backup blob containing the backed up key. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The backup blob containing the backed up key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub value: Option>, - } /// A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct DeletedKeyBundle { -/// The key management attributes. + /// The key management attributes. #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option, -/// The time when the key was deleted, in UTC - #[serde(default, rename = "deletedDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// The time when the key was deleted, in UTC + #[serde( + default, + rename = "deletedDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub deleted_date: Option, -/// The Json web key. + /// The Json web key. #[serde(skip_serializing_if = "Option::is_none")] pub key: Option, -/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. #[serde(skip_serializing_if = "Option::is_none")] pub managed: Option, -/// The url of the recovery object, used to identify and recover the deleted key. + /// The url of the recovery object, used to identify and recover the deleted key. #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")] pub recovery_id: Option, -/// The policy rules under which the key can be exported. + /// The policy rules under which the key can be exported. #[serde(skip_serializing_if = "Option::is_none")] pub release_policy: Option, -/// The time when the key is scheduled to be purged, in UTC - #[serde(default, rename = "scheduledPurgeDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// The time when the key is scheduled to be purged, in UTC + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub scheduled_purge_date: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// The deleted key item containing the deleted key metadata and information about deletion. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct DeletedKeyItem { -/// The key management attributes. + /// The key management attributes. #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option, -/// The time when the key was deleted, in UTC - #[serde(default, rename = "deletedDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// The time when the key was deleted, in UTC + #[serde( + default, + rename = "deletedDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub deleted_date: Option, -/// Key identifier. + /// Key identifier. #[serde(skip_serializing_if = "Option::is_none")] pub kid: Option, -/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. #[serde(skip_serializing_if = "Option::is_none")] pub managed: Option, -/// The url of the recovery object, used to identify and recover the deleted key. + /// The url of the recovery object, used to identify and recover the deleted key. #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")] pub recovery_id: Option, -/// The time when the key is scheduled to be purged, in UTC - #[serde(default, rename = "scheduledPurgeDate", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// The time when the key is scheduled to be purged, in UTC + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub scheduled_purge_date: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// A list of keys that have been deleted in this vault. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct DeletedKeyListResult { -/// The URL to get the next set of deleted keys. + /// The URL to get the next set of deleted keys. #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] pub next_link: Option, -/// A response message containing a list of deleted keys in the key vault along with a link to the next page of deleted keys. + /// A response message containing a list of deleted keys in the key vault along with a link to the next page of deleted keys. #[serde(skip_serializing_if = "Option::is_none")] pub value: Option>, - } /// The get random bytes request object. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct GetRandomBytesRequest { -/// The requested number of random bytes. + /// The requested number of random bytes. #[serde(skip_serializing_if = "Option::is_none")] pub count: Option, - } /// As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct JsonWebKey { -/// Elliptic curve name. For valid values, see JsonWebKeyCurveName. + /// Elliptic curve name. For valid values, see JsonWebKeyCurveName. #[serde(skip_serializing_if = "Option::is_none")] pub crv: Option, -/// RSA private exponent, or the D component of an EC private key. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA private exponent, or the D component of an EC private key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub d: Option>, -/// RSA private key parameter. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA private key parameter. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub dp: Option>, -/// RSA private key parameter. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA private key parameter. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub dq: Option>, -/// RSA public exponent. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA public exponent. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub e: Option>, -/// Symmetric key. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Symmetric key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub k: Option>, -/// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + /// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. #[serde(skip_serializing_if = "Option::is_none")] pub key_ops: Option>, -/// Key identifier. + /// Key identifier. #[serde(skip_serializing_if = "Option::is_none")] pub kid: Option, -/// JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + /// JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. #[serde(skip_serializing_if = "Option::is_none")] pub kty: Option, -/// RSA modulus. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA modulus. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub n: Option>, -/// RSA secret prime. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA secret prime. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub p: Option>, -/// RSA secret prime, with p < q. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA secret prime, with p < q. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub q: Option>, -/// RSA private key parameter. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// RSA private key parameter. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub qi: Option>, -/// Protected Key, used with 'Bring Your Own Key'. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "key_hsm", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Protected Key, used with 'Bring Your Own Key'. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "key_hsm", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub t: Option>, -/// X component of an EC public key. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// X component of an EC public key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub x: Option>, -/// Y component of an EC public key. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Y component of an EC public key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub y: Option>, - } /// The attributes of a key managed by the key vault service. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyAttributes { -/// Creation time in UTC. - #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// Creation time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub created: Option, -/// Determines whether the object is enabled. + /// Determines whether the object is enabled. #[serde(skip_serializing_if = "Option::is_none")] pub enabled: Option, -/// Expiry date in UTC. - #[serde(default, rename = "exp", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// Expiry date in UTC. + #[serde( + default, + rename = "exp", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub expires: Option, -/// Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable -/// key. + /// Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable + /// key. #[serde(skip_serializing_if = "Option::is_none")] pub exportable: Option, -/// The underlying HSM Platform. + /// The underlying HSM Platform. #[serde(rename = "hsmPlatform", skip_serializing_if = "Option::is_none")] pub hsm_platform: Option, -/// Not before date in UTC. - #[serde(default, rename = "nbf", skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// Not before date in UTC. + #[serde( + default, + rename = "nbf", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub not_before: Option, -/// softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. + /// softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. #[serde(rename = "recoverableDays", skip_serializing_if = "Option::is_none")] pub recoverable_days: Option, -/// Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the -/// key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention -/// interval. + /// Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the + /// key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention + /// interval. #[serde(rename = "recoveryLevel", skip_serializing_if = "Option::is_none")] pub recovery_level: Option, -/// Last updated time in UTC. - #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// Last updated time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub updated: Option, - } /// A KeyBundle consisting of a WebKey plus its attributes. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyBundle { -/// The key management attributes. + /// The key management attributes. #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option, -/// The Json web key. + /// The Json web key. #[serde(skip_serializing_if = "Option::is_none")] pub key: Option, -/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. #[serde(skip_serializing_if = "Option::is_none")] pub managed: Option, -/// The policy rules under which the key can be exported. + /// The policy rules under which the key can be exported. #[serde(skip_serializing_if = "Option::is_none")] pub release_policy: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// The key create parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyCreateParameters { -/// Elliptic curve name. For valid values, see JsonWebKeyCurveName. + /// Elliptic curve name. For valid values, see JsonWebKeyCurveName. #[serde(rename = "crv", skip_serializing_if = "Option::is_none")] pub curve: Option, -/// The attributes of a key managed by the key vault service. + /// The attributes of a key managed by the key vault service. #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] pub key_attributes: Option, -/// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + /// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. #[serde(skip_serializing_if = "Option::is_none")] pub key_ops: Option>, -/// The key size in bits. For example: 2048, 3072, or 4096 for RSA. + /// The key size in bits. For example: 2048, 3072, or 4096 for RSA. #[serde(skip_serializing_if = "Option::is_none")] pub key_size: Option, -/// The type of key to create. For valid values, see JsonWebKeyType. + /// The type of key to create. For valid values, see JsonWebKeyType. #[serde(skip_serializing_if = "Option::is_none")] pub kty: Option, -/// The public exponent for a RSA key. + /// The public exponent for a RSA key. #[serde(skip_serializing_if = "Option::is_none")] pub public_exponent: Option, -/// The policy rules under which the key can be exported. + /// The policy rules under which the key can be exported. #[serde(skip_serializing_if = "Option::is_none")] pub release_policy: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// The key import parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyImportParameters { -/// Whether to import as a hardware key (HSM) or software key. + /// Whether to import as a hardware key (HSM) or software key. #[serde(rename = "Hsm", skip_serializing_if = "Option::is_none")] pub hsm: Option, -/// The Json web key + /// The Json web key #[serde(skip_serializing_if = "Option::is_none")] pub key: Option, -/// The key management attributes. + /// The key management attributes. #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] pub key_attributes: Option, -/// The policy rules under which the key can be exported. + /// The policy rules under which the key can be exported. #[serde(skip_serializing_if = "Option::is_none")] pub release_policy: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// The key item containing key metadata. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyItem { -/// The key management attributes. + /// The key management attributes. #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option, -/// Key identifier. + /// Key identifier. #[serde(skip_serializing_if = "Option::is_none")] pub kid: Option, -/// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. #[serde(skip_serializing_if = "Option::is_none")] pub managed: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// The key list result. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyListResult { -/// The URL to get the next set of keys. + /// The URL to get the next set of keys. #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] pub next_link: Option, -/// A response message containing a list of keys in the key vault along with a link to the next page of keys. + /// A response message containing a list of keys in the key vault along with a link to the next page of keys. #[serde(skip_serializing_if = "Option::is_none")] pub value: Option>, - } /// The key operation result. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyOperationResult { -/// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "aad", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "aad", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub additional_authenticated_data: Option>, -/// The tag to authenticate when performing decryption with an authenticated algorithm. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "tag", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The tag to authenticate when performing decryption with an authenticated algorithm. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "tag", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub authentication_tag: Option>, -/// Cryptographically random, non-repeating initialization vector for symmetric algorithms. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Cryptographically random, non-repeating initialization vector for symmetric algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub iv: Option>, -/// Key identifier + /// Key identifier #[serde(skip_serializing_if = "Option::is_none")] pub kid: Option, -/// The result of the operation. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The result of the operation. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "value", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub result: Option>, - } /// The key operations parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyOperationsParameters { -/// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub aad: Option>, -/// algorithm identifier + /// algorithm identifier #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] pub algorithm: Option, -/// Cryptographically random, non-repeating initialization vector for symmetric algorithms. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Cryptographically random, non-repeating initialization vector for symmetric algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub iv: Option>, -/// The tag to authenticate when performing decryption with an authenticated algorithm. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The tag to authenticate when performing decryption with an authenticated algorithm. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub tag: Option>, -/// The value to operate on. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The value to operate on. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub value: Option>, - } /// The release key parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyReleaseParameters { -/// The encryption algorithm to use to protected the exported key material + /// The encryption algorithm to use to protected the exported key material #[serde(skip_serializing_if = "Option::is_none")] pub enc: Option, -/// A client provided nonce for freshness. + /// A client provided nonce for freshness. #[serde(skip_serializing_if = "Option::is_none")] pub nonce: Option, -/// The attestation assertion for the target of the key release. + /// The attestation assertion for the target of the key release. #[serde(rename = "target", skip_serializing_if = "Option::is_none")] pub target_attestation_token: Option, - } /// The policy rules under which the key can be exported. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyReleasePolicy { -/// Content type and version of key release policy + /// 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. Blob must be base64 URL encoded. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "data", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// Blob encoding the policy rules under which the key can be released. Blob must be base64 URL encoded. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "data", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub encoded_policy: Option>, -/// Defines the mutability state of the policy. Once marked immutable, this flag cannot be reset and the policy cannot be -/// changed under any circumstances. + /// Defines the mutability state of the policy. Once marked immutable, this flag cannot be reset and the policy cannot be + /// changed under any circumstances. #[serde(skip_serializing_if = "Option::is_none")] pub immutable: Option, - } /// The release result, containing the released key. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyReleaseResult { -/// A signed object containing the released key. + /// A signed object containing the released key. #[serde(skip_serializing_if = "Option::is_none")] pub value: Option, - } /// The key restore parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyRestoreParameters { -/// The backup blob associated with a key bundle. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The backup blob associated with a key bundle. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "value", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub key_bundle_backup: Option>, - } /// Management policy for a key. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyRotationPolicy { -/// The key rotation policy attributes. + /// The key rotation policy attributes. #[serde(skip_serializing_if = "Option::is_none")] pub attributes: Option, -/// The key policy id. + /// The key policy id. #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, -/// Actions that will be performed by Key Vault over the lifetime of a key. For preview, lifetimeActions can only have two -/// items at maximum: one for rotate, one for notify. Notification time would be default to 30 days before expiry and it is -/// not configurable. + /// Actions that will be performed by Key Vault over the lifetime of a key. For preview, lifetimeActions can only have two + /// items at maximum: one for rotate, one for notify. Notification time would be default to 30 days before expiry and it is + /// not configurable. #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] pub lifetime_actions: Option>, - } /// The key rotation policy attributes. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyRotationPolicyAttributes { -/// The key rotation policy created time in UTC. - #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// The key rotation policy created time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub created: Option, -/// The expiryTime will be applied on the new key version. It should be at least 28 days. It will be in ISO 8601 Format. Examples: -/// 90 days: P90D, 3 months: P3M, 48 hours: PT48H, 1 year and 10 days: P1Y10D + /// The expiryTime will be applied on the new key version. It should be at least 28 days. It will be in ISO 8601 Format. Examples: + /// 90 days: P90D, 3 months: P3M, 48 hours: PT48H, 1 year and 10 days: P1Y10D #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] pub expiry_time: Option, -/// The key rotation policy's last updated time in UTC. - #[serde(default, skip_serializing_if = "Option::is_none", with = "azure_core::date::unix_time::option")] + /// The key rotation policy's last updated time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] pub updated: Option, - } /// The key operations parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeySignParameters { -/// The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + /// The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] pub algorithm: Option, -/// The value to operate on. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The value to operate on. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub value: Option>, - } /// The key update parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyUpdateParameters { -/// The attributes of a key managed by the key vault service. + /// The attributes of a key managed by the key vault service. #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] pub key_attributes: Option, -/// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + /// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. #[serde(skip_serializing_if = "Option::is_none")] pub key_ops: Option>, -/// The policy rules under which the key can be exported. + /// The policy rules under which the key can be exported. #[serde(skip_serializing_if = "Option::is_none")] pub release_policy: Option, -/// Application specific metadata in the form of key-value pairs. + /// Application specific metadata in the form of key-value pairs. #[serde(skip_serializing_if = "Option::is_none")] pub tags: Option>, - } /// The key verify parameters. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct KeyVerifyParameters { -/// The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + /// The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] pub algorithm: Option, -/// The digest used for signing. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The digest used for signing. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub digest: Option>, -/// The signature to be verified. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", rename = "value", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The signature to be verified. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "value", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub signature: Option>, - } /// The key verify result. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct KeyVerifyResult { -/// True if the signature is verified, otherwise false. + /// True if the signature is verified, otherwise false. #[serde(skip_serializing_if = "Option::is_none")] pub value: Option, - } /// Action and its trigger that will be performed by Key Vault over the lifetime of a key. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct LifetimeActions { -/// The action that will be executed. + /// The action that will be executed. #[serde(skip_serializing_if = "Option::is_none")] pub action: Option, -/// The condition that will execute the action. + /// The condition that will execute the action. #[serde(skip_serializing_if = "Option::is_none")] pub trigger: Option, - } /// A condition to be satisfied for an action to be executed. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct LifetimeActionsTrigger { -/// Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: -/// 90 days : "P90D" + /// Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: + /// 90 days : "P90D" #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] pub time_after_create: Option, -/// Time before expiry to attempt to rotate or notify. It will be in ISO 8601 duration format. Example: 90 days : "P90D" + /// Time before expiry to attempt to rotate or notify. It will be in ISO 8601 duration format. Example: 90 days : "P90D" #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] pub time_before_expiry: Option, - } /// The action that will be executed. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct LifetimeActionsType { -/// The type of the action. The value should be compared case-insensitively. + /// The type of the action. The value should be compared case-insensitively. #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub type_prop: Option, - } /// The get random bytes response object containing the bytes. #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] #[non_exhaustive] pub struct RandomBytes { -/// The bytes encoded as a base64url string. - #[serde(default, deserialize_with = "base64::deserialize_url_safe", serialize_with = "base64::serialize_url_safe", skip_serializing_if = "Option::is_none")] + /// The bytes encoded as a base64url string. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] pub value: Option>, - } - diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs index af33ef563d..a97e1c019d 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs @@ -3,12 +3,12 @@ // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. -use azure_core::{ - RequestContent, Result, -}; use crate::models::{ - GetRandomBytesRequest, KeyCreateParameters, KeyImportParameters, KeyOperationsParameters, KeyReleaseParameters, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, + GetRandomBytesRequest, KeyCreateParameters, KeyImportParameters, KeyOperationsParameters, + KeyReleaseParameters, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, + KeyUpdateParameters, KeyVerifyParameters, }; +use azure_core::{RequestContent, Result}; use typespec_client_core::json::to_json; impl TryFrom for RequestContent { @@ -80,4 +80,3 @@ impl TryFrom for RequestContent { RequestContent::try_from(to_json(&value)?) } } - diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs index 3e934434a3..c878598bc9 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs @@ -15,30 +15,13 @@ pub mod models { } pub use crate::generated::clients::{ - KeyClient, KeyClientOptions, - KeyClientBackupKeyOptions, - KeyClientCreateKeyOptions, - KeyClientDecryptOptions, - KeyClientDeleteKeyOptions, - KeyClientEncryptOptions, - KeyClientGetDeletedKeyOptions, - KeyClientGetDeletedKeysOptions, - KeyClientGetKeyOptions, - KeyClientGetKeyRotationPolicyOptions, - KeyClientGetKeyVersionsOptions, - KeyClientGetKeysOptions, - KeyClientGetRandomBytesOptions, - KeyClientImportKeyOptions, - KeyClientPurgeDeletedKeyOptions, - KeyClientRecoverDeletedKeyOptions, - KeyClientReleaseOptions, - KeyClientRestoreKeyOptions, - KeyClientRotateKeyOptions, - KeyClientSignOptions, - KeyClientUnwrapKeyOptions, - KeyClientUpdateKeyOptions, - KeyClientUpdateKeyRotationPolicyOptions, - KeyClientVerifyOptions, + KeyClient, KeyClientBackupKeyOptions, KeyClientCreateKeyOptions, KeyClientDecryptOptions, + KeyClientDeleteKeyOptions, KeyClientEncryptOptions, KeyClientGetDeletedKeyOptions, + KeyClientGetDeletedKeysOptions, KeyClientGetKeyOptions, KeyClientGetKeyRotationPolicyOptions, + KeyClientGetKeyVersionsOptions, KeyClientGetKeysOptions, KeyClientGetRandomBytesOptions, + KeyClientImportKeyOptions, KeyClientOptions, KeyClientPurgeDeletedKeyOptions, + KeyClientRecoverDeletedKeyOptions, KeyClientReleaseOptions, KeyClientRestoreKeyOptions, + KeyClientRotateKeyOptions, KeyClientSignOptions, KeyClientUnwrapKeyOptions, + KeyClientUpdateKeyOptions, KeyClientUpdateKeyRotationPolicyOptions, KeyClientVerifyOptions, KeyClientWrapKeyOptions, }; - From 96828e34af76c184c5364c1c6840ab1854ff655a Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 20:07:08 -0800 Subject: [PATCH 12/13] Fix html doc links --- .../src/generated/clients/key_client.rs | 2 +- .../azure_security_keyvault_keys/src/generated/models.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs index 264ad08a53..6d3135922e 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs @@ -123,7 +123,7 @@ impl KeyClient { /// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric /// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt /// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the - /// ciphertext using an HMAC, for example. See https://docs.microsoft.com/dotnet/standard/security/vulnerabilities-cbc-mode + /// ciphertext using an HMAC, for example. See /// for more information. pub async fn decrypt( &self, diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs index 5ce3f105db..17fa85c33d 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs @@ -198,7 +198,7 @@ pub struct JsonWebKey { #[serde(skip_serializing_if = "Option::is_none")] pub kid: Option, - /// JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + /// JsonWebKey Key Type (kty), as defined in . #[serde(skip_serializing_if = "Option::is_none")] pub kty: Option, From 7eec93868b1e2c7c023a28fd7f2e95d55762edd3 Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Mon, 3 Feb 2025 20:14:55 -0800 Subject: [PATCH 13/13] Fix hyperlink --- .../azure_security_keyvault_keys/src/generated/models.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs index 17fa85c33d..e3254f3c21 100644 --- a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs @@ -138,7 +138,7 @@ pub struct GetRandomBytesRequest { pub count: Option, } -/// As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 +/// As of #[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] pub struct JsonWebKey { /// Elliptic curve name. For valid values, see JsonWebKeyCurveName.