use super::*;
pub const APPLICATION_EXECUTIONS_PATH: &str =
"/internal/v1/workspace/computers/{computerId}/application-executions";
pub const APPLICATION_COMMAND_CONTEXTS_PATH: &str =
"/internal/v1/workspace/computers/{computerId}/application-command-contexts";
pub const APPLICATION_EXECUTION_HEADER: &str = "x-workspace-application-execution";
pub const APPLICATION_AGENT_HEADER: &str = "x-workspace-execution-agent";
pub const APPLICATION_CALLER_HEADER: &str = "x-workspace-caller-authorization";
pub const APPLICATION_EXECUTION_MAX_TTL_MS: u64 = 24 * 60 * 60 * 1000;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct CreateApplicationExecutionRequest {
pub app_id: String,
pub space_id: String,
pub agent_id: String,
pub runtime_id: String,
pub ttl_ms: u64,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct ApplicationExecutionResource {
pub id: String,
pub app_id: String,
pub computer_id: String,
pub space_id: String,
pub agent_id: String,
pub runtime_id: String,
pub grant_id: String,
pub grant_version: u64,
pub expires_at_ms: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VerifiedApplicationExecution {
#[serde(default)]
pub runtime_scope: Option<ResourceScope>,
pub resource: ApplicationExecutionResource,
pub scope: ResourceScope,
pub caller_user_id: String,
}
impl VerifiedApplicationExecution {
pub fn principal(&self) -> PrincipalRef {
PrincipalRef::agent(format!("application:{}", self.resource.id))
}
}