41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
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,
|
|
Executing,
|
|
Denied,
|
|
Expired,
|
|
Completed,
|
|
Failed,
|
|
}
|
|
|
|
#[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 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>,
|
|
}
|