azure_security_keyvault_keys 0.14.0

Rust wrappers around Microsoft Azure REST APIs - Azure Key Vault Keys
Documentation
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.

use super::{
    CreateKeyParameters, DeletedKeyProperties, GetRandomBytesParameters, ImportKeyParameters,
    KeyOperationParameters, KeyProperties, KeyRotationPolicy, ListDeletedKeyPropertiesResult,
    ListKeyPropertiesResult, ReleaseParameters, RestoreKeyParameters, SignParameters,
    UpdateKeyPropertiesParameters, VerifyParameters,
};
use async_trait::async_trait;
use azure_core::{
    http::{pager::Page, RequestContent},
    json::to_json,
    Result,
};

#[async_trait]
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())
    }
}

#[async_trait]
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> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<GetRandomBytesParameters> for RequestContent<GetRandomBytesParameters> {
    type Error = azure_core::Error;
    fn try_from(value: GetRandomBytesParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<ImportKeyParameters> for RequestContent<ImportKeyParameters> {
    type Error = azure_core::Error;
    fn try_from(value: ImportKeyParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<KeyOperationParameters> for RequestContent<KeyOperationParameters> {
    type Error = azure_core::Error;
    fn try_from(value: KeyOperationParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<KeyRotationPolicy> for RequestContent<KeyRotationPolicy> {
    type Error = azure_core::Error;
    fn try_from(value: KeyRotationPolicy) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<ReleaseParameters> for RequestContent<ReleaseParameters> {
    type Error = azure_core::Error;
    fn try_from(value: ReleaseParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<RestoreKeyParameters> for RequestContent<RestoreKeyParameters> {
    type Error = azure_core::Error;
    fn try_from(value: RestoreKeyParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<SignParameters> for RequestContent<SignParameters> {
    type Error = azure_core::Error;
    fn try_from(value: SignParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<UpdateKeyPropertiesParameters> for RequestContent<UpdateKeyPropertiesParameters> {
    type Error = azure_core::Error;
    fn try_from(value: UpdateKeyPropertiesParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}

impl TryFrom<VerifyParameters> for RequestContent<VerifyParameters> {
    type Error = azure_core::Error;
    fn try_from(value: VerifyParameters) -> Result<Self> {
        Ok(to_json(&value)?.into())
    }
}