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:
bmc-msft
2021-04-26 16:14:58 -04:00
committed by GitHub
parent 541e745199
commit ced21b2ea3
3 changed files with 29 additions and 25 deletions

View File

@ -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