IsExternalWorkspaceAgent reports whether agent belongs to an external resource.
(ctx context.Context, db database.Store, agent database.WorkspaceAgent)
| 36 | // IsExternalWorkspaceAgent reports whether agent belongs to an external |
| 37 | // resource. |
| 38 | func IsExternalWorkspaceAgent(ctx context.Context, db database.Store, agent database.WorkspaceAgent) (bool, error) { |
| 39 | if db == nil || agent.ResourceID == uuid.Nil { |
| 40 | return false, nil |
| 41 | } |
| 42 | resource, err := db.GetWorkspaceResourceByID(ctx, agent.ResourceID) |
| 43 | if err != nil { |
| 44 | return false, err |
| 45 | } |
| 46 | return resource.Type == ExternalAgentResourceType, nil |
| 47 | } |
no test coverage detected