ConvertWorkspaceAgent anonymizes a workspace agent.
(agent database.WorkspaceAgent)
| 1202 | |
| 1203 | // ConvertWorkspaceAgent anonymizes a workspace agent. |
| 1204 | func ConvertWorkspaceAgent(agent database.WorkspaceAgent) WorkspaceAgent { |
| 1205 | subsystems := []string{} |
| 1206 | for _, subsystem := range agent.Subsystems { |
| 1207 | subsystems = append(subsystems, string(subsystem)) |
| 1208 | } |
| 1209 | |
| 1210 | snapAgent := WorkspaceAgent{ |
| 1211 | ID: agent.ID, |
| 1212 | CreatedAt: agent.CreatedAt, |
| 1213 | ResourceID: agent.ResourceID, |
| 1214 | InstanceAuth: agent.AuthInstanceID.Valid, |
| 1215 | Architecture: agent.Architecture, |
| 1216 | OperatingSystem: agent.OperatingSystem, |
| 1217 | EnvironmentVariables: agent.EnvironmentVariables.Valid, |
| 1218 | Directory: agent.Directory != "", |
| 1219 | ConnectionTimeoutSeconds: agent.ConnectionTimeoutSeconds, |
| 1220 | Subsystems: subsystems, |
| 1221 | } |
| 1222 | if agent.FirstConnectedAt.Valid { |
| 1223 | snapAgent.FirstConnectedAt = &agent.FirstConnectedAt.Time |
| 1224 | } |
| 1225 | if agent.LastConnectedAt.Valid { |
| 1226 | snapAgent.LastConnectedAt = &agent.LastConnectedAt.Time |
| 1227 | } |
| 1228 | if agent.DisconnectedAt.Valid { |
| 1229 | snapAgent.DisconnectedAt = &agent.DisconnectedAt.Time |
| 1230 | } |
| 1231 | return snapAgent |
| 1232 | } |
| 1233 | |
| 1234 | func ConvertWorkspaceAgentMemoryResourceMonitor(monitor database.WorkspaceAgentMemoryResourceMonitor) WorkspaceAgentMemoryResourceMonitor { |
| 1235 | return WorkspaceAgentMemoryResourceMonitor{ |
no outgoing calls
no test coverage detected