feat(host): Add host set information to static host (#1828)

* feat(host): Add host set information to static host

Updates LookupHost and ListHost API to include sets a static host is part of, as like with plugin hosts.

* test: updated TestList_Plugin and TestCrud to be more consistent under race conditions
This commit is contained in:
Haotian authored and GitHub committed 2022-02-01 10:06:13 -08:00
1 parent 84f6cc698c
commit fa00a06bef
9 files changed
+305 -35

No files matched your search

@@ -0,0 +1,24 @@
begin;
-- static_host_with_set_memberships is used for associating a static host instance with all its related host sets
-- in the set_ids column. Currently there are no size limits.
create view static_host_with_set_memberships as
select
h.public_id,
h.create_time,
h.update_time,
h.name,
h.description,
h.catalog_id,
h.address,
h.version,
-- the string_agg(..) column will be null if there are no associated value objects
string_agg(distinct hsm.set_id, '|') as set_ids
from
static_host h
left outer join static_host_set_member hsm on h.public_id = hsm.host_id
group by h.public_id;
comment on view static_host_with_set_memberships is
'static host with its associated host sets';
commit;