From 1c1bb4672b6e32510c419498c721e552443d9418 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 29 Apr 2024 11:24:14 +0200 Subject: [PATCH] Update the env proto --- proto/environments/environments_v1.proto | 83 +++++++++++++++++++----- 1 file changed, 67 insertions(+), 16 deletions(-) diff --git a/proto/environments/environments_v1.proto b/proto/environments/environments_v1.proto index b56b418..bca1628 100644 --- a/proto/environments/environments_v1.proto +++ b/proto/environments/environments_v1.proto @@ -7,28 +7,84 @@ option go_package = "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/e /** * Service for handling environments */ -service Environments { - rpc Create(EnvironmentFull) returns (EnvironmentFull) {} - rpc Update(EnvironmentFull) returns (EnvironmentFull) {} - rpc Delete(EnvironmentFull) returns (google.protobuf.Empty) {} - rpc Get(EnvironmentName) returns (EnvironmentFull) {} - rpc List(google.protobuf.Empty) returns (stream EnvironmentName) {} +service Environments { + rpc Create(CreateOptions) returns (EnvironmentFull) {} + rpc Update(UpdateOptions) returns (EnvironmentFull) {} + rpc Delete(DeleteOptions) returns (google.protobuf.Empty) {} + rpc Get(GetOptions) returns (EnvironmentFull) {} + rpc List(ListOptions) returns (stream EnvironmentFull) {} } /** - * Represents a environment UUID only - * I don't think we need it + User related messages */ + +message OwnerId { + string uuid = 1; // UUID of a user that is creating an environemnt +} + +message Token { + string token = 1; // Token that should be used to create an environment +} + +/** + Services options + */ + +message CreateOptions { + EnvironmentName name = 1; + EnvironmentData data = 2; + OwnerId owner_id = 3; + Token token = 4; +} + +message UpdateOptions { + EnvironmentName name = 1; + EnvironmentData data = 2; + OwnerId owner_id = 3; + Token token = 4; +} + +message DeleteOptions { + EnvironmentName name = 1; + OwnerId owner_id = 3; + Token token = 4; +} + +message GetOptions { + EnvironmentName name = 1; + OwnerId owner_id = 3; + Token token = 4; +} + +message ListOptions { + EnvironmentName name = 1; + OwnerId owner_id = 3; + Token token = 4; +} +/** + Environment related messages + */ + message EnvironmentName { - string name = 1; // Contour ID: UUID + string name = 1; // A name of the environment } message EnvironmentData { Provider provider = 2; // Provide Kubernetes kubernetes = 3; - HetznerOptions hetzner_options = 4; + HetznerOptions hetzner_options = 4; } +message EnvironmentFull { + EnvironmentName name = 1; + EnvironmentData data = 2; +} + + +/** + Helpers and other messages + */ enum Provider { PROVIDER_UNSPECIFIED = 0; PROVIDER_HETZNER = 1; @@ -39,12 +95,7 @@ enum Kubernetes { KUBERNETES_K3S = 1; } -message HetznerOptions { +message HetznerOptions { string server_type = 1; string server_location = 2; } - -message EnvironmentFull { - EnvironmentName name = 1; - EnvironmentData data = 2; -}