Skip to content

Commit

Permalink
Data Contracts for handling ToS violations. (#127)
Browse files Browse the repository at this point in the history
* Data Contracts for handling ToS violations.

* Update test.
  • Loading branch information
ravarnamsft authored Jul 20, 2022
1 parent 34eda89 commit 4ee54c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion AgentInterfaces.Tests/VmAgentInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void KnownProperties()
nameof(VmAgentInfo.SequenceNumber),
nameof(VmAgentInfo.IsUnassignable),
nameof(VmAgentInfo.NetworkConfiguration),
nameof(VmAgentInfo.VmMonitoringOutputId)
nameof(VmAgentInfo.VmMonitoringOutputId),
nameof(VmAgentInfo.ConfidenceLevelForViolationOfToS)
};

HashSet<string> propertyNames =
Expand Down
7 changes: 6 additions & 1 deletion AgentInterfaces/VmAgentInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public class VmAgentInfo
/// </summary>
public string VmMonitoringOutputId { get; set; }

/// <summary>
/// A confidence interval for whether the VM is in violation of terms of service.
/// </summary>
public int ConfidenceLevelForViolationOfToS { get; set; }

public string ToLogString()
{
if (SessionHostHeartbeatMap?.Count > 10)
Expand All @@ -50,7 +55,7 @@ public string ToLogString()
string networkConfiguration = NetworkConfiguration?.ToJsonString() ?? string.Empty;
string sessionHostSummary = SessionHostHeartbeatMap.Values.GroupBy(x => x.CurrentGameState).ToDictionary(y => y.Key, y => y.Count()).ToJsonString();
return
$"VmState: {VmState}, AssignmentId: {AssignmentId ?? string.Empty}, AgentProcessGuid : {AgentProcessGuid}, SequenceNumber {SequenceNumber}, MaintenanceSchedule : {maintenanceSchedule}, IsUnassignable: {IsUnassignable ?? false}, NetworkConfiguration: {networkConfiguration}, SessionHostSummary: {sessionHostSummary}, VmMonitoringOutput: {VmMonitoringOutputId}";
$"VmState: {VmState}, AssignmentId: {AssignmentId ?? string.Empty}, AgentProcessGuid : {AgentProcessGuid}, SequenceNumber {SequenceNumber}, MaintenanceSchedule : {maintenanceSchedule}, IsUnassignable: {IsUnassignable ?? false}, NetworkConfiguration: {networkConfiguration}, SessionHostSummary: {sessionHostSummary}, VmMonitoringOutput: {VmMonitoringOutputId}, ConfidenceLevelForViolationOfToS: {ConfidenceLevelForViolationOfToS}";
}

return this.ToJsonString();
Expand Down
5 changes: 5 additions & 0 deletions AgentInterfaces/VmAgentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@ public class VmAgentSettings
/// ControlPlane to communicate with VmAgent.
/// </summary>
public DateTimeOffset? ShutdownRequestedNotBefore { get; set; }

/// <summary>
/// List of disallowed executables.
/// </summary>
public IReadOnlyCollection<string> DisallowedExecutables { get; set; }
}
}

0 comments on commit 4ee54c1

Please sign in to comment.