Add base types for host catalog, host set, and host (#272)
* Move static host migrations to higher number * Add wt_host_address domain type * Add base tables for host catalog, host set, and host * Reformat create trigger statements * Add subtype triggers for host catalog, host set, and host * Remove wt_host_address domain type * Rename columns in host_set_member * Add delete trigger functions for base types * Add delete after triggers to static host subtypes * Add protobufs for host base types
This commit is contained in:
1 parent
7b36571788
commit
7d133878be
19 files changed
+1324
-433
No files matched your search
@@ -78,6 +78,7 @@ protobuild:
|
||||
@protoc-go-inject-tag -input=./internal/iam/store/scope.pb.go
|
||||
@protoc-go-inject-tag -input=./internal/iam/store/group.pb.go
|
||||
@protoc-go-inject-tag -input=./internal/db/db_test/db_test.pb.go
|
||||
@protoc-go-inject-tag -input=./internal/host/store/host.pb.go
|
||||
@protoc-go-inject-tag -input=./internal/host/static/store/static.pb.go
|
||||
@protoc-go-inject-tag -input=./internal/authtoken/store/authtoken.pb.go
|
||||
@protoc-go-inject-tag -input=./internal/auth/store/account.pb.go
|
||||
|
||||
@@ -1366,169 +1366,6 @@ insert on servers
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/10_static_host.down.sql": {
|
||||
name: "10_static_host.down.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
drop table static_host_set_member cascade;
|
||||
drop table static_host_set cascade;
|
||||
drop table static_host cascade;
|
||||
drop table static_host_catalog cascade;
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/10_static_host.up.sql": {
|
||||
name: "10_static_host.up.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
create table static_host_catalog (
|
||||
public_id wt_public_id primary key,
|
||||
scope_id wt_scope_id not null
|
||||
references iam_scope (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(scope_id, name)
|
||||
);
|
||||
|
||||
create trigger
|
||||
update_version_column
|
||||
after update on static_host_catalog
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger
|
||||
update_time_column
|
||||
before update on static_host_catalog
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on static_host_catalog
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host_catalog
|
||||
for each row execute procedure immutable_columns('public_id', 'scope_id','create_time');
|
||||
|
||||
create table static_host (
|
||||
public_id wt_public_id primary key,
|
||||
static_host_catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
address text not null
|
||||
check(
|
||||
length(trim(address)) > 7
|
||||
and
|
||||
length(trim(address)) < 256
|
||||
),
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(static_host_catalog_id, name)
|
||||
);
|
||||
|
||||
create trigger
|
||||
update_version_column
|
||||
after update on static_host
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger
|
||||
update_time_column
|
||||
before update on static_host
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on static_host
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host
|
||||
for each row execute procedure immutable_columns('public_id', 'static_host_catalog_id','create_time');
|
||||
|
||||
create table static_host_set (
|
||||
public_id wt_public_id primary key,
|
||||
static_host_catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(static_host_catalog_id, name)
|
||||
);
|
||||
|
||||
create trigger
|
||||
update_version_column
|
||||
after update on static_host_set
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger
|
||||
update_time_column
|
||||
before update on static_host_set
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on static_host_set
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host_set
|
||||
for each row execute procedure immutable_columns('public_id', 'static_host_catalog_id','create_time');
|
||||
|
||||
create table static_host_set_member (
|
||||
static_host_set_id wt_public_id
|
||||
references static_host_set (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
static_host_id wt_public_id
|
||||
references static_host (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
primary key(static_host_set_id, static_host_id)
|
||||
);
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host_set_member
|
||||
for each row execute procedure immutable_columns('static_host_set_id', 'static_host_id');
|
||||
|
||||
insert into oplog_ticket (name, version)
|
||||
values
|
||||
('static_host_catalog', 1),
|
||||
('static_host', 1),
|
||||
('static_host_set', 1),
|
||||
('static_host_set_member', 1);
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/11_auth_token.down.sql": {
|
||||
@@ -2185,6 +2022,432 @@ begin;
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/20_host.down.sql": {
|
||||
name: "20_host.down.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
drop table host_set;
|
||||
drop table host;
|
||||
drop table host_catalog;
|
||||
|
||||
drop function insert_host_set_subtype;
|
||||
drop function insert_host_subtype;
|
||||
drop function insert_host_catalog_subtype;
|
||||
|
||||
delete
|
||||
from oplog_ticket
|
||||
where name in (
|
||||
'host_catalog',
|
||||
'host',
|
||||
'host_set'
|
||||
);
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/20_host.up.sql": {
|
||||
name: "20_host.up.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
/*
|
||||
|
||||
┌─────────────────┐
|
||||
│ host │
|
||||
├─────────────────┤
|
||||
│ public_id (pk) │
|
||||
│ catalog_id (fk) │
|
||||
│ │
|
||||
└─────────────────┘
|
||||
╲│╱
|
||||
○
|
||||
│
|
||||
┼
|
||||
┼
|
||||
┌─────────────────┐ ┌─────────────────┐
|
||||
│ iam_scope │ │ host_catalog │
|
||||
├─────────────────┤ ├─────────────────┤
|
||||
│ public_id (pk) │ ╱│ public_id (pk) │
|
||||
│ │┼┼──────○─│ scope_id (fk) │
|
||||
│ │ ╲│ │
|
||||
└─────────────────┘ └─────────────────┘
|
||||
┼
|
||||
┼
|
||||
│
|
||||
○
|
||||
╱│╲
|
||||
┌─────────────────┐
|
||||
│ host_set │
|
||||
├─────────────────┤
|
||||
│ public_id (pk) │
|
||||
│ catalog_id (fk) │
|
||||
│ │
|
||||
└─────────────────┘
|
||||
|
||||
*/
|
||||
|
||||
-- host_catalog
|
||||
create table host_catalog (
|
||||
public_id wt_public_id primary key,
|
||||
scope_id wt_scope_id not null
|
||||
references iam_scope (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
|
||||
-- The order of columns is important for performance. See:
|
||||
-- https://dba.stackexchange.com/questions/58970/enforcing-constraints-two-tables-away/58972#58972
|
||||
-- https://dba.stackexchange.com/questions/27481/is-a-composite-index-also-good-for-queries-on-the-first-field
|
||||
unique(scope_id, public_id)
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on host_catalog
|
||||
for each row execute procedure immutable_columns('public_id', 'scope_id');
|
||||
|
||||
-- insert_host_catalog_subtype() is a before insert trigger
|
||||
-- function for subtypes of host_catalog
|
||||
create or replace function insert_host_catalog_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into host_catalog
|
||||
(public_id, scope_id)
|
||||
values
|
||||
(new.public_id, new.scope_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- delete_host_catalog_subtype() is an after delete trigger
|
||||
-- function for subtypes of host_catalog
|
||||
create or replace function delete_host_catalog_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
delete from host_catalog
|
||||
where public_id = old.public_id;
|
||||
return null; -- result is ignored since this is an after trigger
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- host
|
||||
create table host (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on host
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id');
|
||||
|
||||
-- insert_host_subtype() is a before insert trigger
|
||||
-- function for subtypes of host
|
||||
create or replace function insert_host_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into host
|
||||
(public_id, catalog_id)
|
||||
values
|
||||
(new.public_id, new.catalog_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- delete_host_subtype() is an after delete trigger
|
||||
-- function for subtypes of host
|
||||
create or replace function delete_host_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
delete from host
|
||||
where public_id = old.public_id;
|
||||
return null; -- result is ignored since this is an after trigger
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- host_set
|
||||
create table host_set (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on host_set
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id');
|
||||
|
||||
-- insert_host_set_subtype() is a before insert trigger
|
||||
-- function for subtypes of host_set
|
||||
create or replace function insert_host_set_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into host_set
|
||||
(public_id, catalog_id)
|
||||
values
|
||||
(new.public_id, new.catalog_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- delete_host_set_subtype() is an after delete trigger
|
||||
-- function for subtypes of host_set
|
||||
create or replace function delete_host_set_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
delete from host_set
|
||||
where public_id = old.public_id;
|
||||
return null; -- result is ignored since this is an after trigger
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
insert into oplog_ticket (name, version)
|
||||
values
|
||||
('host_catalog', 1),
|
||||
('host', 1),
|
||||
('host_set', 1);
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/22_static_host.down.sql": {
|
||||
name: "22_static_host.down.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
drop table static_host_set_member cascade;
|
||||
drop table static_host_set cascade;
|
||||
drop table static_host cascade;
|
||||
drop table static_host_catalog cascade;
|
||||
|
||||
delete
|
||||
from oplog_ticket
|
||||
where name in (
|
||||
'static_host_catalog',
|
||||
'static_host',
|
||||
'static_host_set',
|
||||
'static_host_set_member'
|
||||
);
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/22_static_host.up.sql": {
|
||||
name: "22_static_host.up.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
/*
|
||||
|
||||
┌─────────────────┐ ┌─────────────────────┐
|
||||
│ host │ │ static_host │
|
||||
├─────────────────┤ ├─────────────────────┤
|
||||
│ public_id (pk) │ │ public_id (pk) │
|
||||
│ catalog_id (fk) │┼┼──────○┼│ catalog_id (fk) │┼┼─────────────────────┐
|
||||
│ │ │ address │ ◀fk1 │
|
||||
└─────────────────┘ └─────────────────────┘ │
|
||||
╲│╱ ╲│╱ │
|
||||
○ ○ │
|
||||
│ │ │
|
||||
┼ ┼ ○
|
||||
┼ ┼ ╱│╲
|
||||
┌─────────────────┐ ┌─────────────────────┐ ┌────────────────────────┐
|
||||
│ host_catalog │ │ static_host_catalog │ │ static_host_set_member │
|
||||
├─────────────────┤ ├─────────────────────┤ ├────────────────────────┤
|
||||
│ public_id (pk) │ │ public_id (pk) │ │ host_id (pk,fk1) │
|
||||
│ scope_id (fk) │┼┼──────○┼│ scope_id (fk) │ │ set_id (pk,fk2) │
|
||||
│ │ │ │ │ catalog_id (fk1,fk2) │
|
||||
└─────────────────┘ └─────────────────────┘ └────────────────────────┘
|
||||
┼ ┼ ╲│╱
|
||||
┼ ┼ ○
|
||||
│ │ │
|
||||
○ ○ │
|
||||
╱│╲ ╱│╲ │
|
||||
┌─────────────────┐ ┌─────────────────────┐ │
|
||||
│ host_set │ │ static_host_set │ │
|
||||
├─────────────────┤ ├─────────────────────┤ │
|
||||
│ public_id (pk) │ │ public_id (pk) │ ◀fk2 │
|
||||
│ catalog_id (fk) │┼┼──────○┼│ catalog_id (fk) │┼┼─────────────────────┘
|
||||
│ │ │ │
|
||||
└─────────────────┘ └─────────────────────┘
|
||||
|
||||
*/
|
||||
|
||||
create table static_host_catalog (
|
||||
public_id wt_public_id primary key,
|
||||
scope_id wt_scope_id not null
|
||||
references iam_scope (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
foreign key (scope_id, public_id)
|
||||
references host_catalog (scope_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(scope_id, name)
|
||||
);
|
||||
|
||||
create trigger update_version_column after update on static_host_catalog
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger update_time_column before update on static_host_catalog
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger default_create_time_column before insert on static_host_catalog
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger immutable_columns before update on static_host_catalog
|
||||
for each row execute procedure immutable_columns('public_id', 'scope_id','create_time');
|
||||
|
||||
create trigger insert_host_catalog_subtype before insert on static_host_catalog
|
||||
for each row execute procedure insert_host_catalog_subtype();
|
||||
|
||||
create trigger delete_host_catalog_subtype after delete on static_host_catalog
|
||||
for each row execute procedure delete_host_catalog_subtype();
|
||||
|
||||
create table static_host (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
address text not null
|
||||
check(
|
||||
length(trim(address)) > 7
|
||||
and
|
||||
length(trim(address)) < 256
|
||||
),
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(catalog_id, name),
|
||||
|
||||
foreign key (catalog_id, public_id)
|
||||
references host (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
|
||||
-- The order of columns is important for performance. See:
|
||||
-- https://dba.stackexchange.com/questions/58970/enforcing-constraints-two-tables-away/58972#58972
|
||||
-- https://dba.stackexchange.com/questions/27481/is-a-composite-index-also-good-for-queries-on-the-first-field
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger update_version_column after update on static_host
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger update_time_column before update on static_host
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger default_create_time_column before insert on static_host
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger immutable_columns before update on static_host
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id','create_time');
|
||||
|
||||
create trigger insert_host_subtype before insert on static_host
|
||||
for each row execute procedure insert_host_subtype();
|
||||
|
||||
create trigger delete_host_subtype after delete on static_host
|
||||
for each row execute procedure delete_host_subtype();
|
||||
|
||||
create table static_host_set (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(catalog_id, name),
|
||||
foreign key (catalog_id, public_id)
|
||||
references host_set (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger update_version_column after update on static_host_set
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger update_time_column before update on static_host_set
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger default_create_time_column before insert on static_host_set
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger immutable_columns before update on static_host_set
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id','create_time');
|
||||
|
||||
create trigger insert_host_set_subtype before insert on static_host_set
|
||||
for each row execute procedure insert_host_set_subtype();
|
||||
|
||||
create trigger delete_host_set_subtype after delete on static_host_set
|
||||
for each row execute procedure delete_host_set_subtype();
|
||||
|
||||
create table static_host_set_member (
|
||||
host_id wt_public_id not null,
|
||||
set_id wt_public_id not null,
|
||||
catalog_id wt_public_id not null,
|
||||
primary key(host_id, set_id),
|
||||
foreign key (catalog_id, host_id) -- fk1
|
||||
references static_host (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
foreign key (catalog_id, set_id) -- fk2
|
||||
references static_host_set (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on static_host_set_member
|
||||
for each row execute procedure immutable_columns('host_id', 'set_id', 'catalog_id');
|
||||
|
||||
create or replace function insert_static_host_set_member()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
select static_host_set.catalog_id
|
||||
into new.catalog_id
|
||||
from static_host_set
|
||||
where static_host_set.public_id = new.set_id;
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create trigger insert_static_host_set_member before insert on static_host_set_member
|
||||
for each row execute procedure insert_static_host_set_member();
|
||||
|
||||
insert into oplog_ticket (name, version)
|
||||
values
|
||||
('static_host_catalog', 1),
|
||||
('static_host', 1),
|
||||
('static_host_set', 1),
|
||||
('static_host_set_member', 1);
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
begin;
|
||||
|
||||
drop table static_host_set_member cascade;
|
||||
drop table static_host_set cascade;
|
||||
drop table static_host cascade;
|
||||
drop table static_host_catalog cascade;
|
||||
|
||||
commit;
|
||||
@@ -1,143 +0,0 @@
|
||||
begin;
|
||||
|
||||
create table static_host_catalog (
|
||||
public_id wt_public_id primary key,
|
||||
scope_id wt_scope_id not null
|
||||
references iam_scope (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(scope_id, name)
|
||||
);
|
||||
|
||||
create trigger
|
||||
update_version_column
|
||||
after update on static_host_catalog
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger
|
||||
update_time_column
|
||||
before update on static_host_catalog
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on static_host_catalog
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host_catalog
|
||||
for each row execute procedure immutable_columns('public_id', 'scope_id','create_time');
|
||||
|
||||
create table static_host (
|
||||
public_id wt_public_id primary key,
|
||||
static_host_catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
address text not null
|
||||
check(
|
||||
length(trim(address)) > 7
|
||||
and
|
||||
length(trim(address)) < 256
|
||||
),
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(static_host_catalog_id, name)
|
||||
);
|
||||
|
||||
create trigger
|
||||
update_version_column
|
||||
after update on static_host
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger
|
||||
update_time_column
|
||||
before update on static_host
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on static_host
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host
|
||||
for each row execute procedure immutable_columns('public_id', 'static_host_catalog_id','create_time');
|
||||
|
||||
create table static_host_set (
|
||||
public_id wt_public_id primary key,
|
||||
static_host_catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(static_host_catalog_id, name)
|
||||
);
|
||||
|
||||
create trigger
|
||||
update_version_column
|
||||
after update on static_host_set
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger
|
||||
update_time_column
|
||||
before update on static_host_set
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on static_host_set
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host_set
|
||||
for each row execute procedure immutable_columns('public_id', 'static_host_catalog_id','create_time');
|
||||
|
||||
create table static_host_set_member (
|
||||
static_host_set_id wt_public_id
|
||||
references static_host_set (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
static_host_id wt_public_id
|
||||
references static_host (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
primary key(static_host_set_id, static_host_id)
|
||||
);
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on static_host_set_member
|
||||
for each row execute procedure immutable_columns('static_host_set_id', 'static_host_id');
|
||||
|
||||
insert into oplog_ticket (name, version)
|
||||
values
|
||||
('static_host_catalog', 1),
|
||||
('static_host', 1),
|
||||
('static_host_set', 1),
|
||||
('static_host_set_member', 1);
|
||||
|
||||
commit;
|
||||
@@ -0,0 +1,19 @@
|
||||
begin;
|
||||
|
||||
drop table host_set;
|
||||
drop table host;
|
||||
drop table host_catalog;
|
||||
|
||||
drop function insert_host_set_subtype;
|
||||
drop function insert_host_subtype;
|
||||
drop function insert_host_catalog_subtype;
|
||||
|
||||
delete
|
||||
from oplog_ticket
|
||||
where name in (
|
||||
'host_catalog',
|
||||
'host',
|
||||
'host_set'
|
||||
);
|
||||
|
||||
commit;
|
||||
@@ -0,0 +1,166 @@
|
||||
begin;
|
||||
|
||||
/*
|
||||
|
||||
┌─────────────────┐
|
||||
│ host │
|
||||
├─────────────────┤
|
||||
│ public_id (pk) │
|
||||
│ catalog_id (fk) │
|
||||
│ │
|
||||
└─────────────────┘
|
||||
╲│╱
|
||||
○
|
||||
│
|
||||
┼
|
||||
┼
|
||||
┌─────────────────┐ ┌─────────────────┐
|
||||
│ iam_scope │ │ host_catalog │
|
||||
├─────────────────┤ ├─────────────────┤
|
||||
│ public_id (pk) │ ╱│ public_id (pk) │
|
||||
│ │┼┼──────○─│ scope_id (fk) │
|
||||
│ │ ╲│ │
|
||||
└─────────────────┘ └─────────────────┘
|
||||
┼
|
||||
┼
|
||||
│
|
||||
○
|
||||
╱│╲
|
||||
┌─────────────────┐
|
||||
│ host_set │
|
||||
├─────────────────┤
|
||||
│ public_id (pk) │
|
||||
│ catalog_id (fk) │
|
||||
│ │
|
||||
└─────────────────┘
|
||||
|
||||
*/
|
||||
|
||||
-- host_catalog
|
||||
create table host_catalog (
|
||||
public_id wt_public_id primary key,
|
||||
scope_id wt_scope_id not null
|
||||
references iam_scope (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
|
||||
-- The order of columns is important for performance. See:
|
||||
-- https://dba.stackexchange.com/questions/58970/enforcing-constraints-two-tables-away/58972#58972
|
||||
-- https://dba.stackexchange.com/questions/27481/is-a-composite-index-also-good-for-queries-on-the-first-field
|
||||
unique(scope_id, public_id)
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on host_catalog
|
||||
for each row execute procedure immutable_columns('public_id', 'scope_id');
|
||||
|
||||
-- insert_host_catalog_subtype() is a before insert trigger
|
||||
-- function for subtypes of host_catalog
|
||||
create or replace function insert_host_catalog_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into host_catalog
|
||||
(public_id, scope_id)
|
||||
values
|
||||
(new.public_id, new.scope_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- delete_host_catalog_subtype() is an after delete trigger
|
||||
-- function for subtypes of host_catalog
|
||||
create or replace function delete_host_catalog_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
delete from host_catalog
|
||||
where public_id = old.public_id;
|
||||
return null; -- result is ignored since this is an after trigger
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- host
|
||||
create table host (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on host
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id');
|
||||
|
||||
-- insert_host_subtype() is a before insert trigger
|
||||
-- function for subtypes of host
|
||||
create or replace function insert_host_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into host
|
||||
(public_id, catalog_id)
|
||||
values
|
||||
(new.public_id, new.catalog_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- delete_host_subtype() is an after delete trigger
|
||||
-- function for subtypes of host
|
||||
create or replace function delete_host_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
delete from host
|
||||
where public_id = old.public_id;
|
||||
return null; -- result is ignored since this is an after trigger
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- host_set
|
||||
create table host_set (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on host_set
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id');
|
||||
|
||||
-- insert_host_set_subtype() is a before insert trigger
|
||||
-- function for subtypes of host_set
|
||||
create or replace function insert_host_set_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into host_set
|
||||
(public_id, catalog_id)
|
||||
values
|
||||
(new.public_id, new.catalog_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
-- delete_host_set_subtype() is an after delete trigger
|
||||
-- function for subtypes of host_set
|
||||
create or replace function delete_host_set_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
delete from host_set
|
||||
where public_id = old.public_id;
|
||||
return null; -- result is ignored since this is an after trigger
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
insert into oplog_ticket (name, version)
|
||||
values
|
||||
('host_catalog', 1),
|
||||
('host', 1),
|
||||
('host_set', 1);
|
||||
|
||||
commit;
|
||||
@@ -0,0 +1,17 @@
|
||||
begin;
|
||||
|
||||
drop table static_host_set_member cascade;
|
||||
drop table static_host_set cascade;
|
||||
drop table static_host cascade;
|
||||
drop table static_host_catalog cascade;
|
||||
|
||||
delete
|
||||
from oplog_ticket
|
||||
where name in (
|
||||
'static_host_catalog',
|
||||
'static_host',
|
||||
'static_host_set',
|
||||
'static_host_set_member'
|
||||
);
|
||||
|
||||
commit;
|
||||
@@ -0,0 +1,200 @@
|
||||
begin;
|
||||
|
||||
/*
|
||||
|
||||
┌─────────────────┐ ┌─────────────────────┐
|
||||
│ host │ │ static_host │
|
||||
├─────────────────┤ ├─────────────────────┤
|
||||
│ public_id (pk) │ │ public_id (pk) │
|
||||
│ catalog_id (fk) │┼┼──────○┼│ catalog_id (fk) │┼┼─────────────────────┐
|
||||
│ │ │ address │ ◀fk1 │
|
||||
└─────────────────┘ └─────────────────────┘ │
|
||||
╲│╱ ╲│╱ │
|
||||
○ ○ │
|
||||
│ │ │
|
||||
┼ ┼ ○
|
||||
┼ ┼ ╱│╲
|
||||
┌─────────────────┐ ┌─────────────────────┐ ┌────────────────────────┐
|
||||
│ host_catalog │ │ static_host_catalog │ │ static_host_set_member │
|
||||
├─────────────────┤ ├─────────────────────┤ ├────────────────────────┤
|
||||
│ public_id (pk) │ │ public_id (pk) │ │ host_id (pk,fk1) │
|
||||
│ scope_id (fk) │┼┼──────○┼│ scope_id (fk) │ │ set_id (pk,fk2) │
|
||||
│ │ │ │ │ catalog_id (fk1,fk2) │
|
||||
└─────────────────┘ └─────────────────────┘ └────────────────────────┘
|
||||
┼ ┼ ╲│╱
|
||||
┼ ┼ ○
|
||||
│ │ │
|
||||
○ ○ │
|
||||
╱│╲ ╱│╲ │
|
||||
┌─────────────────┐ ┌─────────────────────┐ │
|
||||
│ host_set │ │ static_host_set │ │
|
||||
├─────────────────┤ ├─────────────────────┤ │
|
||||
│ public_id (pk) │ │ public_id (pk) │ ◀fk2 │
|
||||
│ catalog_id (fk) │┼┼──────○┼│ catalog_id (fk) │┼┼─────────────────────┘
|
||||
│ │ │ │
|
||||
└─────────────────┘ └─────────────────────┘
|
||||
|
||||
*/
|
||||
|
||||
create table static_host_catalog (
|
||||
public_id wt_public_id primary key,
|
||||
scope_id wt_scope_id not null
|
||||
references iam_scope (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
foreign key (scope_id, public_id)
|
||||
references host_catalog (scope_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(scope_id, name)
|
||||
);
|
||||
|
||||
create trigger update_version_column after update on static_host_catalog
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger update_time_column before update on static_host_catalog
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger default_create_time_column before insert on static_host_catalog
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger immutable_columns before update on static_host_catalog
|
||||
for each row execute procedure immutable_columns('public_id', 'scope_id','create_time');
|
||||
|
||||
create trigger insert_host_catalog_subtype before insert on static_host_catalog
|
||||
for each row execute procedure insert_host_catalog_subtype();
|
||||
|
||||
create trigger delete_host_catalog_subtype after delete on static_host_catalog
|
||||
for each row execute procedure delete_host_catalog_subtype();
|
||||
|
||||
create table static_host (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
address text not null
|
||||
check(
|
||||
length(trim(address)) > 7
|
||||
and
|
||||
length(trim(address)) < 256
|
||||
),
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(catalog_id, name),
|
||||
|
||||
foreign key (catalog_id, public_id)
|
||||
references host (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
|
||||
-- The order of columns is important for performance. See:
|
||||
-- https://dba.stackexchange.com/questions/58970/enforcing-constraints-two-tables-away/58972#58972
|
||||
-- https://dba.stackexchange.com/questions/27481/is-a-composite-index-also-good-for-queries-on-the-first-field
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger update_version_column after update on static_host
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger update_time_column before update on static_host
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger default_create_time_column before insert on static_host
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger immutable_columns before update on static_host
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id','create_time');
|
||||
|
||||
create trigger insert_host_subtype before insert on static_host
|
||||
for each row execute procedure insert_host_subtype();
|
||||
|
||||
create trigger delete_host_subtype after delete on static_host
|
||||
for each row execute procedure delete_host_subtype();
|
||||
|
||||
create table static_host_set (
|
||||
public_id wt_public_id primary key,
|
||||
catalog_id wt_public_id not null
|
||||
references static_host_catalog (public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
name text,
|
||||
description text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
version wt_version,
|
||||
unique(catalog_id, name),
|
||||
foreign key (catalog_id, public_id)
|
||||
references host_set (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
unique(catalog_id, public_id)
|
||||
);
|
||||
|
||||
create trigger update_version_column after update on static_host_set
|
||||
for each row execute procedure update_version_column();
|
||||
|
||||
create trigger update_time_column before update on static_host_set
|
||||
for each row execute procedure update_time_column();
|
||||
|
||||
create trigger default_create_time_column before insert on static_host_set
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger immutable_columns before update on static_host_set
|
||||
for each row execute procedure immutable_columns('public_id', 'catalog_id','create_time');
|
||||
|
||||
create trigger insert_host_set_subtype before insert on static_host_set
|
||||
for each row execute procedure insert_host_set_subtype();
|
||||
|
||||
create trigger delete_host_set_subtype after delete on static_host_set
|
||||
for each row execute procedure delete_host_set_subtype();
|
||||
|
||||
create table static_host_set_member (
|
||||
host_id wt_public_id not null,
|
||||
set_id wt_public_id not null,
|
||||
catalog_id wt_public_id not null,
|
||||
primary key(host_id, set_id),
|
||||
foreign key (catalog_id, host_id) -- fk1
|
||||
references static_host (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade,
|
||||
foreign key (catalog_id, set_id) -- fk2
|
||||
references static_host_set (catalog_id, public_id)
|
||||
on delete cascade
|
||||
on update cascade
|
||||
);
|
||||
|
||||
create trigger immutable_columns before update on static_host_set_member
|
||||
for each row execute procedure immutable_columns('host_id', 'set_id', 'catalog_id');
|
||||
|
||||
create or replace function insert_static_host_set_member()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
select static_host_set.catalog_id
|
||||
into new.catalog_id
|
||||
from static_host_set
|
||||
where static_host_set.public_id = new.set_id;
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create trigger insert_static_host_set_member before insert on static_host_set_member
|
||||
for each row execute procedure insert_static_host_set_member();
|
||||
|
||||
insert into oplog_ticket (name, version)
|
||||
values
|
||||
('static_host_catalog', 1),
|
||||
('static_host', 1),
|
||||
('static_host_set', 1),
|
||||
('static_host_set_member', 1);
|
||||
|
||||
commit;
|
||||
@@ -34,6 +34,6 @@ func ExampleNewHostSetMember() {
|
||||
setPublicId := "sths_11111"
|
||||
hostPublicId := "sth_22222"
|
||||
member, _ := static.NewHostSetMember(setPublicId, hostPublicId)
|
||||
fmt.Println(member.StaticHostSetId)
|
||||
fmt.Println(member.StaticHostId)
|
||||
fmt.Println(member.SetId)
|
||||
fmt.Println(member.HostId)
|
||||
}
|
||||
@@ -27,10 +27,10 @@ func NewHost(catalogId, address string, opt ...Option) (*Host, error) {
|
||||
opts := getOpts(opt...)
|
||||
host := &Host{
|
||||
Host: &store.Host{
|
||||
StaticHostCatalogId: catalogId,
|
||||
Address: address,
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
CatalogId: catalogId,
|
||||
Address: address,
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
},
|
||||
}
|
||||
return host, nil
|
||||
|
||||
@@ -24,9 +24,9 @@ func NewHostSet(catalogId string, opt ...Option) (*HostSet, error) {
|
||||
opts := getOpts(opt...)
|
||||
set := &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
StaticHostCatalogId: catalogId,
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
CatalogId: catalogId,
|
||||
Name: opts.withName,
|
||||
Description: opts.withDescription,
|
||||
},
|
||||
}
|
||||
return set, nil
|
||||
|
||||
@@ -24,8 +24,8 @@ func NewHostSetMember(hostSetId, hostId string, opt ...Option) (*HostSetMember,
|
||||
}
|
||||
member := &HostSetMember{
|
||||
HostSetMember: &store.HostSetMember{
|
||||
StaticHostSetId: hostSetId,
|
||||
StaticHostId: hostId,
|
||||
SetId: hostSetId,
|
||||
HostId: hostId,
|
||||
},
|
||||
}
|
||||
return member, nil
|
||||
|
||||
@@ -42,7 +42,7 @@ func TestHostSet_New(t *testing.T) {
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
CatalogId: cat.GetPublicId(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -56,8 +56,8 @@ func TestHostSet_New(t *testing.T) {
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Name: "test-name",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Name: "test-name",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -71,8 +71,8 @@ func TestHostSet_New(t *testing.T) {
|
||||
},
|
||||
want: &HostSet{
|
||||
HostSet: &store.HostSet{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Description: "test-description",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Description: "test-description",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -55,8 +55,8 @@ func TestHost_New(t *testing.T) {
|
||||
},
|
||||
want: &Host{
|
||||
Host: &store.Host{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Address: "1234567",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Address: "1234567",
|
||||
},
|
||||
},
|
||||
wantWriteErr: true,
|
||||
@@ -69,8 +69,8 @@ func TestHost_New(t *testing.T) {
|
||||
},
|
||||
want: &Host{
|
||||
Host: &store.Host{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Address: "12345678",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Address: "12345678",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -82,8 +82,8 @@ func TestHost_New(t *testing.T) {
|
||||
},
|
||||
want: &Host{
|
||||
Host: &store.Host{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Address: "127.0.0.1",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Address: "127.0.0.1",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -98,9 +98,9 @@ func TestHost_New(t *testing.T) {
|
||||
},
|
||||
want: &Host{
|
||||
Host: &store.Host{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Address: "127.0.0.1",
|
||||
Name: "test-name",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Address: "127.0.0.1",
|
||||
Name: "test-name",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -115,9 +115,9 @@ func TestHost_New(t *testing.T) {
|
||||
},
|
||||
want: &Host{
|
||||
Host: &store.Host{
|
||||
StaticHostCatalogId: cat.GetPublicId(),
|
||||
Address: "127.0.0.1",
|
||||
Description: "test-description",
|
||||
CatalogId: cat.GetPublicId(),
|
||||
Address: "127.0.0.1",
|
||||
Description: "test-description",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -116,10 +116,10 @@ func TestStaticHost_ImmutableFields(t *testing.T) {
|
||||
name: "static_host_catalog_id",
|
||||
update: func() *Host {
|
||||
c := new.testCloneHost()
|
||||
c.StaticHostCatalogId = "stc_01234567890"
|
||||
c.CatalogId = "stc_01234567890"
|
||||
return c
|
||||
}(),
|
||||
fieldMask: []string{"StaticHostCatalogId"},
|
||||
fieldMask: []string{"CatalogId"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -189,10 +189,10 @@ func TestStaticHostSet_ImmutableFields(t *testing.T) {
|
||||
name: "static_host_catalog_id",
|
||||
update: func() *HostSet {
|
||||
c := new.testCloneHostSet()
|
||||
c.StaticHostCatalogId = "stc_01234567890"
|
||||
c.CatalogId = "stc_01234567890"
|
||||
return c
|
||||
}(),
|
||||
fieldMask: []string{"StaticHostCatalogId"},
|
||||
fieldMask: []string{"CatalogId"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -244,22 +244,22 @@ func TestStaticHostSetMember_ImmutableFields(t *testing.T) {
|
||||
fieldMask []string
|
||||
}{
|
||||
{
|
||||
name: "static_host_set_id",
|
||||
name: "set_id",
|
||||
update: func() *HostSetMember {
|
||||
c := new.testCloneHostSetMember()
|
||||
c.StaticHostId = "shs_thisIsNotAValidId"
|
||||
c.HostId = "shs_thisIsNotAValidId"
|
||||
return c
|
||||
}(),
|
||||
fieldMask: []string{"StaticHostSetId"},
|
||||
fieldMask: []string{"SetId"},
|
||||
},
|
||||
{
|
||||
name: "static_host_id",
|
||||
name: "host_id",
|
||||
update: func() *HostSetMember {
|
||||
c := new.testCloneHostSetMember()
|
||||
c.StaticHostId = "sth_01234567890"
|
||||
c.HostId = "sth_01234567890"
|
||||
return c
|
||||
}(),
|
||||
fieldMask: []string{"StaticHostId"},
|
||||
fieldMask: []string{"HostId"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -267,7 +267,7 @@ func TestStaticHostSetMember_ImmutableFields(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
orig := new.testCloneHostSetMember()
|
||||
err = w.LookupWhere(context.Background(), orig, "static_host_id = ? and static_host_set_id = ?", orig.StaticHostId, orig.StaticHostSetId)
|
||||
err = w.LookupWhere(context.Background(), orig, "host_id = ? and set_id = ?", orig.HostId, orig.SetId)
|
||||
require.NoError(err)
|
||||
|
||||
rowsUpdated, err := w.Update(context.Background(), tt.update, tt.fieldMask, nil)
|
||||
@@ -275,7 +275,7 @@ func TestStaticHostSetMember_ImmutableFields(t *testing.T) {
|
||||
assert.Equal(0, rowsUpdated)
|
||||
|
||||
after := new.testCloneHostSetMember()
|
||||
err = w.LookupWhere(context.Background(), after, "static_host_id = ? and static_host_set_id = ?", after.StaticHostId, after.StaticHostSetId)
|
||||
err = w.LookupWhere(context.Background(), after, "host_id = ? and set_id = ?", after.HostId, after.SetId)
|
||||
require.NoError(err)
|
||||
|
||||
assert.True(proto.Equal(orig, after))
|
||||
|
||||
@@ -36,7 +36,7 @@ type HostCatalog struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
PublicId string `protobuf:"bytes,1,opt,name=public_id,json=publicId,proto3" json:"public_id,omitempty" gorm:"primary_key"`
|
||||
// The create_time is set by the database.
|
||||
// @inject_tag: `gorm:"default:current_timestamp"`
|
||||
@@ -51,7 +51,7 @@ type HostCatalog struct {
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" gorm:"default:null"`
|
||||
// The scope_id of the owning scope and must be set.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
ScopeId string `protobuf:"bytes,6,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" gorm:"not_null"`
|
||||
// version allows optimistic locking of the resource
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
@@ -145,7 +145,7 @@ type Host struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
PublicId string `protobuf:"bytes,1,opt,name=public_id,json=publicId,proto3" json:"public_id,omitempty" gorm:"primary_key"`
|
||||
// The create_time is set by the database.
|
||||
// @inject_tag: `gorm:"default:current_timestamp"`
|
||||
@@ -154,19 +154,19 @@ type Host struct {
|
||||
// @inject_tag: `gorm:"default:current_timestamp"`
|
||||
UpdateTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty" gorm:"default:current_timestamp"`
|
||||
// name is optional. If set, it must be unique within
|
||||
// static_host_catalog_id.
|
||||
// catalog_id.
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty" gorm:"default:null"`
|
||||
// description is optional.
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" gorm:"default:null"`
|
||||
// static_host_catalog_id is the public_id of the owning
|
||||
// catalog_id is the public_id of the owning
|
||||
// static_host_catalog and must be set.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
StaticHostCatalogId string `protobuf:"bytes,6,opt,name=static_host_catalog_id,json=staticHostCatalogId,proto3" json:"static_host_catalog_id,omitempty" gorm:"not_null"`
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
CatalogId string `protobuf:"bytes,6,opt,name=catalog_id,json=catalogId,proto3" json:"catalog_id,omitempty" gorm:"not_null"`
|
||||
// address is the IP Address or DNS name of the host. It must be set and
|
||||
// it must be unique within static_host_catalog_id.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
// it must be unique within catalog_id.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address,omitempty" gorm:"not_null"`
|
||||
// version allows optimistic locking of the resource
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
@@ -240,9 +240,9 @@ func (x *Host) GetDescription() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Host) GetStaticHostCatalogId() string {
|
||||
func (x *Host) GetCatalogId() string {
|
||||
if x != nil {
|
||||
return x.StaticHostCatalogId
|
||||
return x.CatalogId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -267,7 +267,7 @@ type HostSet struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
PublicId string `protobuf:"bytes,1,opt,name=public_id,json=publicId,proto3" json:"public_id,omitempty" gorm:"primary_key"`
|
||||
// The create_time is set by the database.
|
||||
// @inject_tag: `gorm:"default:current_timestamp"`
|
||||
@@ -276,16 +276,16 @@ type HostSet struct {
|
||||
// @inject_tag: `gorm:"default:current_timestamp"`
|
||||
UpdateTime *timestamp.Timestamp `protobuf:"bytes,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty" gorm:"default:current_timestamp"`
|
||||
// name is optional. If set, it must be unique within
|
||||
// static_host_catalog_id.
|
||||
// catalog_id.
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty" gorm:"default:null"`
|
||||
// description is optional.
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty" gorm:"default:null"`
|
||||
// static_host_catalog_id is the public_id of the owning
|
||||
// catalog_id is the public_id of the owning
|
||||
// static_host_catalog and must be set.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
StaticHostCatalogId string `protobuf:"bytes,6,opt,name=static_host_catalog_id,json=staticHostCatalogId,proto3" json:"static_host_catalog_id,omitempty" gorm:"not_null"`
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
CatalogId string `protobuf:"bytes,6,opt,name=catalog_id,json=catalogId,proto3" json:"catalog_id,omitempty" gorm:"not_null"`
|
||||
// version allows optimistic locking of the resource
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
Version uint32 `protobuf:"varint,7,opt,name=version,proto3" json:"version,omitempty" gorm:"default:null"`
|
||||
@@ -358,9 +358,9 @@ func (x *HostSet) GetDescription() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HostSet) GetStaticHostCatalogId() string {
|
||||
func (x *HostSet) GetCatalogId() string {
|
||||
if x != nil {
|
||||
return x.StaticHostCatalogId
|
||||
return x.CatalogId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -377,10 +377,12 @@ type HostSetMember struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
StaticHostSetId string `protobuf:"bytes,1,opt,name=static_host_set_id,json=staticHostSetId,proto3" json:"static_host_set_id,omitempty" gorm:"primary_key"`
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
StaticHostId string `protobuf:"bytes,2,opt,name=static_host_id,json=staticHostId,proto3" json:"static_host_id,omitempty" gorm:"primary_key"`
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
HostId string `protobuf:"bytes,1,opt,name=host_id,json=hostId,proto3" json:"host_id,omitempty" gorm:"primary_key"`
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
SetId string `protobuf:"bytes,2,opt,name=set_id,json=setId,proto3" json:"set_id,omitempty" gorm:"primary_key"`
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
CatalogId string `protobuf:"bytes,3,opt,name=catalog_id,json=catalogId,proto3" json:"catalog_id,omitempty" gorm:"default:null"`
|
||||
}
|
||||
|
||||
func (x *HostSetMember) Reset() {
|
||||
@@ -415,16 +417,23 @@ func (*HostSetMember) Descriptor() ([]byte, []int) {
|
||||
return file_controller_storage_host_static_store_v1_static_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *HostSetMember) GetStaticHostSetId() string {
|
||||
func (x *HostSetMember) GetHostId() string {
|
||||
if x != nil {
|
||||
return x.StaticHostSetId
|
||||
return x.HostId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HostSetMember) GetStaticHostId() string {
|
||||
func (x *HostSetMember) GetSetId() string {
|
||||
if x != nil {
|
||||
return x.StaticHostId
|
||||
return x.SetId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HostSetMember) GetCatalogId() string {
|
||||
if x != nil {
|
||||
return x.CatalogId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -466,7 +475,7 @@ var file_controller_storage_host_static_store_v1_static_proto_rawDesc = []byte{
|
||||
0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
|
||||
0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x22, 0xdc, 0x02, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62,
|
||||
0x22, 0xc6, 0x02, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62,
|
||||
0x6c, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75,
|
||||
0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f,
|
||||
@@ -481,40 +490,37 @@ var file_controller_storage_host_static_store_v1_static_proto_rawDesc = []byte{
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x16, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63,
|
||||
0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f,
|
||||
0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22,
|
||||
0xc5, 0x02, 0x0a, 0x07, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70,
|
||||
0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61,
|
||||
0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
|
||||
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x16, 0x73, 0x74, 0x61, 0x74,
|
||||
0x69, 0x63, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63,
|
||||
0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
|
||||
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x62, 0x0a, 0x0d, 0x48, 0x6f, 0x73, 0x74, 0x53,
|
||||
0x65, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x12, 0x73, 0x74, 0x61, 0x74,
|
||||
0x69, 0x63, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74,
|
||||
0x53, 0x65, 0x74, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x5f,
|
||||
0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73,
|
||||
0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x42, 0x40, 0x5a, 0x3e, 0x67,
|
||||
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
||||
0x67, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61,
|
||||
0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
|
||||
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x02, 0x0a, 0x07, 0x48, 0x6f,
|
||||
0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||
0x49, 0x64, 0x12, 0x4b, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
||||
0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
|
||||
0x4b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65,
|
||||
0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5e, 0x0a, 0x0d, 0x48,
|
||||
0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07,
|
||||
0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68,
|
||||
0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a,
|
||||
0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x42, 0x40, 0x5a, 0x3e, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||
0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x69,
|
||||
|
||||
@@ -0,0 +1,329 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.12.4
|
||||
// source: controller/storage/host/store/v1/host.proto
|
||||
|
||||
// Package store provides protobufs for storing types in the host package.
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "github.com/hashicorp/boundary/internal/db/timestamp"
|
||||
_ "github.com/hashicorp/boundary/internal/gen/controller/protooptions"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type Catalog struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
PublicId string `protobuf:"bytes,1,opt,name=public_id,json=publicId,proto3" json:"public_id,omitempty" gorm:"primary_key"`
|
||||
// The scope_id of the owning scope and must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
ScopeId string `protobuf:"bytes,2,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" gorm:"not_null"`
|
||||
}
|
||||
|
||||
func (x *Catalog) Reset() {
|
||||
*x = Catalog{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_storage_host_store_v1_host_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Catalog) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Catalog) ProtoMessage() {}
|
||||
|
||||
func (x *Catalog) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_storage_host_store_v1_host_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Catalog.ProtoReflect.Descriptor instead.
|
||||
func (*Catalog) Descriptor() ([]byte, []int) {
|
||||
return file_controller_storage_host_store_v1_host_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Catalog) GetPublicId() string {
|
||||
if x != nil {
|
||||
return x.PublicId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Catalog) GetScopeId() string {
|
||||
if x != nil {
|
||||
return x.ScopeId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Host struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
PublicId string `protobuf:"bytes,1,opt,name=public_id,json=publicId,proto3" json:"public_id,omitempty" gorm:"primary_key"`
|
||||
// The catalog_id of the owning catalog and must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
CatalogId string `protobuf:"bytes,2,opt,name=catalog_id,json=catalogId,proto3" json:"catalog_id,omitempty" gorm:"not_null"`
|
||||
}
|
||||
|
||||
func (x *Host) Reset() {
|
||||
*x = Host{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_storage_host_store_v1_host_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Host) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Host) ProtoMessage() {}
|
||||
|
||||
func (x *Host) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_storage_host_store_v1_host_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Host.ProtoReflect.Descriptor instead.
|
||||
func (*Host) Descriptor() ([]byte, []int) {
|
||||
return file_controller_storage_host_store_v1_host_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Host) GetPublicId() string {
|
||||
if x != nil {
|
||||
return x.PublicId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Host) GetCatalogId() string {
|
||||
if x != nil {
|
||||
return x.CatalogId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Set struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
PublicId string `protobuf:"bytes,1,opt,name=public_id,json=publicId,proto3" json:"public_id,omitempty" gorm:"primary_key"`
|
||||
// The catalog_id of the owning catalog and must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
CatalogId string `protobuf:"bytes,2,opt,name=catalog_id,json=catalogId,proto3" json:"catalog_id,omitempty" gorm:"not_null"`
|
||||
}
|
||||
|
||||
func (x *Set) Reset() {
|
||||
*x = Set{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_storage_host_store_v1_host_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Set) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Set) ProtoMessage() {}
|
||||
|
||||
func (x *Set) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_storage_host_store_v1_host_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Set.ProtoReflect.Descriptor instead.
|
||||
func (*Set) Descriptor() ([]byte, []int) {
|
||||
return file_controller_storage_host_store_v1_host_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *Set) GetPublicId() string {
|
||||
if x != nil {
|
||||
return x.PublicId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Set) GetCatalogId() string {
|
||||
if x != nil {
|
||||
return x.CatalogId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_controller_storage_host_store_v1_host_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_controller_storage_host_store_v1_host_proto_rawDesc = []byte{
|
||||
0x0a, 0x2b, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x61, 0x67, 0x65, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67,
|
||||
0x65, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x1a,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x61, 0x67, 0x65, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x76, 0x31,
|
||||
0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73,
|
||||
0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x41, 0x0a, 0x07,
|
||||
0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x22,
|
||||
0x42, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69,
|
||||
0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x75, 0x62, 0x6c,
|
||||
0x69, 0x63, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
||||
0x67, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x03, 0x53, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75,
|
||||
0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70,
|
||||
0x75, 0x62, 0x6c, 0x69, 0x63, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x61, 0x6c,
|
||||
0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x74,
|
||||
0x61, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
|
||||
0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3b, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_controller_storage_host_store_v1_host_proto_rawDescOnce sync.Once
|
||||
file_controller_storage_host_store_v1_host_proto_rawDescData = file_controller_storage_host_store_v1_host_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_controller_storage_host_store_v1_host_proto_rawDescGZIP() []byte {
|
||||
file_controller_storage_host_store_v1_host_proto_rawDescOnce.Do(func() {
|
||||
file_controller_storage_host_store_v1_host_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_storage_host_store_v1_host_proto_rawDescData)
|
||||
})
|
||||
return file_controller_storage_host_store_v1_host_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_controller_storage_host_store_v1_host_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_controller_storage_host_store_v1_host_proto_goTypes = []interface{}{
|
||||
(*Catalog)(nil), // 0: controller.storage.host.store.v1.Catalog
|
||||
(*Host)(nil), // 1: controller.storage.host.store.v1.Host
|
||||
(*Set)(nil), // 2: controller.storage.host.store.v1.Set
|
||||
}
|
||||
var file_controller_storage_host_store_v1_host_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_controller_storage_host_store_v1_host_proto_init() }
|
||||
func file_controller_storage_host_store_v1_host_proto_init() {
|
||||
if File_controller_storage_host_store_v1_host_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_controller_storage_host_store_v1_host_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Catalog); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_controller_storage_host_store_v1_host_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Host); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_controller_storage_host_store_v1_host_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Set); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_controller_storage_host_store_v1_host_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_controller_storage_host_store_v1_host_proto_goTypes,
|
||||
DependencyIndexes: file_controller_storage_host_store_v1_host_proto_depIdxs,
|
||||
MessageInfos: file_controller_storage_host_store_v1_host_proto_msgTypes,
|
||||
}.Build()
|
||||
File_controller_storage_host_store_v1_host_proto = out.File
|
||||
file_controller_storage_host_store_v1_host_proto_rawDesc = nil
|
||||
file_controller_storage_host_store_v1_host_proto_goTypes = nil
|
||||
file_controller_storage_host_store_v1_host_proto_depIdxs = nil
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import "controller/custom_options/v1/options.proto";
|
||||
|
||||
message HostCatalog {
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string public_id = 1;
|
||||
|
||||
// The create_time is set by the database.
|
||||
@@ -30,7 +30,7 @@ message HostCatalog {
|
||||
string description = 5 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
|
||||
|
||||
// The scope_id of the owning scope and must be set.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string scope_id = 6;
|
||||
|
||||
// version allows optimistic locking of the resource
|
||||
@@ -40,7 +40,7 @@ message HostCatalog {
|
||||
|
||||
message Host {
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string public_id = 1;
|
||||
|
||||
// The create_time is set by the database.
|
||||
@@ -52,7 +52,7 @@ message Host {
|
||||
timestamp.v1.Timestamp update_time = 3;
|
||||
|
||||
// name is optional. If set, it must be unique within
|
||||
// static_host_catalog_id.
|
||||
// catalog_id.
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string name = 4;
|
||||
|
||||
@@ -60,14 +60,14 @@ message Host {
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string description = 5;
|
||||
|
||||
// static_host_catalog_id is the public_id of the owning
|
||||
// catalog_id is the public_id of the owning
|
||||
// static_host_catalog and must be set.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
string static_host_catalog_id = 6;
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string catalog_id = 6;
|
||||
|
||||
// address is the IP Address or DNS name of the host. It must be set and
|
||||
// it must be unique within static_host_catalog_id.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
// it must be unique within catalog_id.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string address = 7;
|
||||
|
||||
// version allows optimistic locking of the resource
|
||||
@@ -77,7 +77,7 @@ message Host {
|
||||
|
||||
message HostSet {
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string public_id = 1;
|
||||
|
||||
// The create_time is set by the database.
|
||||
@@ -89,7 +89,7 @@ message HostSet {
|
||||
timestamp.v1.Timestamp update_time = 3;
|
||||
|
||||
// name is optional. If set, it must be unique within
|
||||
// static_host_catalog_id.
|
||||
// catalog_id.
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string name = 4;
|
||||
|
||||
@@ -97,10 +97,10 @@ message HostSet {
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string description = 5;
|
||||
|
||||
// static_host_catalog_id is the public_id of the owning
|
||||
// catalog_id is the public_id of the owning
|
||||
// static_host_catalog and must be set.
|
||||
// @inject_tag: gorm:"not_null"
|
||||
string static_host_catalog_id = 6;
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string catalog_id = 6;
|
||||
|
||||
// version allows optimistic locking of the resource
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
@@ -108,9 +108,12 @@ message HostSet {
|
||||
}
|
||||
|
||||
message HostSetMember {
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
string static_host_set_id = 1;
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string host_id = 1;
|
||||
|
||||
// @inject_tag: gorm:"primary_key"
|
||||
string static_host_id = 2;
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string set_id = 2;
|
||||
|
||||
// @inject_tag: `gorm:"default:null"`
|
||||
string catalog_id = 3;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// Package store provides protobufs for storing types in the host package.
|
||||
package controller.storage.host.store.v1;
|
||||
option go_package = "github.com/hashicorp/boundary/internal/host/store;store";
|
||||
|
||||
import "controller/storage/timestamp/v1/timestamp.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
|
||||
message Catalog {
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string public_id = 1;
|
||||
|
||||
// The scope_id of the owning scope and must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string scope_id = 2;
|
||||
}
|
||||
|
||||
message Host {
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string public_id = 1;
|
||||
|
||||
// The catalog_id of the owning catalog and must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string catalog_id = 2;
|
||||
}
|
||||
|
||||
message Set {
|
||||
// public_is is a surrogate key suitable for use in a public API.
|
||||
// @inject_tag: `gorm:"primary_key"`
|
||||
string public_id = 1;
|
||||
|
||||
// The catalog_id of the owning catalog and must be set.
|
||||
// @inject_tag: `gorm:"not_null"`
|
||||
string catalog_id = 2;
|
||||
}
|
||||
Reference in new issue
Block a user