feat: add keys to organization provision daemons (#14627)

This commit is contained in:
Garrett Delfosse
2024-09-16 20:02:08 +00:00
committed by GitHub
parent 4afce19fb7
commit 335eb05223
32 changed files with 728 additions and 72 deletions
@@ -33,7 +33,8 @@ INSERT INTO
last_seen_at,
"version",
organization_id,
api_version
api_version,
key_id
)
VALUES (
gen_random_uuid(),
@@ -44,14 +45,16 @@ VALUES (
@last_seen_at,
@version,
@organization_id,
@api_version
@api_version,
@key_id
) ON CONFLICT("organization_id", "name", LOWER(COALESCE(tags ->> 'owner'::text, ''::text))) DO UPDATE SET
provisioners = @provisioners,
tags = @tags,
last_seen_at = @last_seen_at,
"version" = @version,
api_version = @api_version,
organization_id = @organization_id
organization_id = @organization_id,
key_id = @key_id
RETURNING *;
-- name: UpdateProvisionerDaemonLastSeenAt :exec
@@ -37,6 +37,23 @@ WHERE
AND
lower(name) = lower(@name);
-- name: ListProvisionerKeysByOrganizationExcludeReserved :many
SELECT
*
FROM
provisioner_keys
WHERE
organization_id = $1
AND
-- exclude reserved built-in key
id != '00000000-0000-0000-0000-000000000001'::uuid
AND
-- exclude reserved user-auth key
id != '00000000-0000-0000-0000-000000000002'::uuid
AND
-- exclude reserved psk key
id != '00000000-0000-0000-0000-000000000003'::uuid;
-- name: ListProvisionerKeysByOrganization :many
SELECT
*