-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add foundations for Windows FIPS flavor (#31466)
- Loading branch information
Showing
9 changed files
with
143 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tools/windows/DatadogAgentInstaller/WixSetup/Datadog Agent/AgentFlavor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
|
||
namespace WixSetup.Datadog_Agent | ||
{ | ||
internal static class AgentFlavorFactory | ||
{ | ||
public static IAgentFlavor New(AgentVersion agentVersion) | ||
{ | ||
var flavor = Environment.GetEnvironmentVariable("AGENT_FLAVOR"); | ||
|
||
return flavor switch | ||
{ | ||
"fips" => new FIPSAgent(agentVersion), | ||
"base" => new BaseAgent(agentVersion), | ||
_ => new BaseAgent(agentVersion) // Default to BaseAgent if no valid value is provided | ||
}; | ||
} | ||
} | ||
|
||
internal interface IAgentFlavor | ||
{ | ||
string ProductFullName { get; } | ||
Guid UpgradeCode { get; } | ||
string ProductDescription { get; } | ||
string PackageOutFileName { get; } | ||
} | ||
|
||
internal class FIPSAgent : IAgentFlavor | ||
{ | ||
private readonly AgentVersion _agentVersion; | ||
|
||
public FIPSAgent(AgentVersion agentVersion) | ||
{ | ||
_agentVersion = agentVersion; | ||
} | ||
|
||
public string ProductFullName => "Datadog FIPS Agent"; | ||
public Guid UpgradeCode => new("de421174-9615-4fe9-b8a8-2b3f123bdc4f"); | ||
public string ProductDescription => $"Datadog FIPS Agent {_agentVersion.PackageVersion}"; | ||
public string PackageOutFileName => $"datadog-fips-agent-{_agentVersion.PackageVersion}-1-x86_64"; | ||
} | ||
|
||
internal class BaseAgent : IAgentFlavor | ||
{ | ||
private readonly AgentVersion _agentVersion; | ||
|
||
public BaseAgent(AgentVersion agentVersion) | ||
{ | ||
_agentVersion = agentVersion; | ||
} | ||
|
||
public string ProductFullName => "Datadog Agent"; | ||
public Guid UpgradeCode => new("0c50421b-aefb-4f15-a809-7af256d608a5"); | ||
public string ProductDescription => $"Datadog Agent {_agentVersion.PackageVersion}"; | ||
public string PackageOutFileName => $"datadog-agent-{_agentVersion.PackageVersion}-1-x86_64"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters