From a6c9c6fe2b9024e124e15658ae4b0667131745d9 Mon Sep 17 00:00:00 2001 From: Mauricio Guevara Date: Mon, 23 Feb 2026 16:13:33 -0400 Subject: [PATCH 1/3] add engineering team to generated projects --- .../CommonLib/RollbarApi/Rollbar.cs | 10 +++++ .../CommonLib/RollbarApi/RollbarClient.cs | 45 +++++++++++++++++++ .../RegistrationFunction/Function.cs | 22 +++++++-- 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/Modules/LambdaSharp.Core/CommonLib/RollbarApi/Rollbar.cs b/Modules/LambdaSharp.Core/CommonLib/RollbarApi/Rollbar.cs index 6d646785..467178d0 100644 --- a/Modules/LambdaSharp.Core/CommonLib/RollbarApi/Rollbar.cs +++ b/Modules/LambdaSharp.Core/CommonLib/RollbarApi/Rollbar.cs @@ -119,3 +119,13 @@ public class Frame { [JsonPropertyName("method")] public string? Method { get; set; } } + +public class RollbarTeam { + + //--- Properties --- + [JsonPropertyName("id")] + public int Id { get; set; } + + [JsonPropertyName("name")] + public string? Name { get; set; } +} diff --git a/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs b/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs index 6f3c8eb7..796807dd 100644 --- a/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs +++ b/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs @@ -267,5 +267,50 @@ public async Task CreateProjectTokenAsync(int projectId, st return token; } + public async Task AssignProjectToEngineeringTeamAsync(int projectId) { + const string ENGINEERING_TEAM_NAME = "Engineering"; + LogInfo($"finding team '{ENGINEERING_TEAM_NAME}'"); + + // Get all teams + var httpResponse = await HttpClient.SendAsync(new HttpRequestMessage { + RequestUri = new Uri($"https://api.rollbar.com/api/1/teams?access_token={_accountReadAccessToken}"), + Method = HttpMethod.Get + }); + if(!httpResponse.IsSuccessStatusCode) { + throw new RollbarClientException($"http operation failed: {httpResponse.StatusCode}"); + } + var result = Deserialize(await httpResponse.Content.ReadAsStringAsync()); + if(result.Error != 0) { + throw new RollbarClientException($"rollbar operation failed (error {result.Error}): {result.Message}"); + } + + // Parse teams and find Engineering + var teamsJson = Serialize(result.Result); + var teams = Deserialize>(teamsJson); + var engineeringTeam = teams?.FirstOrDefault(t => + t.Name?.Equals(ENGINEERING_TEAM_NAME, StringComparison.OrdinalIgnoreCase) == true + ); + + if(engineeringTeam == null) { + throw new RollbarClientException($"team '{ENGINEERING_TEAM_NAME}' not found"); + } + + var teamId = engineeringTeam.Id; + LogInfo($"assigning rollbar project {projectId} to team '{ENGINEERING_TEAM_NAME}' (ID: {teamId})"); + + httpResponse = await HttpClient.SendAsync(new HttpRequestMessage { + RequestUri = new Uri($"https://api.rollbar.com/api/1/team/{teamId}/project/{projectId}?access_token={_accountWriteAccessToken}"), + Method = HttpMethod.Put + }); + if(!httpResponse.IsSuccessStatusCode) { + throw new RollbarClientException($"http operation failed: {httpResponse.StatusCode}"); + } + result = Deserialize(await httpResponse.Content.ReadAsStringAsync()); + if(result.Error != 0) { + throw new RollbarClientException($"rollbar operation failed (error {result.Error}): {result.Message}"); + } + LogInfo($"assigned rollbar project {projectId} to team '{ENGINEERING_TEAM_NAME}'"); + } + private void LogInfo(string message) => _logInfo?.Invoke(message); } \ No newline at end of file diff --git a/Modules/LambdaSharp.Core/RegistrationFunction/Function.cs b/Modules/LambdaSharp.Core/RegistrationFunction/Function.cs index e06ee4e8..bde94db2 100644 --- a/Modules/LambdaSharp.Core/RegistrationFunction/Function.cs +++ b/Modules/LambdaSharp.Core/RegistrationFunction/Function.cs @@ -287,7 +287,16 @@ public override async Task> ProcessUpda // update module record LogInfo($"Updating Module: Id={properties.ModuleId}, Info={properties.GetModuleInfo()}"); - var owner = PopulateOwnerMetaData(properties); + + // get existing owner or create new one + var owner = await Registrations.GetOwnerMetaDataAsync($"M:{properties.ModuleId}"); + owner = PopulateOwnerMetaData(properties, owner); + if(RollbarClient.HasTokens) { + var rollbarProject = await RegisterRollbarProject(properties); + owner.RollbarProjectId = rollbarProject.ProjectId; + owner.RollbarAccessToken = rollbarProject.ProjectAccessToken; + } + await Registrations.PutOwnerMetaDataAsync($"M:{properties.ModuleId}", owner); return Respond(request.PhysicalResourceId); } @@ -418,10 +427,17 @@ private OwnerMetaData PopulateOwnerMetaData(RegistrationResourceProperties prope } // find or create Rollbar project - var project = await RollbarClient.FindProjectByNameAsync(name) - ?? await RollbarClient.CreateProjectAsync(name); + var existingProject = await RollbarClient.FindProjectByNameAsync(name); + var project = existingProject ?? await RollbarClient.CreateProjectAsync(name); LogInfo($"Using Rollbar project '{project.Name}' (ID: {project.Id})"); + // assign project to Engineering team. + try { + await RollbarClient.AssignProjectToEngineeringTeamAsync(project.Id); + } catch(Exception e) { + LogWarn($"Failed to assign project to Engineering team: {e.Message}"); + } + // retrieve or create access token for Rollbar project var tokens = await RollbarClient.ListProjectTokensAsync(project.Id); var token = tokens.FirstOrDefault(t => t.Name == "post_server_item")?.AccessToken; From 49dc10f04628c4971c974aadc369774ec6892fdb Mon Sep 17 00:00:00 2001 From: Mauricio Guevara Date: Mon, 23 Feb 2026 17:02:58 -0400 Subject: [PATCH 2/3] upgrade lambdasharp version --- Libraries/LambdaSharp.Modules/VersionInfoCompatibility.cs | 4 ++-- Scripts/Set-Lash-Version.ps1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/LambdaSharp.Modules/VersionInfoCompatibility.cs b/Libraries/LambdaSharp.Modules/VersionInfoCompatibility.cs index 023aa8d5..fc3f36fa 100644 --- a/Libraries/LambdaSharp.Modules/VersionInfoCompatibility.cs +++ b/Libraries/LambdaSharp.Modules/VersionInfoCompatibility.cs @@ -139,10 +139,10 @@ public static bool IsValidLambdaSharpAssemblyReferenceForToolVersion(VersionInfo case "net8": case "net8.0": - // .NET 8 projects require 0.8.5.* + // .NET 8 projects require 0.8.5.* or higher valid = (libraryVersion.Major == 0) && (libraryVersion.Minor == 8) - && (libraryVersion.Build == 5); + && (libraryVersion.Build >= 5); break; default: throw new VersionInfoCompatibilityUnsupportedFrameworkException(projectFramework); diff --git a/Scripts/Set-Lash-Version.ps1 b/Scripts/Set-Lash-Version.ps1 index daa511a9..730ebec6 100644 --- a/Scripts/Set-Lash-Version.ps1 +++ b/Scripts/Set-Lash-Version.ps1 @@ -1,5 +1,5 @@ # Set variables -$env:LAMBDASHARP_VERSION_PREFIX = "0.8.5" +$env:LAMBDASHARP_VERSION_PREFIX = "0.8.6" $env:LAMBDASHARP_VERSION_SUFFIX = "" # Create full version text From 342625e7faf375998526e801445aa02fcefb5b5e Mon Sep 17 00:00:00 2001 From: Mauricio Guevara Date: Wed, 25 Feb 2026 15:55:58 -0400 Subject: [PATCH 3/3] changed version --- .../CommonLib/RollbarApi/RollbarClient.cs | 10 ++++++---- Scripts/Set-Lash-Version.ps1 | 2 +- Scripts/set-lash-version.sh | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs b/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs index 796807dd..ae36a2b2 100644 --- a/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs +++ b/Modules/LambdaSharp.Core/CommonLib/RollbarApi/RollbarClient.cs @@ -273,8 +273,9 @@ public async Task AssignProjectToEngineeringTeamAsync(int projectId) { // Get all teams var httpResponse = await HttpClient.SendAsync(new HttpRequestMessage { - RequestUri = new Uri($"https://api.rollbar.com/api/1/teams?access_token={_accountReadAccessToken}"), - Method = HttpMethod.Get + RequestUri = new Uri("https://api.rollbar.com/api/1/teams?limit=100"), + Method = HttpMethod.Get, + Headers = {{ "X-Rollbar-Access-Token", _accountReadAccessToken }} }); if(!httpResponse.IsSuccessStatusCode) { throw new RollbarClientException($"http operation failed: {httpResponse.StatusCode}"); @@ -299,8 +300,9 @@ public async Task AssignProjectToEngineeringTeamAsync(int projectId) { LogInfo($"assigning rollbar project {projectId} to team '{ENGINEERING_TEAM_NAME}' (ID: {teamId})"); httpResponse = await HttpClient.SendAsync(new HttpRequestMessage { - RequestUri = new Uri($"https://api.rollbar.com/api/1/team/{teamId}/project/{projectId}?access_token={_accountWriteAccessToken}"), - Method = HttpMethod.Put + RequestUri = new Uri($"https://api.rollbar.com/api/1/team/{teamId}/project/{projectId}"), + Method = HttpMethod.Put, + Headers = {{ "X-Rollbar-Access-Token", _accountWriteAccessToken }} }); if(!httpResponse.IsSuccessStatusCode) { throw new RollbarClientException($"http operation failed: {httpResponse.StatusCode}"); diff --git a/Scripts/Set-Lash-Version.ps1 b/Scripts/Set-Lash-Version.ps1 index 730ebec6..7983989c 100644 --- a/Scripts/Set-Lash-Version.ps1 +++ b/Scripts/Set-Lash-Version.ps1 @@ -1,5 +1,5 @@ # Set variables -$env:LAMBDASHARP_VERSION_PREFIX = "0.8.6" +$env:LAMBDASHARP_VERSION_PREFIX = "0.8.5.1" $env:LAMBDASHARP_VERSION_SUFFIX = "" # Create full version text diff --git a/Scripts/set-lash-version.sh b/Scripts/set-lash-version.sh index 6f265670..94d46253 100755 --- a/Scripts/set-lash-version.sh +++ b/Scripts/set-lash-version.sh @@ -1,6 +1,6 @@ #!/bin/bash -export LAMBDASHARP_VERSION_PREFIX=0.8.5.0 +export LAMBDASHARP_VERSION_PREFIX=0.8.5.1 export LAMBDASHARP_VERSION_SUFFIX= # create full version text