From 508f121e5a84f2979c616a50f63264f90833be67 Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Sat, 15 Jun 2024 10:23:48 +0000 Subject: [PATCH] Added API Endpoints for account config This is where we will store config like the blast radius limits. --- changes.proto | 4 ++++ config.proto | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/changes.proto b/changes.proto index e0ad0df..8f633cc 100644 --- a/changes.proto +++ b/changes.proto @@ -7,6 +7,7 @@ import "google/protobuf/timestamp.proto"; import "bookmarks.proto"; import "items.proto"; import "snapshots.proto"; +import "config.proto"; // ______ // ,'" "-._ @@ -231,6 +232,9 @@ message UpdatePlannedChangesRequest { // the changing items repeated MappedItemDiff changingItems = 2; + + // Overrides the stored blast radius config for this change + optional config.BlastRadiusConfig blastRadiusConfigOverride = 3; } message ListAppChangesSummaryRequest { diff --git a/config.proto b/config.proto index 8559362..1bd4da1 100644 --- a/config.proto +++ b/config.proto @@ -5,8 +5,15 @@ option go_package = "github.com/overmindtech/sdp-go;sdp"; // a simple key-value store to store the config for the CLI service ConfigService { + // GetConfig provides raw access to the underlying stored data. [experimental] rpc GetConfig(GetConfigRequest) returns (GetConfigResponse) {} + // SetConfig provides raw access to the underlying stored data. [experimental] rpc SetConfig(SetConfigRequest) returns (SetConfigResponse) {} + + // Get the account config for the user's account + rpc GetAccountConfig(GetAccountConfigRequest) returns (GetAccountConfigResponse); + // Update the account config for the user's account + rpc UpdateAccountConfig(UpdateAccountConfigRequest) returns (UpdateAccountConfigResponse); } message GetConfigRequest { @@ -22,3 +29,37 @@ message SetConfigRequest { } message SetConfigResponse { } + + +// The config that is used when calculating the blast radius for a change, this +// does not affect manually requested blast radii vie the "Explore" view or the +// API +message BlastRadiusConfig { + // The maximum number of items that can be returned in a single blast radius + // request. Once a request has hit this limit, all currently running + // requests will be cancelled and the blast radius returned as-is + int32 maxItems = 1; + + // How deeply to link when calculating the blast radius for a change + int32 linkDepth = 2; +} + +message AccountConfig { + // The blast radius config for this account + BlastRadiusConfig blastRadius = 1; +} + +message GetAccountConfigRequest {} + +message GetAccountConfigResponse { + AccountConfig config = 1; +} + +// Updates the account config for the user's account. +message UpdateAccountConfigRequest { + AccountConfig config = 1; +} + +message UpdateAccountConfigResponse { + AccountConfig config = 1; +}