|
|
|
@ -3240,7 +3240,7 @@ func (q *sqlQuerier) GetTemplateAverageBuildTime(ctx context.Context, arg GetTem
|
|
|
|
|
|
|
|
|
|
const getTemplateByID = `-- name: GetTemplateByID :one
|
|
|
|
|
SELECT
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
FROM
|
|
|
|
|
templates
|
|
|
|
|
WHERE
|
|
|
|
@ -3274,13 +3274,14 @@ func (q *sqlQuerier) GetTemplateByID(ctx context.Context, id uuid.UUID) (Templat
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getTemplateByOrganizationAndName = `-- name: GetTemplateByOrganizationAndName :one
|
|
|
|
|
SELECT
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
FROM
|
|
|
|
|
templates
|
|
|
|
|
WHERE
|
|
|
|
@ -3322,12 +3323,13 @@ func (q *sqlQuerier) GetTemplateByOrganizationAndName(ctx context.Context, arg G
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getTemplates = `-- name: GetTemplates :many
|
|
|
|
|
SELECT id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl FROM templates
|
|
|
|
|
SELECT id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl FROM templates
|
|
|
|
|
ORDER BY (name, id) ASC
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
@ -3362,6 +3364,7 @@ func (q *sqlQuerier) GetTemplates(ctx context.Context) ([]Template, error) {
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -3378,7 +3381,7 @@ func (q *sqlQuerier) GetTemplates(ctx context.Context) ([]Template, error) {
|
|
|
|
|
|
|
|
|
|
const getTemplatesWithFilter = `-- name: GetTemplatesWithFilter :many
|
|
|
|
|
SELECT
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
FROM
|
|
|
|
|
templates
|
|
|
|
|
WHERE
|
|
|
|
@ -3450,6 +3453,7 @@ func (q *sqlQuerier) GetTemplatesWithFilter(ctx context.Context, arg GetTemplate
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
@ -3483,7 +3487,7 @@ INSERT INTO
|
|
|
|
|
allow_user_cancel_workspace_jobs
|
|
|
|
|
)
|
|
|
|
|
VALUES
|
|
|
|
|
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) RETURNING id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) RETURNING id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type InsertTemplateParams struct {
|
|
|
|
@ -3543,6 +3547,7 @@ func (q *sqlQuerier) InsertTemplate(ctx context.Context, arg InsertTemplateParam
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@ -3556,7 +3561,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $3
|
|
|
|
|
RETURNING
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateTemplateACLByIDParams struct {
|
|
|
|
@ -3590,6 +3595,7 @@ func (q *sqlQuerier) UpdateTemplateACLByID(ctx context.Context, arg UpdateTempla
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@ -3649,7 +3655,7 @@ SET
|
|
|
|
|
WHERE
|
|
|
|
|
id = $1
|
|
|
|
|
RETURNING
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateTemplateMetaByIDParams struct {
|
|
|
|
@ -3695,6 +3701,7 @@ func (q *sqlQuerier) UpdateTemplateMetaByID(ctx context.Context, arg UpdateTempl
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@ -3709,11 +3716,12 @@ SET
|
|
|
|
|
default_ttl = $5,
|
|
|
|
|
max_ttl = $6,
|
|
|
|
|
failure_ttl = $7,
|
|
|
|
|
inactivity_ttl = $8
|
|
|
|
|
inactivity_ttl = $8,
|
|
|
|
|
locked_ttl = $9
|
|
|
|
|
WHERE
|
|
|
|
|
id = $1
|
|
|
|
|
RETURNING
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl
|
|
|
|
|
id, created_at, updated_at, organization_id, deleted, name, provisioner, active_version_id, description, default_ttl, created_by, icon, user_acl, group_acl, display_name, allow_user_cancel_workspace_jobs, max_ttl, allow_user_autostart, allow_user_autostop, failure_ttl, inactivity_ttl, locked_ttl
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type UpdateTemplateScheduleByIDParams struct {
|
|
|
|
@ -3725,6 +3733,7 @@ type UpdateTemplateScheduleByIDParams struct {
|
|
|
|
|
MaxTTL int64 `db:"max_ttl" json:"max_ttl"`
|
|
|
|
|
FailureTTL int64 `db:"failure_ttl" json:"failure_ttl"`
|
|
|
|
|
InactivityTTL int64 `db:"inactivity_ttl" json:"inactivity_ttl"`
|
|
|
|
|
LockedTTL int64 `db:"locked_ttl" json:"locked_ttl"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *sqlQuerier) UpdateTemplateScheduleByID(ctx context.Context, arg UpdateTemplateScheduleByIDParams) (Template, error) {
|
|
|
|
@ -3737,6 +3746,7 @@ func (q *sqlQuerier) UpdateTemplateScheduleByID(ctx context.Context, arg UpdateT
|
|
|
|
|
arg.MaxTTL,
|
|
|
|
|
arg.FailureTTL,
|
|
|
|
|
arg.InactivityTTL,
|
|
|
|
|
arg.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
var i Template
|
|
|
|
|
err := row.Scan(
|
|
|
|
@ -3761,6 +3771,7 @@ func (q *sqlQuerier) UpdateTemplateScheduleByID(ctx context.Context, arg UpdateT
|
|
|
|
|
&i.AllowUserAutostop,
|
|
|
|
|
&i.FailureTTL,
|
|
|
|
|
&i.InactivityTTL,
|
|
|
|
|
&i.LockedTTL,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
|