* update: add migration for gcp_trigger table, add cli method gcp and add gcp_trigger args for github ci * update: add gcp module and routing it in lib.rs * update: added gcp type to TRIGGER KIND type in db, add new feature condition to try_get_fn and added gcp_trigger feature in cargo file * update: add ui for gcp trigger, added missing triggers type for job kin, add gcp trigger in deploy to functionallity * adding google cloud crate * update: handle pull and push delivery * update: handle pull and push delivery * update: handle push event, changed front ui * update: ui * fix: capture for gcp * update: automatically manage pub sub subscription and refactoring * capture done * update cli types * fix: wrong func argument and type openapi * fix: missing import * update .sqlx * update: svg color and remove pulse button for capture push gcp * update: handle deployto * update script helper and link to hub gcp script/flow * update gcp representation * update: add confirmation modal * add unique index to mitigate same subscriber id, fix `zombie worker`, update test connection logic * Update frontend/src/lib/components/triggers/gcp/GcpTriggerEditorInner.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update cli/gen/services.gen.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * nits * update repo ref * fix feature function * update dependencies * update .sqlx * fix missing import * update: handle existing subscription and creating new one or update it * fix ee build * handle existing config properly * update .sqlx * update .sqlx * remove unused * update documentation link fix ci * use on instance of empty_string_as_none fn * update refo ref * updat script_helper * update ui * update migration * add missing arguments * fix and nits * update repo ref * remove unused * nits * add doc links * nits * Update frontend/src/lib/components/triggers/gcp/GcpTriggerPanel.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update frontend/src/lib/components/triggers/gcp/GcpTriggerEditorInner.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * use trigger path as default route path * update .sqlx * update repo ref * update ref * update route path * update types * fix deploy to * nits * update repo ref * update .sqlx * Update frontend/src/lib/components/triggers/gcp/GcpTriggerEditorConfigSection.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * nits * nits * nits * remove dupliacte fn and update repo ref * remove unused import * fix missing import * fix: wong name var * update script helper and template script * Update frontend/src/lib/script_helpers.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update ee-repo-ref.txt --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: HugoCasa <hugo@casademont.ch>
80 lines
4.8 KiB
SQL
80 lines
4.8 KiB
SQL
-- Add up migration script here
|
|
|
|
ALTER TYPE TRIGGER_KIND ADD VALUE IF NOT EXISTS 'gcp';
|
|
CREATE TYPE DELIVERY_MODE AS ENUM ('push', 'pull');
|
|
|
|
CREATE TABLE gcp_trigger (
|
|
gcp_resource_path VARCHAR(255) NOT NULL,
|
|
topic_id VARCHAR(255) NOT NULL CHECK (
|
|
CHAR_LENGTH(topic_id) BETWEEN 3 AND 255
|
|
),
|
|
subscription_id VARCHAR(255) NOT NULL CHECK (
|
|
CHAR_LENGTH(subscription_id) BETWEEN 3 AND 255
|
|
),
|
|
delivery_type DELIVERY_MODE NOT NULL,
|
|
delivery_config JSONB NULL CHECK (delivery_type != 'push'::DELIVERY_MODE OR (delivery_config IS NOT NULL)),
|
|
path VARCHAR(255) NOT NULL,
|
|
script_path VARCHAR(255) NOT NULL,
|
|
is_flow BOOLEAN NOT NULL,
|
|
workspace_id VARCHAR(50) NOT NULL,
|
|
edited_by VARCHAR(50) NOT NULL,
|
|
email VARCHAR(255) NOT NULL,
|
|
edited_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
extra_perms JSONB NOT NULL DEFAULT '{}',
|
|
server_id VARCHAR(50),
|
|
last_server_ping TIMESTAMPTZ,
|
|
error TEXT,
|
|
enabled BOOLEAN NOT NULL,
|
|
PRIMARY KEY (path, workspace_id)
|
|
);
|
|
|
|
CREATE UNIQUE INDEX unique_subscription_per_gcp_resource
|
|
ON gcp_trigger (subscription_id, gcp_resource_path, workspace_id);
|
|
|
|
GRANT ALL ON gcp_trigger TO windmill_user;
|
|
GRANT ALL ON gcp_trigger TO windmill_admin;
|
|
|
|
ALTER TABLE gcp_trigger ENABLE ROW LEVEL SECURITY;
|
|
|
|
CREATE POLICY admin_policy ON gcp_trigger FOR ALL TO windmill_admin USING (true);
|
|
|
|
CREATE POLICY see_folder_extra_perms_user_select ON gcp_trigger FOR SELECT TO windmill_user
|
|
USING (SPLIT_PART(gcp_trigger.path, '/', 1) = 'f' AND SPLIT_PART(gcp_trigger.path, '/', 2) = any(regexp_split_to_array(current_setting('session.folders_read'), ',')::text[]));
|
|
CREATE POLICY see_folder_extra_perms_user_insert ON gcp_trigger FOR INSERT TO windmill_user
|
|
WITH CHECK (SPLIT_PART(gcp_trigger.path, '/', 1) = 'f' AND SPLIT_PART(gcp_trigger.path, '/', 2) = any(regexp_split_to_array(current_setting('session.folders_write'), ',')::text[]));
|
|
CREATE POLICY see_folder_extra_perms_user_update ON gcp_trigger FOR UPDATE TO windmill_user
|
|
USING (SPLIT_PART(gcp_trigger.path, '/', 1) = 'f' AND SPLIT_PART(gcp_trigger.path, '/', 2) = any(regexp_split_to_array(current_setting('session.folders_write'), ',')::text[]));
|
|
CREATE POLICY see_folder_extra_perms_user_delete ON gcp_trigger FOR DELETE TO windmill_user
|
|
USING (SPLIT_PART(gcp_trigger.path, '/', 1) = 'f' AND SPLIT_PART(gcp_trigger.path, '/', 2) = any(regexp_split_to_array(current_setting('session.folders_write'), ',')::text[]));
|
|
|
|
CREATE POLICY see_own ON gcp_trigger FOR ALL TO windmill_user
|
|
USING (SPLIT_PART(gcp_trigger.path, '/', 1) = 'u' AND SPLIT_PART(gcp_trigger.path, '/', 2) = current_setting('session.user'));
|
|
CREATE POLICY see_member ON gcp_trigger FOR ALL TO windmill_user
|
|
USING (SPLIT_PART(gcp_trigger.path, '/', 1) = 'g' AND SPLIT_PART(gcp_trigger.path, '/', 2) = any(regexp_split_to_array(current_setting('session.groups'), ',')::text[]));
|
|
|
|
CREATE POLICY see_extra_perms_user_select ON gcp_trigger FOR SELECT TO windmill_user
|
|
USING (extra_perms ? CONCAT('u/', current_setting('session.user')));
|
|
CREATE POLICY see_extra_perms_user_insert ON gcp_trigger FOR INSERT TO windmill_user
|
|
WITH CHECK ((extra_perms ->> CONCAT('u/', current_setting('session.user')))::boolean);
|
|
CREATE POLICY see_extra_perms_user_update ON gcp_trigger FOR UPDATE TO windmill_user
|
|
USING ((extra_perms ->> CONCAT('u/', current_setting('session.user')))::boolean);
|
|
CREATE POLICY see_extra_perms_user_delete ON gcp_trigger FOR DELETE TO windmill_user
|
|
USING ((extra_perms ->> CONCAT('u/', current_setting('session.user')))::boolean);
|
|
|
|
CREATE POLICY see_extra_perms_groups_select ON gcp_trigger FOR SELECT TO windmill_user
|
|
USING (extra_perms ?| regexp_split_to_array(current_setting('session.pgroups'), ',')::text[]);
|
|
CREATE POLICY see_extra_perms_groups_insert ON gcp_trigger FOR INSERT TO windmill_user
|
|
WITH CHECK (exists(
|
|
SELECT key, value FROM jsonb_each_text(extra_perms)
|
|
WHERE SPLIT_PART(key, '/', 1) = 'g' AND key = ANY(regexp_split_to_array(current_setting('session.pgroups'), ',')::text[])
|
|
AND value::boolean));
|
|
CREATE POLICY see_extra_perms_groups_update ON gcp_trigger FOR UPDATE TO windmill_user
|
|
USING (exists(
|
|
SELECT key, value FROM jsonb_each_text(extra_perms)
|
|
WHERE SPLIT_PART(key, '/', 1) = 'g' AND key = ANY(regexp_split_to_array(current_setting('session.pgroups'), ',')::text[])
|
|
AND value::boolean));
|
|
CREATE POLICY see_extra_perms_groups_delete ON gcp_trigger FOR DELETE TO windmill_user
|
|
USING (exists(
|
|
SELECT key, value FROM jsonb_each_text(extra_perms)
|
|
WHERE SPLIT_PART(key, '/', 1) = 'g' AND key = ANY(regexp_split_to_array(current_setting('session.pgroups'), ',')::text[])
|
|
AND value::boolean)); |