From 7a62b38435b65b7efc77b1b585b6c758a4ad0e5f Mon Sep 17 00:00:00 2001 From: TP Honey Date: Mon, 23 Sep 2024 14:00:08 +0100 Subject: [PATCH] (feat) add ListActiveSources and SourceHeartbeat --- account.proto | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/account.proto b/account.proto index c78b265..2bd54b6 100644 --- a/account.proto +++ b/account.proto @@ -150,6 +150,12 @@ service ManagementService { // Deletes a source from a user's account rpc DeleteSource(DeleteSourceRequest) returns (DeleteSourceResponse); + // Sources heartbeat and health + // List of all active sources and their health, includes managed and local sources + rpc ListActiveSources(ListActiveSourcesRequest) returns (ListActiveSourcesResponse); + // Heartbeat of a source + rpc SourceHeartbeat(SubmitSourceHeartbeat) returns (SourceHeartbeatResponse); + // Updates sources to keep them running in the background. This can be used // to add explicit action, when the built-in keepalives are not sufficient. rpc KeepaliveSources(KeepaliveSourcesRequest) returns (KeepaliveSourcesResponse); @@ -301,6 +307,71 @@ message SourceKeepaliveResult { string Error = 3; } +message ListActiveSourcesRequest {} + +enum ActiveSourceStatus { + ACTIVE_SOURCE_STATUS_HEALTHY = 0; + ACTIVE_SOURCE_STATUS_UNHEALTHY = 1; + ACTIVE_SOURCE_STATUS_DISCONNECTED = 2; +} + +// Whether the source is managed by srcman or was created by the user locally +enum SourceManaged { + MANAGED = 0; + LOCAL = 1; +} + +message ActiveSource { + // The UUID of the source + bytes UUID = 1; + // The version of the source + string Version = 2; + // The name of the source + string Name = 3; + // The error message if the source is unhealthy + optional string Error = 4; + // The status of the source, this is calculated based on the last heartbeat received and if there is an error + ActiveSourceStatus Status = 5; + // The last time the source sent a heartbeat + google.protobuf.Timestamp LastHeartbeat = 6; + // The type of the source, AWS or Stdlib or Kubernetes + string Type = 7; + // Whether the source is managed, or local + SourceManaged Managed = 8; + // The types of sources that this source can discover + repeated string availableTypes = 9; + // The scopes that this source can discover + repeated string availableScopes = 10; +} + +message ListActiveSourcesResponse { + repeated ActiveSource source = 1; +} + +// The source sends a heartbeat to the API to let it know that it is still alive, note it does not give a status. +message SubmitSourceHeartbeat { + // The UUID of the source that is sending the heartbeat + bytes UUID = 1; + // The version of the source + string Version = 2; + // The name of the source + string Name = 3; + // The error message if the source is unhealthy + optional string Error = 4; + // When the source will send the next heartbeat by + google.protobuf.Timestamp NextHeartbeat = 5; + // The type of the source, AWS or Stdlib or Kubernetes + string Type = 6; + // Whether the source is managed, or local + SourceManaged Managed = 7; + // The types of sources that this source can discover + repeated string availableTypes = 8; + // The scopes that this source can discover + repeated string availableScopes = 9; +} + +message SourceHeartbeatResponse {} + message KeepaliveSourcesRequest { // Set to true to have the API call wait until the source is up and healthy bool waitForHealthy = 1;