(ctx context.Context, arg database.UpsertWorkspaceAppParams)
| 8388 | } |
| 8389 | |
| 8390 | func (q *querier) UpsertWorkspaceApp(ctx context.Context, arg database.UpsertWorkspaceAppParams) (database.WorkspaceApp, error) { |
| 8391 | // NOTE(DanielleMaywood): |
| 8392 | // It is possible for there to exist an agent without a workspace. |
| 8393 | // This means that we want to allow execution to continue if |
| 8394 | // there isn't a workspace found to allow this behavior to continue. |
| 8395 | workspace, err := q.db.GetWorkspaceByAgentID(ctx, arg.AgentID) |
| 8396 | if err != nil && !errors.Is(err, sql.ErrNoRows) { |
| 8397 | return database.WorkspaceApp{}, err |
| 8398 | } |
| 8399 | |
| 8400 | if err := q.authorizeContext(ctx, policy.ActionUpdate, workspace); err != nil { |
| 8401 | return database.WorkspaceApp{}, err |
| 8402 | } |
| 8403 | |
| 8404 | return q.db.UpsertWorkspaceApp(ctx, arg) |
| 8405 | } |
| 8406 | |
| 8407 | func (q *querier) UpsertWorkspaceAppAuditSession(ctx context.Context, arg database.UpsertWorkspaceAppAuditSessionParams) (bool, error) { |
| 8408 | if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceSystem); err != nil { |
nothing calls this directly
no test coverage detected