(ctx context.Context, arg database.InsertWorkspaceParams)
| 5905 | } |
| 5906 | |
| 5907 | func (q *querier) InsertWorkspace(ctx context.Context, arg database.InsertWorkspaceParams) (database.WorkspaceTable, error) { |
| 5908 | obj := rbac.ResourceWorkspace.WithOwner(arg.OwnerID.String()).InOrg(arg.OrganizationID) |
| 5909 | tpl, err := q.GetTemplateByID(ctx, arg.TemplateID) |
| 5910 | if err != nil { |
| 5911 | return database.WorkspaceTable{}, xerrors.Errorf("verify template by id: %w", err) |
| 5912 | } |
| 5913 | if err := q.authorizeContext(ctx, policy.ActionUse, tpl); err != nil { |
| 5914 | return database.WorkspaceTable{}, xerrors.Errorf("use template for workspace: %w", err) |
| 5915 | } |
| 5916 | |
| 5917 | return insert(q.log, q.auth, obj, q.db.InsertWorkspace)(ctx, arg) |
| 5918 | } |
| 5919 | |
| 5920 | func (q *querier) InsertWorkspaceAgent(ctx context.Context, arg database.InsertWorkspaceAgentParams) (database.WorkspaceAgent, error) { |
| 5921 | // NOTE(DanielleMaywood): |
nothing calls this directly
no test coverage detected