mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 20:58:06 +00:00
add Timestamp to multiple models (#796)
Expose the Azure storage table's "Timestamp" for the models where Timestamp should be user-accessible and remove the Timestamp field from models that did not sign up for it. The behavior where Timestamp is only set by Azure Storage is kept.
This commit is contained in:
@ -535,6 +535,7 @@ class JobTaskInfo(BaseModel):
|
||||
|
||||
|
||||
class Job(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
job_id: UUID = Field(default_factory=uuid4)
|
||||
state: JobState = Field(default=JobState.init)
|
||||
config: JobConfig
|
||||
@ -557,6 +558,7 @@ class NodeHeartbeatEntry(BaseModel):
|
||||
|
||||
|
||||
class Node(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
pool_name: PoolName
|
||||
machine_id: UUID
|
||||
state: NodeState = Field(default=NodeState.init)
|
||||
@ -620,6 +622,7 @@ class AutoScaleConfig(BaseModel):
|
||||
|
||||
|
||||
class Pool(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
name: PoolName
|
||||
pool_id: UUID = Field(default_factory=uuid4)
|
||||
os: OS
|
||||
@ -647,6 +650,7 @@ class ScalesetNodeState(BaseModel):
|
||||
|
||||
|
||||
class Scaleset(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
pool_name: PoolName
|
||||
scaleset_id: UUID = Field(default_factory=uuid4)
|
||||
state: ScalesetState = Field(default=ScalesetState.init)
|
||||
@ -676,6 +680,7 @@ class NotificationConfig(BaseModel):
|
||||
|
||||
|
||||
class Repro(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
vm_id: UUID = Field(default_factory=uuid4)
|
||||
task_id: UUID
|
||||
config: ReproConfig
|
||||
@ -795,6 +800,7 @@ class NodeCommandEnvelope(BaseModel):
|
||||
|
||||
|
||||
class TaskEvent(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
task_id: UUID
|
||||
machine_id: UUID
|
||||
event_data: WorkerEvent
|
||||
@ -813,6 +819,7 @@ class NodeAssignment(BaseModel):
|
||||
|
||||
|
||||
class Task(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
job_id: UUID
|
||||
task_id: UUID = Field(default_factory=uuid4)
|
||||
state: TaskState = Field(default=TaskState.init)
|
||||
|
@ -3,6 +3,7 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
@ -17,6 +18,7 @@ class WebhookMessage(EventMessage):
|
||||
|
||||
|
||||
class WebhookMessageLog(WebhookMessage):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
state: WebhookMessageState = Field(default=WebhookMessageState.queued)
|
||||
try_count: int = Field(default=0)
|
||||
|
||||
|
Reference in New Issue
Block a user