Use protobuf Enum exclusively for message sent from Client (#2644)

This commit is contained in:
Alexandre de Souza 2024-06-11 17:13:37 -03:00 committed by GitHub
parent 06e9a5e15c
commit b56fa7c508
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 2 deletions

View file

@ -4,5 +4,5 @@ defmodule LivebookProto.AppDeploymentStatus do
field :id, 1, type: :string
field :deployment_group_id, 2, type: :string, json_name: "deploymentGroupId"
field :version, 3, type: :string
field :status, 4, type: :string
field :status, 4, type: LivebookProto.AppDeploymentStatusType, enum: true
end

View file

@ -0,0 +1,8 @@
defmodule LivebookProto.AppDeploymentStatusType do
use Protobuf, enum: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"
field :connecting, 0
field :preparing, 1
field :available, 2
field :deactivated, 99
end

View file

@ -159,11 +159,25 @@ message Agent {
string deployment_group_id = 4;
}
/**
* We're only using Enum in this case because
* the Client is the source of the information,
* and the Server will always be up-to-date.
*
* Otherwise, it shouldn't be used.
*/
enum AppDeploymentStatusType {
connecting = 0;
preparing = 1;
available = 2;
deactivated = 4;
}
message AppDeploymentStatus {
string id = 1;
string deployment_group_id = 2;
string version = 3;
string status = 4;
AppDeploymentStatusType status = 4;
}
message AppDeploymentStatusReport {