-
Notifications
You must be signed in to change notification settings - Fork 2
/
hostagent.proto
83 lines (73 loc) · 3.39 KB
/
hostagent.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
syntax = "proto3";
option go_package = "github.com/canonical/landscape-hostagent-api";
package landscapehostagentapi;
// LandscapeHostAgent service.
// The connection is made from the hostagent (client) to the landscape server (sass or on-prem).
service LandscapeHostAgent {
rpc Connect (stream HostAgentInfo) returns (stream Command) {}
}
message HostAgentInfo {
string token = 1; // token corresponds to the Pro token subscription. Discared on on-prem landscape server.
string uid = 2; // uid is empty on the first request if the host never contacted landscape. Landscape generates one for the hostagent to send it back with each transaction.
string hostname = 3; // hostname is literally the name of the host itself.
repeated InstanceInfo instances = 4; // instances are all the machine instances registered on the machine.
string account_name = 5; // account_name is the account used in Landscape SaaS.
optional string registration_key = 6; // registration_key is an optional account-wide key used to register clients.
optional string default_instance_id = 7; // default_instance_id is the id of the default instance.
// The default instance will be empty if there are no instances.
// The default instance will not be in the instances list if it is not managed by the host agent.
// InstanceInfo gather all the information of a given instance.
message InstanceInfo {
string id = 1;
string name = 2; // name is the hostname of the instance.
string version_id = 3; // version_id string as in VERSION_ID in /etc/os-release
InstanceState instance_state = 4; // instance_state are the defined states of the instances.
}
}
// InstanceState reports the supported states of an instance communicated by the agent.
enum InstanceState {
Stopped = 0;
Running = 1;
}
// Command is an instruction that landscape can send via its stream to the host agent.
// The command is self-explanatory or specified.
message Command {
// only one command can be passed at a time.
oneof cmd {
AssignHost assign_host = 1;
Start start = 2;
Stop stop = 3;
Install install = 4;
Uninstall uninstall = 5;
SetDefault set_default = 6;
ShutdownHost shutdown_host = 7;
}
message AssignHost {
string uid = 1;
}
message Start {
string id = 1;
}
message Stop {
string id = 1;
}
message Install {
string id = 1;
optional string cloudinit = 2; // cloudinit is the yaml configuration to optionally pass to an instance.
/*
URL to a WSL rootfs image we will download and import from. It will be registered under "id".
If this entry is not set, Ubuntu Pro for WSL will download a package from the Microsoft store
matching WSL distribution name as available in wsl --install.
*/
optional string rootfsURL = 3;
}
message Uninstall {
string id = 1;
}
// SetDefault changes the default instance on the host.
message SetDefault {
string id = 1;
}
// ShutdownHost forces a shut down of the agent/controller from landscape perspective (it may autorestart).
message ShutdownHost{}
}