From 0ea91fc8f4eb1fdffe649d8f99a2e5fd3ba2ec85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claus=20R=C3=B8rbech?= Date: Tue, 2 Apr 2024 10:04:27 +0200 Subject: [PATCH] Remove feature flag toggling infrastructure --- Tools/DeployApps/BaasClient.cs | 51 ---------------------------------- 1 file changed, 51 deletions(-) diff --git a/Tools/DeployApps/BaasClient.cs b/Tools/DeployApps/BaasClient.cs index ebdcecaf36..e300f0359a 100644 --- a/Tools/DeployApps/BaasClient.cs +++ b/Tools/DeployApps/BaasClient.cs @@ -148,7 +148,6 @@ public class FunctionReturn };"; private readonly HttpClient _client = new(); - private readonly HttpClient _privateclient = new(); private readonly string? _clusterName; @@ -197,9 +196,6 @@ private BaasClient(Uri baseUri, string differentiator, TextWriter output, string _clusterName = clusterName; Differentiator = differentiator; _output = output; - - _privateclient.BaseAddress = new Uri(baseUri, "api/private/v1.0/"); - _privateclient.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/json"); } public static async Task Docker(Uri baseUri, string differentiator, TextWriter output) @@ -297,7 +293,6 @@ private async Task Authenticate(string provider, object credentials) _refreshToken = authDoc!["refresh_token"].AsString; _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authDoc["access_token"].AsString); - _privateclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authDoc["access_token"].AsString); } public static async Task GetOrDeployContainer(string baasaasApiKey, string differentiator, TextWriter output) @@ -560,15 +555,6 @@ public async Task SetAutomaticRecoveryEnabled(BaasApp app, bool enabled) { development_mode_enabled = true, }); - - // Retrieve feature flags - // var features = await GetPrivateAsync($"groups/{_groupId}/apps/{app}/features"); - // ENABLE LEGACY MIXED SUPPORT - // await PostPrivateAsync($"features/legacy_mixed_type", new { app_ids = new []{$"{appId}"}, action = "enable"} ); - // await PostPrivateAsync($"features/bypass_legacy_mixed_type", new { app_ids = new []{$"{appId}"}, action = "disable"} ); - // DISABLE LEGACY MIXED SUPPORT - Default on latest test server - https://github.com/10gen/baas/blob/master/etc/configs/test_config.json#L303 - // await PostPrivateAsync($"features/legacy_mixed_type", new { app_ids = new []{$"{appId}"}, action = "disable"} ); - // await PostPrivateAsync($"features/bypass_legacy_mixed_type", new { app_ids = new []{$"{appId}"}, action = "enable"} ); return (app, mongoServiceId); } @@ -713,16 +699,10 @@ private async Task RefreshAccessTokenAsync() private Task PostAsync(string relativePath, object obj) => SendAsync(HttpMethod.Post, relativePath, obj); - private Task PostPrivateAsync(string relativePath, object obj) => SendPrivateAsync(HttpMethod.Post, relativePath, obj); - private Task GetAsync(string relativePath) => SendAsync(HttpMethod.Get, relativePath); - private Task GetPrivateAsync(string relativePath) => SendPrivateAsync(HttpMethod.Get, relativePath); - private Task PutAsync(string relativePath, object obj) => SendAsync(HttpMethod.Put, relativePath, obj); - private Task PutPrivateAsync(string relativePath, object obj) => SendPrivateAsync(HttpMethod.Put, relativePath, obj); - private Task PatchAsync(string relativePath, object obj) => SendAsync(new HttpMethod("PATCH"), relativePath, obj); private async Task SendAsync(HttpMethod method, string relativePath, object? payload = null) @@ -756,37 +736,6 @@ private async Task RefreshAccessTokenAsync() return default; } - private async Task SendPrivateAsync(HttpMethod method, string relativePath, object? payload = null) - { - using var message = new HttpRequestMessage(method, new Uri(relativePath, UriKind.Relative)); - if (payload != null) - { - message.Content = GetJsonContent(payload); - } - - var response = await _privateclient.SendAsync(message); - if (!response.IsSuccessStatusCode) - { - if (response.StatusCode == HttpStatusCode.Unauthorized && _refreshToken != null) - { - await RefreshAccessTokenAsync(); - return await SendAsync(method, relativePath, payload); - } - - var content = await response.Content.ReadAsStringAsync(); - throw new Exception($"An error ({response.StatusCode}) occurred while executing {method} {relativePath}: {content}"); - } - - var json = await response.Content.ReadAsStringAsync(); - - if (!string.IsNullOrWhiteSpace(json)) - { - return BsonSerializer.Deserialize(json); - } - - return default; - } - public static HttpContent GetJsonContent(object obj) { string jsonContent;