Skip to content

Commit

Permalink
feat: communication design: add 'Details'-RPC
Browse files Browse the repository at this point in the history
This RPC is intended to request further information from a single
device or command. To allow for multiple different kinds of
requested information in the future, the RPC request holds a
'keyword' field to specify the requested information.

Signed-off-by: Jens Drenhaus <jens.drenhaus@blindspot.software>
  • Loading branch information
jensdrenhaus committed Sep 26, 2024
1 parent d2a1f9c commit 5c41ffa
Show file tree
Hide file tree
Showing 4 changed files with 316 additions and 112 deletions.
8 changes: 8 additions & 0 deletions cmds/dutagent/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"
"log"

"connectrpc.com/connect"
Expand Down Expand Up @@ -48,3 +49,10 @@ func (a *rpcService) Commands(

return res, nil
}

func (a *rpcService) Details(
_ context.Context,
_ *connect.Request[pb.DetailsRequest],
) (*connect.Response[pb.DetailsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("Details RPC not implemented"))
}
14 changes: 14 additions & 0 deletions protobuf/dutctl/v1/dutctl.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option go_package = "github.com/BlindspotSoftware/dutctl/protobuf/gen/dutctl/v1;
service DeviceService {
rpc List(ListRequest) returns (ListResponse) {}
rpc Commands(CommandsRequest) returns (CommandsResponse) {}
rpc Details(DetailsRequest) returns (DetailsResponse) {}
rpc Run(stream RunRequest) returns (stream RunResponse) {}
}

Expand All @@ -31,6 +32,19 @@ message CommandsResponse {
repeated string commands = 1;
}

// DetailsRequest is sent by the client to request further information for specific
// device or a specific command. The type of information is defined by keyword.
message DetailsRequest {
string device = 1;
string cmd = 2;
string keyword = 3;
}

// DetailsResponse is sent by the agent in response to a DetailsRequest.
message DetailsResponse {
string details = 1;
}


// RunRequest is sent by the client to start a command execution on a device and optionally
// to further interact with the agent during the command execution.
Expand Down
Loading

0 comments on commit 5c41ffa

Please sign in to comment.