Add approval request HTTP surface
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
use crate::ids::{AgentId, ApprovalRequestId, OperationId, PlatformApiKeyId, WorkspaceId};
|
||||
use crate::operation::OperationApprovalRiskLevel;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ApprovalRequestStatus {
|
||||
#[default]
|
||||
Pending,
|
||||
Approved,
|
||||
Denied,
|
||||
Expired,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ApprovalRequest {
|
||||
pub id: ApprovalRequestId,
|
||||
pub workspace_id: WorkspaceId,
|
||||
pub agent_id: AgentId,
|
||||
pub operation_id: OperationId,
|
||||
pub operation_version: u32,
|
||||
pub status: ApprovalRequestStatus,
|
||||
pub risk_level: OperationApprovalRiskLevel,
|
||||
pub confirmation_title: String,
|
||||
pub confirmation_body: String,
|
||||
pub request_payload: Value,
|
||||
pub response_payload: Option<Value>,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub created_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub expires_at: OffsetDateTime,
|
||||
#[serde(with = "time::serde::rfc3339::option")]
|
||||
pub decided_at: Option<OffsetDateTime>,
|
||||
pub decided_by_key_id: Option<PlatformApiKeyId>,
|
||||
pub decision_note: Option<String>,
|
||||
}
|
||||
Reference in New Issue
Block a user