use crate::api::keys::responses::{KeyResponse, KeysResponse, SignResponse};
use rustify_derive::Endpoint;
use std::collections::HashMap;
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys",
method = "POST",
response = "KeyResponse",
builder = "true"
)]
#[builder(setter(into))]
pub struct CreateKeyRequest {
#[endpoint(skip)]
pub mount: String,
pub signing_algorithm: String,
pub curve: String,
pub tags: HashMap<String, String>,
pub id: String,
}
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys/{self.id}",
method = "GET",
response = "KeyResponse",
builder = "true"
)]
#[builder(setter(into))]
pub struct ReadKeyRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub id: String,
}
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys",
method = "GET",
response = "KeysResponse",
builder = "true"
)]
#[builder(setter(into))]
pub struct ListKeysRequest {
#[endpoint(skip)]
pub mount: String,
}
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys/{self.id}/destroy",
method = "DELETE",
builder = "true"
)]
#[builder(setter(into))]
pub struct DestroyKeyRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub id: String,
}
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys/import",
method = "POST",
response = "KeyResponse",
builder = "true"
)]
#[builder(setter(into))]
pub struct ImportKeyRequest {
#[endpoint(skip)]
pub mount: String,
pub signing_algorithm: String,
pub curve: String,
pub tags: HashMap<String, String>,
pub private_key: String,
pub id: String,
}
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys/{self.id}",
method = "POST",
response = "KeyResponse",
builder = "true"
)]
#[builder(setter(into))]
pub struct UpdateKeyTagsRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub id: String,
pub tags: HashMap<String, String>,
}
#[derive(Builder, Debug, Endpoint)]
#[endpoint(
path = "{self.mount}/keys/{self.id}/sign",
method = "POST",
response = "SignResponse",
builder = "true"
)]
#[builder(setter(into))]
pub struct SignRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub id: String,
pub data: String,
}