mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 20:58:06 +00:00
Add node messages to node get (#836)
This exposes the node commands that have yet to be processed by the node. Example use case: The SDK can now ask "has this node installed my SSH key"
This commit is contained in:
@ -557,6 +557,29 @@ class NodeHeartbeatEntry(BaseModel):
|
||||
data: List[Dict[str, HeartbeatType]]
|
||||
|
||||
|
||||
class StopNodeCommand(BaseModel):
|
||||
pass
|
||||
|
||||
|
||||
class StopTaskNodeCommand(BaseModel):
|
||||
task_id: UUID
|
||||
|
||||
|
||||
class NodeCommandAddSshKey(BaseModel):
|
||||
public_key: str
|
||||
|
||||
|
||||
class NodeCommand(EnumModel):
|
||||
stop: Optional[StopNodeCommand]
|
||||
stop_task: Optional[StopTaskNodeCommand]
|
||||
add_ssh_key: Optional[NodeCommandAddSshKey]
|
||||
|
||||
|
||||
class NodeCommandEnvelope(BaseModel):
|
||||
command: NodeCommand
|
||||
message_id: str
|
||||
|
||||
|
||||
class Node(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
pool_name: PoolName
|
||||
@ -564,6 +587,7 @@ class Node(BaseModel):
|
||||
state: NodeState = Field(default=NodeState.init)
|
||||
scaleset_id: Optional[UUID] = None
|
||||
tasks: Optional[List[Tuple[UUID, NodeTaskState]]] = None
|
||||
messages: Optional[List[NodeCommand]] = None
|
||||
heartbeat: Optional[datetime]
|
||||
version: str = Field(default="1.0.0")
|
||||
reimage_requested: bool = Field(default=False)
|
||||
@ -776,29 +800,6 @@ class NodeEventEnvelope(BaseModel):
|
||||
event: NodeEventShim
|
||||
|
||||
|
||||
class StopNodeCommand(BaseModel):
|
||||
pass
|
||||
|
||||
|
||||
class StopTaskNodeCommand(BaseModel):
|
||||
task_id: UUID
|
||||
|
||||
|
||||
class NodeCommandAddSshKey(BaseModel):
|
||||
public_key: str
|
||||
|
||||
|
||||
class NodeCommand(EnumModel):
|
||||
stop: Optional[StopNodeCommand]
|
||||
stop_task: Optional[StopTaskNodeCommand]
|
||||
add_ssh_key: Optional[NodeCommandAddSshKey]
|
||||
|
||||
|
||||
class NodeCommandEnvelope(BaseModel):
|
||||
command: NodeCommand
|
||||
message_id: str
|
||||
|
||||
|
||||
class TaskEvent(BaseModel):
|
||||
timestamp: Optional[datetime] = Field(alias="Timestamp")
|
||||
task_id: UUID
|
||||
|
Reference in New Issue
Block a user