use super::{
CreateKeyParameters, DeletedKeyProperties, GetRandomBytesParameters, ImportKeyParameters,
KeyOperationParameters, KeyProperties, KeyRotationPolicy, ListDeletedKeyPropertiesResult,
ListKeyPropertiesResult, ReleaseParameters, RestoreKeyParameters, SignParameters,
UpdateKeyPropertiesParameters, VerifyParameters,
};
use async_trait::async_trait;
use azure_core::{
http::{Page, RequestContent},
json::to_json,
Result,
};
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl Page for ListDeletedKeyPropertiesResult {
type Item = DeletedKeyProperties;
type IntoIter = <Vec<DeletedKeyProperties> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.value.into_iter())
}
}
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl Page for ListKeyPropertiesResult {
type Item = KeyProperties;
type IntoIter = <Vec<KeyProperties> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.value.into_iter())
}
}
impl TryFrom<CreateKeyParameters> for RequestContent<CreateKeyParameters> {
type Error = azure_core::Error;
fn try_from(value: CreateKeyParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<GetRandomBytesParameters> for RequestContent<GetRandomBytesParameters> {
type Error = azure_core::Error;
fn try_from(value: GetRandomBytesParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<ImportKeyParameters> for RequestContent<ImportKeyParameters> {
type Error = azure_core::Error;
fn try_from(value: ImportKeyParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<KeyOperationParameters> for RequestContent<KeyOperationParameters> {
type Error = azure_core::Error;
fn try_from(value: KeyOperationParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<KeyRotationPolicy> for RequestContent<KeyRotationPolicy> {
type Error = azure_core::Error;
fn try_from(value: KeyRotationPolicy) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<ReleaseParameters> for RequestContent<ReleaseParameters> {
type Error = azure_core::Error;
fn try_from(value: ReleaseParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<RestoreKeyParameters> for RequestContent<RestoreKeyParameters> {
type Error = azure_core::Error;
fn try_from(value: RestoreKeyParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<SignParameters> for RequestContent<SignParameters> {
type Error = azure_core::Error;
fn try_from(value: SignParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<UpdateKeyPropertiesParameters> for RequestContent<UpdateKeyPropertiesParameters> {
type Error = azure_core::Error;
fn try_from(value: UpdateKeyPropertiesParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}
impl TryFrom<VerifyParameters> for RequestContent<VerifyParameters> {
type Error = azure_core::Error;
fn try_from(value: VerifyParameters) -> Result<Self> {
RequestContent::try_from(to_json(&value)?)
}
}