From a4ea99047f08d099261ad203ca9eade976c12b65 Mon Sep 17 00:00:00 2001 From: Todd Date: Fri, 24 Sep 2021 13:16:13 -0700 Subject: [PATCH] Remove Prefix Id and Plugin Name fields (#1563) * Remove Prefix Id and Plugin Name fields. Creating catalogs now require either the plugin id or the name of the plugin resource (but not both). Host Catalogs and Host Sets API resources now have a read only plugin field populated with plugin info. Host Catalogs have a plugin id field as a top level field. --- api/hostcatalogs/host_catalog.gen.go | 3 + api/hosts/host.gen.go | 2 + api/hostsets/host_set.gen.go | 2 + api/plugins/plugin_info.gen.go | 8 + globals/fields.go | 2 + internal/api/genapi/input.go | 6 + .../postgres/17/02_hostplugin.up.sql | 16 +- .../postgres/17/05_preferred_endpoints.up.sql | 6 +- internal/db/schema/postgres_migration.gen.go | 22 +- internal/gen/controller.swagger.json | 46 ++++ .../api/services/host_catalog_service.pb.go | 216 +++++++++--------- .../services/host_catalog_service.pb.gw.go | 18 ++ .../host/plugin/host_catalog_secret_test.go | 4 +- internal/host/plugin/host_catalog_test.go | 22 +- internal/host/plugin/host_set_test.go | 4 +- internal/host/plugin/ids.go | 15 +- internal/host/plugin/immutable_fields_test.go | 6 +- .../host/plugin/repository_host_catalog.go | 98 ++++---- .../plugin/repository_host_catalog_test.go | 27 +-- internal/host/plugin/repository_host_set.go | 104 +++++---- .../host/plugin/repository_host_set_test.go | 44 ++-- internal/host/plugin/testing.go | 10 +- internal/host/plugin/testing_test.go | 10 +- internal/host/preferred_endpoint_test.go | 4 +- internal/perms/output_fields.go | 2 + internal/perms/output_fields_test.go | 2 + internal/plugin/host/ids.go | 2 +- internal/plugin/host/immutable_fields_test.go | 11 +- internal/plugin/host/plugin.go | 4 +- internal/plugin/host/plugin_test.go | 168 ++------------ internal/plugin/host/repository_plugin.go | 22 +- .../plugin/host/repository_plugin_test.go | 92 +------- internal/plugin/host/store/plugin.pb.go | 38 +-- internal/plugin/host/testing.go | 4 +- internal/plugin/host/testing_test.go | 2 +- .../hostcatalogs/v1/host_catalog.proto | 7 + .../api/resources/hosts/v1/host.proto | 4 + .../api/resources/hostsets/v1/host_set.proto | 4 + .../api/resources/plugins/v1/plugin.proto | 16 ++ .../services/v1/host_catalog_service.proto | 3 + .../storage/plugin/host/store/v1/plugin.proto | 8 - .../host_catalogs/host_catalog_service.go | 181 +++++++++------ .../host_catalog_service_test.go | 125 ++++++---- .../handlers/host_sets/host_set_service.go | 182 ++++++++------- .../host_sets/host_set_service_test.go | 97 +++++--- .../servers/controller/handlers/options.go | 10 + .../handlers/targets/target_service_test.go | 12 +- .../resources/hostcatalogs/host_catalog.pb.go | 200 +++++++++------- .../controller/api/resources/hosts/host.pb.go | 156 +++++++------ .../api/resources/hostsets/host_set.pb.go | 147 ++++++------ .../api/resources/plugins/plugin.pb.go | 172 ++++++++++++++ 51 files changed, 1314 insertions(+), 1052 deletions(-) create mode 100644 api/plugins/plugin_info.gen.go create mode 100644 internal/proto/local/controller/api/resources/plugins/v1/plugin.proto create mode 100644 sdk/pbs/controller/api/resources/plugins/plugin.pb.go diff --git a/api/hostcatalogs/host_catalog.gen.go b/api/hostcatalogs/host_catalog.gen.go index abce123ff..ae121ae42 100644 --- a/api/hostcatalogs/host_catalog.gen.go +++ b/api/hostcatalogs/host_catalog.gen.go @@ -9,6 +9,7 @@ import ( "time" "github.com/hashicorp/boundary/api" + "github.com/hashicorp/boundary/api/plugins" "github.com/hashicorp/boundary/api/scopes" ) @@ -16,6 +17,8 @@ type HostCatalog struct { Id string `json:"id,omitempty"` ScopeId string `json:"scope_id,omitempty"` Scope *scopes.ScopeInfo `json:"scope,omitempty"` + PluginId string `json:"plugin_id,omitempty"` + Plugin *plugins.PluginInfo `json:"plugin,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` CreatedTime time.Time `json:"created_time,omitempty"` diff --git a/api/hosts/host.gen.go b/api/hosts/host.gen.go index 51b6b424a..24dcc2178 100644 --- a/api/hosts/host.gen.go +++ b/api/hosts/host.gen.go @@ -9,6 +9,7 @@ import ( "time" "github.com/hashicorp/boundary/api" + "github.com/hashicorp/boundary/api/plugins" "github.com/hashicorp/boundary/api/scopes" ) @@ -16,6 +17,7 @@ type Host struct { Id string `json:"id,omitempty"` HostCatalogId string `json:"host_catalog_id,omitempty"` Scope *scopes.ScopeInfo `json:"scope,omitempty"` + Plugin *plugins.PluginInfo `json:"plugin,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` CreatedTime time.Time `json:"created_time,omitempty"` diff --git a/api/hostsets/host_set.gen.go b/api/hostsets/host_set.gen.go index 58fceb29c..36a8b6c27 100644 --- a/api/hostsets/host_set.gen.go +++ b/api/hostsets/host_set.gen.go @@ -9,6 +9,7 @@ import ( "time" "github.com/hashicorp/boundary/api" + "github.com/hashicorp/boundary/api/plugins" "github.com/hashicorp/boundary/api/scopes" ) @@ -16,6 +17,7 @@ type HostSet struct { Id string `json:"id,omitempty"` HostCatalogId string `json:"host_catalog_id,omitempty"` Scope *scopes.ScopeInfo `json:"scope,omitempty"` + Plugin *plugins.PluginInfo `json:"plugin,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` CreatedTime time.Time `json:"created_time,omitempty"` diff --git a/api/plugins/plugin_info.gen.go b/api/plugins/plugin_info.gen.go new file mode 100644 index 000000000..2eb390ddd --- /dev/null +++ b/api/plugins/plugin_info.gen.go @@ -0,0 +1,8 @@ +// Code generated by "make api"; DO NOT EDIT. +package plugins + +type PluginInfo struct { + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` +} diff --git a/globals/fields.go b/globals/fields.go index 00f8b898d..0ddaacf44 100644 --- a/globals/fields.go +++ b/globals/fields.go @@ -59,4 +59,6 @@ const ( ApplicationCredentialSourceIdsField = "application_credential_source_ids" ApplicationCredentialSourcesField = "application_credential_sources" PreferredEndpointsField = "preferred_endpoints" + PluginIdField = "plugin_id" + PluginField = "plugin" ) diff --git a/internal/api/genapi/input.go b/internal/api/genapi/input.go index 9715484fc..938699ea1 100644 --- a/internal/api/genapi/input.go +++ b/internal/api/genapi/input.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hosts" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostsets" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/managedgroups" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/roles" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/sessions" @@ -138,6 +139,11 @@ var inputStructs = []*structInfo{ outFile: "scopes/scope_info.gen.go", skipOptions: true, }, + { + inProto: &plugins.PluginInfo{}, + outFile: "plugins/plugin_info.gen.go", + skipOptions: true, + }, { inProto: &scopes.Scope{}, outFile: "scopes/scope.gen.go", diff --git a/internal/db/schema/migrations/postgres/17/02_hostplugin.up.sql b/internal/db/schema/migrations/postgres/17/02_hostplugin.up.sql index dd3f59077..9bc035e46 100644 --- a/internal/db/schema/migrations/postgres/17/02_hostplugin.up.sql +++ b/internal/db/schema/migrations/postgres/17/02_hostplugin.up.sql @@ -38,20 +38,6 @@ begin; create_time wt_timestamp, update_time wt_timestamp, version wt_version, - plugin_name text not null - constraint plugin_name_must_be_not_empty - check(length(trim(plugin_name)) > 0) - constraint plugin_name_must_be_lowercase - check(lower(trim(plugin_name)) = plugin_name) - constraint plugin_host_plugin_name_uq - unique, - id_prefix text not null - constraint plugin_id_prefix_must_be_not_empty - check(length(trim(id_prefix)) > 0) - constraint plugin_id_prefix_must_fit_format - check (id_prefix ~ '^[a-z0-9]*$') - constraint plugin_host_id_prefix_uq - unique, constraint plugin_fkey foreign key (scope_id, public_id) references plugin(scope_id, public_id) @@ -71,7 +57,7 @@ begin; for each row execute procedure default_create_time(); create trigger immutable_columns before update on plugin_host - for each row execute procedure immutable_columns('public_id', 'create_time', 'plugin_name'); + for each row execute procedure immutable_columns('public_id', 'create_time'); create trigger insert_plugin_subtype before insert on plugin_host for each row execute procedure insert_plugin_subtype(); diff --git a/internal/db/schema/migrations/postgres/17/05_preferred_endpoints.up.sql b/internal/db/schema/migrations/postgres/17/05_preferred_endpoints.up.sql index b1478e9d5..eafa2c5e8 100644 --- a/internal/db/schema/migrations/postgres/17/05_preferred_endpoints.up.sql +++ b/internal/db/schema/migrations/postgres/17/05_preferred_endpoints.up.sql @@ -55,6 +55,7 @@ create view host_plugin_host_set_with_value_obj as select hs.public_id, hs.catalog_id, + hc.plugin_id, hs.name, hs.description, hs.create_time, @@ -65,8 +66,9 @@ select string_agg(distinct concat_ws('=', hspe.priority, hspe.condition), '|') as preferred_endpoints from host_plugin_set hs - left outer join host_set_preferred_endpoint hspe on hs.public_id = hspe.host_set_id -group by hs.public_id; + join host_plugin_catalog hc on hs.catalog_id = hc.public_id + left outer join host_set_preferred_endpoint hspe on hs.public_id = hspe.host_set_id +group by hs.public_id, hc.plugin_id; comment on view host_plugin_host_set_with_value_obj is 'host plugin host set with its associated value objects'; diff --git a/internal/db/schema/postgres_migration.gen.go b/internal/db/schema/postgres_migration.gen.go index 1c3d02a05..5504c5ef4 100644 --- a/internal/db/schema/postgres_migration.gen.go +++ b/internal/db/schema/postgres_migration.gen.go @@ -7580,20 +7580,6 @@ alter table wh_session_connection_accumulating_fact create_time wt_timestamp, update_time wt_timestamp, version wt_version, - plugin_name text not null - constraint plugin_name_must_be_not_empty - check(length(trim(plugin_name)) > 0) - constraint plugin_name_must_be_lowercase - check(lower(trim(plugin_name)) = plugin_name) - constraint plugin_host_plugin_name_uq - unique, - id_prefix text not null - constraint plugin_id_prefix_must_be_not_empty - check(length(trim(id_prefix)) > 0) - constraint plugin_id_prefix_must_fit_format - check (id_prefix ~ '^[a-z0-9]*$') - constraint plugin_host_id_prefix_uq - unique, constraint plugin_fkey foreign key (scope_id, public_id) references plugin(scope_id, public_id) @@ -7613,7 +7599,7 @@ alter table wh_session_connection_accumulating_fact for each row execute procedure default_create_time(); create trigger immutable_columns before update on plugin_host - for each row execute procedure immutable_columns('public_id', 'create_time', 'plugin_name'); + for each row execute procedure immutable_columns('public_id', 'create_time'); create trigger insert_plugin_subtype before insert on plugin_host for each row execute procedure insert_plugin_subtype(); @@ -7904,6 +7890,7 @@ create view host_plugin_host_set_with_value_obj as select hs.public_id, hs.catalog_id, + hc.plugin_id, hs.name, hs.description, hs.create_time, @@ -7914,8 +7901,9 @@ select string_agg(distinct concat_ws('=', hspe.priority, hspe.condition), '|') as preferred_endpoints from host_plugin_set hs - left outer join host_set_preferred_endpoint hspe on hs.public_id = hspe.host_set_id -group by hs.public_id; + join host_plugin_catalog hc on hs.catalog_id = hc.public_id + left outer join host_set_preferred_endpoint hspe on hs.public_id = hspe.host_set_id +group by hs.public_id, hc.plugin_id; comment on view host_plugin_host_set_with_value_obj is 'host plugin host set with its associated value objects'; `), diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index 31bef3b4b..f3f8afa34 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -1244,6 +1244,13 @@ "schema": { "$ref": "#/definitions/controller.api.resources.hostcatalogs.v1.HostCatalog" } + }, + { + "name": "plugin_name", + "description": "As an alternative to providing the plugin id in the provided HostCatalog,\nthis field can be used to lookup the plugin using it's name.", + "in": "query", + "required": false, + "type": "string" } ], "tags": [ @@ -4075,6 +4082,15 @@ "description": "Output only. Scope information for this resource.", "readOnly": true }, + "plugin_id": { + "type": "string", + "description": "The ID of the plugin of which this catalog is created." + }, + "plugin": { + "$ref": "#/definitions/controller.api.resources.plugins.v1.PluginInfo", + "description": "Output only. Plugin information for this resource.", + "readOnly": true + }, "name": { "type": "string", "description": "Optional name for identification purposes." @@ -4151,6 +4167,11 @@ "description": "Output only. Scope information for this resource.", "readOnly": true }, + "plugin": { + "$ref": "#/definitions/controller.api.resources.plugins.v1.PluginInfo", + "description": "Output only. Plugin information for this resource.", + "readOnly": true + }, "name": { "type": "string", "description": "Optional name for identification purposes." @@ -4220,6 +4241,11 @@ "description": "Output only. Scope information for this resource.", "readOnly": true }, + "plugin": { + "$ref": "#/definitions/controller.api.resources.plugins.v1.PluginInfo", + "description": "Output only. Plugin information for this resource.", + "readOnly": true + }, "name": { "type": "string", "description": "Optional name for identification purposes." @@ -4348,6 +4374,26 @@ }, "title": "ManagedGroup contains all fields related to an ManagedGroup resource" }, + "controller.api.resources.plugins.v1.PluginInfo": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Output only. The ID of the Plugin.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "Output only. The name of the plugin resource in boundary, if any.", + "readOnly": true + }, + "description": { + "type": "string", + "description": "Output only. The description of the plugin in boundary, if any.", + "readOnly": true + } + } + }, "controller.api.resources.roles.v1.Grant": { "type": "object", "properties": { diff --git a/internal/gen/controller/api/services/host_catalog_service.pb.go b/internal/gen/controller/api/services/host_catalog_service.pb.go index fb70dea13..7bb089e0d 100644 --- a/internal/gen/controller/api/services/host_catalog_service.pb.go +++ b/internal/gen/controller/api/services/host_catalog_service.pb.go @@ -234,6 +234,9 @@ type CreateHostCatalogRequest struct { unknownFields protoimpl.UnknownFields Item *hostcatalogs.HostCatalog `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` + // As an alternative to providing the plugin id in the provided HostCatalog, + // this field can be used to lookup the plugin using it's name. + PluginName string `protobuf:"bytes,2,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty"` } func (x *CreateHostCatalogRequest) Reset() { @@ -275,6 +278,13 @@ func (x *CreateHostCatalogRequest) GetItem() *hostcatalogs.HostCatalog { return nil } +func (x *CreateHostCatalogRequest) GetPluginName() string { + if x != nil { + return x.PluginName + } + return "" +} + type CreateHostCatalogResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -566,111 +576,113 @@ var file_controller_api_services_v1_host_catalog_service_proto_rawDesc = []byte{ 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x22, 0x65, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, + 0x74, 0x65, 0x6d, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, + 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x78, 0x0a, + 0x19, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, + 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x49, 0x0a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb2, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, + 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, + 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, + 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, + 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x66, 0x0a, 0x19, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x78, 0x0a, 0x19, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb2, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, - 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x3b, 0x0a, - 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x66, 0x0a, 0x19, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x2a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1b, - 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, - 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xde, 0x07, 0x0a, 0x12, - 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0xbd, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x92, 0x41, 0x1d, 0x12, 0x1b, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x2e, 0x12, 0xba, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x1b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xde, 0x07, + 0x0a, 0x12, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0xbd, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, + 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, + 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x1d, 0x12, 0x1b, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, + 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x2e, 0x12, 0xba, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, + 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, + 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x92, + 0x41, 0x1f, 0x12, 0x1d, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, + 0x6f, 0x66, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x12, 0xc2, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, + 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x11, 0x2f, 0x76, + 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x3a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x18, 0x12, 0x16, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0xc7, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, - 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, - 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x92, 0x41, 0x1f, - 0x12, 0x1d, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, - 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x12, - 0xc2, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, - 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, - 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x3a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x12, 0xc7, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, - 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, - 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x32, - 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, - 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0xbb, - 0x01, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, - 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, - 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x39, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, - 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, - 0x7d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, - 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x42, 0x4d, 0x5a, 0x4b, - 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, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x24, 0x32, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, + 0x12, 0xbb, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x39, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x76, 0x31, + 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, + 0x69, 0x64, 0x7d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, + 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x42, 0x4d, + 0x5a, 0x4b, 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, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/gen/controller/api/services/host_catalog_service.pb.gw.go b/internal/gen/controller/api/services/host_catalog_service.pb.gw.go index e36256dae..e76c2dbc8 100644 --- a/internal/gen/controller/api/services/host_catalog_service.pb.gw.go +++ b/internal/gen/controller/api/services/host_catalog_service.pb.gw.go @@ -119,6 +119,10 @@ func local_request_HostCatalogService_ListHostCatalogs_0(ctx context.Context, ma } +var ( + filter_HostCatalogService_CreateHostCatalog_0 = &utilities.DoubleArray{Encoding: map[string]int{"item": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_HostCatalogService_CreateHostCatalog_0(ctx context.Context, marshaler runtime.Marshaler, client HostCatalogServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreateHostCatalogRequest var metadata runtime.ServerMetadata @@ -131,6 +135,13 @@ func request_HostCatalogService_CreateHostCatalog_0(ctx context.Context, marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_HostCatalogService_CreateHostCatalog_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.CreateHostCatalog(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -148,6 +159,13 @@ func local_request_HostCatalogService_CreateHostCatalog_0(ctx context.Context, m return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_HostCatalogService_CreateHostCatalog_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.CreateHostCatalog(ctx, &protoReq) return msg, metadata, err diff --git a/internal/host/plugin/host_catalog_secret_test.go b/internal/host/plugin/host_catalog_secret_test.go index f6559caf5..9a24404b1 100644 --- a/internal/host/plugin/host_catalog_secret_test.go +++ b/internal/host/plugin/host_catalog_secret_test.go @@ -24,7 +24,7 @@ func TestHostCatalogSecret_New(t *testing.T) { kkms := kms.TestKms(t, conn, wrapper) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") cat := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) type args struct { @@ -126,7 +126,7 @@ func TestHostCatalogSecret_Custom_Queries(t *testing.T) { kkms := kms.TestKms(t, conn, wrapper) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") cat := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) databaseWrapper, err := kkms.GetWrapper(ctx, prj.PublicId, kms.KeyPurposeDatabase) require.NoError(t, err) diff --git a/internal/host/plugin/host_catalog_test.go b/internal/host/plugin/host_catalog_test.go index 761dacb5a..cd7d90578 100644 --- a/internal/host/plugin/host_catalog_test.go +++ b/internal/host/plugin/host_catalog_test.go @@ -22,7 +22,7 @@ func TestHostCatalog_Create(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") wrapper := db.TestWrapper(t) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") type args struct { pluginId string @@ -149,7 +149,7 @@ func TestHostCatalog_Create(t *testing.T) { assert.Emptyf(t, got.PublicId, "PublicId set") assert.Equal(t, tt.want, got) - id, err := newHostCatalogId(ctx, plg.GetIdPrefix()) + id, err := newHostCatalogId(ctx) assert.NoError(t, err) tt.want.PublicId = id @@ -180,31 +180,31 @@ func TestHostCatalog_Create_DuplicateNames(t *testing.T) { wrapper := db.TestWrapper(t) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) _, prj2 := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test1", "prefix1") - plg2 := host.TestPlugin(t, conn, "test2", "prefix2") + plg := host.TestPlugin(t, conn, "test1") + plg2 := host.TestPlugin(t, conn, "test2") got, err := NewHostCatalog(ctx, prj.GetPublicId(), plg.GetPublicId(), WithName("duplicate")) require.NoError(t, err) - got.PublicId, err = newHostCatalogId(ctx, plg.GetIdPrefix()) + got.PublicId, err = newHostCatalogId(ctx) require.NoError(t, err) require.NoError(t, w.Create(ctx, got)) // Can't create another resource with the same name in the same scope - got.PublicId, err = newHostCatalogId(ctx, plg.GetIdPrefix()) + got.PublicId, err = newHostCatalogId(ctx) require.NoError(t, err) assert.Error(t, w.Create(ctx, got)) // Can't create another resource with same name in same scope even for different plugin got, err = NewHostCatalog(ctx, prj.GetPublicId(), plg2.GetPublicId(), WithName("duplicate")) require.NoError(t, err) - got.PublicId, err = newHostCatalogId(ctx, plg2.GetIdPrefix()) + got.PublicId, err = newHostCatalogId(ctx) require.NoError(t, err) assert.Error(t, w.Create(ctx, got)) // Can create another resource with same name in different scope even for same plugin got, err = NewHostCatalog(ctx, prj2.GetPublicId(), plg.GetPublicId(), WithName("duplicate")) require.NoError(t, err) - got.PublicId, err = newHostCatalogId(ctx, plg.GetIdPrefix()) + got.PublicId, err = newHostCatalogId(ctx) require.NoError(t, err) assert.NoError(t, w.Create(ctx, got)) } @@ -213,7 +213,7 @@ func TestHostCatalog_Delete(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") wrapper := db.TestWrapper(t) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") cat := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) ignoredCat := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) _ = ignoredCat @@ -264,7 +264,7 @@ func TestHostCatalog_Delete_Cascading(t *testing.T) { t.Run("delete-scope", func(t *testing.T) { _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "deletescope", "deletescope") + plg := host.TestPlugin(t, conn, "deletescope") cat := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) deleted, err := w.Delete(ctx, prj) @@ -278,7 +278,7 @@ func TestHostCatalog_Delete_Cascading(t *testing.T) { t.Run("delete-plugin", func(t *testing.T) { _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "deleteplugin", "deleteplugin") + plg := host.TestPlugin(t, conn, "deleteplugin") cat := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) deleted, err := w.Delete(ctx, plg) diff --git a/internal/host/plugin/host_set_test.go b/internal/host/plugin/host_set_test.go index ecfce316a..ac9a0d4cb 100644 --- a/internal/host/plugin/host_set_test.go +++ b/internal/host/plugin/host_set_test.go @@ -18,7 +18,7 @@ func TestHostSet_Create(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") wrapper := db.TestWrapper(t) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") cat := TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) cat2 := TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) @@ -168,7 +168,7 @@ func TestHostSet_Create(t *testing.T) { assert.Emptyf(t, got.PublicId, "PublicId set") assert.Equal(t, tt.want, got) - id, err := newHostSetId(ctx, plg.GetIdPrefix()) + id, err := newHostSetId(ctx) assert.NoError(t, err) tt.want.PublicId = id diff --git a/internal/host/plugin/ids.go b/internal/host/plugin/ids.go index cb3d91e5b..fa384bded 100644 --- a/internal/host/plugin/ids.go +++ b/internal/host/plugin/ids.go @@ -2,7 +2,6 @@ package plugin import ( "context" - "fmt" "github.com/hashicorp/boundary/internal/db" "github.com/hashicorp/boundary/internal/errors" @@ -19,24 +18,22 @@ func init() { // PublicId prefixes for the resources in the plugin package. const ( // TODO: Pull these out of being constants and have them derivable at run time. - HostCatalogPrefix = "hcplg" - HostSetPrefix = "hsplg" + HostCatalogPrefix = "hc" + HostSetPrefix = "hs" Subtype = subtypes.Subtype("plugin") ) -func newHostCatalogId(ctx context.Context, upre string) (string, error) { - prefix := fmt.Sprintf("%s_%s", HostCatalogPrefix, upre) - id, err := db.NewPublicId(prefix) +func newHostCatalogId(ctx context.Context) (string, error) { + id, err := db.NewPublicId(HostCatalogPrefix) if err != nil { return "", errors.Wrap(ctx, err, "plugin.newHostCatalogId") } return id, nil } -func newHostSetId(ctx context.Context, upre string) (string, error) { - prefix := fmt.Sprintf("%s_%s", HostSetPrefix, upre) - id, err := db.NewPublicId(prefix) +func newHostSetId(ctx context.Context) (string, error) { + id, err := db.NewPublicId(HostSetPrefix) if err != nil { return "", errors.Wrap(ctx, err, "plugin.newHostSetId") } diff --git a/internal/host/plugin/immutable_fields_test.go b/internal/host/plugin/immutable_fields_test.go index 641c1b575..68f37ee36 100644 --- a/internal/host/plugin/immutable_fields_test.go +++ b/internal/host/plugin/immutable_fields_test.go @@ -24,8 +24,8 @@ func TestPluginCatalog_ImmutableFields(t *testing.T) { wrapper := db.TestWrapper(t) ts := timestamp.Timestamp{Timestamp: ×tamppb.Timestamp{Seconds: 0, Nanos: 0}} o, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "prefix") - plg2 := host.TestPlugin(t, conn, "test2", "prefix2") + plg := host.TestPlugin(t, conn, "test") + plg2 := host.TestPlugin(t, conn, "test2") new := TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) tests := []struct { @@ -100,7 +100,7 @@ func TestPluginSet_ImmutableFields(t *testing.T) { ts := timestamp.Timestamp{Timestamp: ×tamppb.Timestamp{Seconds: 0, Nanos: 0}} _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") cat := TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) new := TestSet(t, conn, kmsCache, cat, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, diff --git a/internal/host/plugin/repository_host_catalog.go b/internal/host/plugin/repository_host_catalog.go index 0fc165c42..89cd3dbaf 100644 --- a/internal/host/plugin/repository_host_catalog.go +++ b/internal/host/plugin/repository_host_catalog.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/boundary/internal/host" "github.com/hashicorp/boundary/internal/kms" "github.com/hashicorp/boundary/internal/oplog" - hostplg "github.com/hashicorp/boundary/internal/plugin/host" + hostplugin "github.com/hashicorp/boundary/internal/plugin/host" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostcatalogs" plgpb "github.com/hashicorp/boundary/sdk/pbs/plugin" "google.golang.org/grpc/codes" @@ -28,55 +28,45 @@ import ( // not included in the returned *HostCatalog. // // Both c.CreateTime and c.UpdateTime are ignored. -func (r *Repository) CreateCatalog(ctx context.Context, c *HostCatalog, _ ...Option) (*HostCatalog, error) { +func (r *Repository) CreateCatalog(ctx context.Context, c *HostCatalog, _ ...Option) (*HostCatalog, *hostplugin.Plugin, error) { const op = "plugin.(Repository).CreateCatalog" if c == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "nil HostCatalog") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil HostCatalog") } if c.HostCatalog == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "nil embedded HostCatalog") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil embedded HostCatalog") } if c.ScopeId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id") } if c.PublicId != "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "public id not empty") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "public id not empty") } if c.PluginId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no plugin id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no plugin id") } if c.Attributes == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "nil attributes") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil attributes") } c = c.clone() - - plg := hostplg.NewPlugin("", "") - plg.PublicId = c.PluginId - if err := r.reader.LookupByPublicId(ctx, plg); err != nil { - if errors.IsNotFoundError(err) { - return nil, errors.Wrap(ctx, err, op, errors.WithCode(errors.InvalidParameter), errors.WithMsg(fmt.Sprintf("can't find plugin with id: %q", c.GetPluginId()))) - } - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("unable to get host plugin with id %q", c.PluginId))) - } - - id, err := newHostCatalogId(ctx, plg.GetIdPrefix()) + id, err := newHostCatalogId(ctx) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } c.PublicId = id - plgClient, ok := r.plugins[plg.GetPublicId()] + plgClient, ok := r.plugins[c.GetPluginId()] if !ok || plgClient == nil { - return nil, errors.New(ctx, errors.Internal, op, fmt.Sprintf("expected plugin %q not available", plg.GetPluginName())) + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, fmt.Sprintf("plugin %q not available", c.GetPluginId())) } plgHc, err := toPluginCatalog(ctx, c) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } plgResp, err := plgClient.OnCreateCatalog(ctx, &plgpb.OnCreateCatalogRequest{Catalog: plgHc}) if err != nil { if status.Code(err) != codes.Unimplemented { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } } @@ -84,20 +74,20 @@ func (r *Repository) CreateCatalog(ctx context.Context, c *HostCatalog, _ ...Opt if plgResp != nil && plgResp.GetPersisted().GetSecrets() != nil { hcSecret, err = newHostCatalogSecret(ctx, id, plgResp.GetPersisted().GetSecrets()) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } dbWrapper, err := r.kms.GetWrapper(ctx, c.ScopeId, kms.KeyPurposeDatabase) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get db wrapper")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get db wrapper")) } if err := hcSecret.encrypt(ctx, dbWrapper); err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } } oplogWrapper, err := r.kms.GetWrapper(ctx, c.ScopeId, kms.KeyPurposeOplog) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get oplog wrapper")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get oplog wrapper")) } var newHostCatalog *HostCatalog @@ -142,39 +132,47 @@ func (r *Repository) CreateCatalog(ctx context.Context, c *HostCatalog, _ ...Opt if err != nil { if errors.IsUniqueError(err) { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in scope: %s: name %s already exists", c.ScopeId, c.Name))) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in scope: %s: name %s already exists", c.ScopeId, c.Name))) } - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in scope: %s", c.ScopeId))) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in scope: %s", c.ScopeId))) } - return newHostCatalog, nil + plg, err := r.getPlugin(ctx, newHostCatalog.GetPluginId()) + if err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + return newHostCatalog, plg, nil } // LookupCatalog returns the HostCatalog for id. Returns nil, nil if no // HostCatalog is found for id. -func (r *Repository) LookupCatalog(ctx context.Context, id string, _ ...Option) (*HostCatalog, error) { +func (r *Repository) LookupCatalog(ctx context.Context, id string, _ ...Option) (*HostCatalog, *hostplugin.Plugin, error) { const op = "plugin.(Repository).LookupCatalog" if id == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no public id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no public id") } c, err := r.getCatalog(ctx, id) if err != nil { if errors.IsNotFoundError(err) { - return nil, nil + return nil, nil, nil } - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("failed for: %s", id))) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("failed for: %s", id))) } - return c, nil + plg, err := r.getPlugin(ctx, c.GetPluginId()) + if err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + return c, plg, nil } // ListCatalogs returns a slice of HostCatalogs for the scope IDs. WithLimit is the only option supported. -func (r *Repository) ListCatalogs(ctx context.Context, scopeIds []string, opt ...host.Option) ([]*HostCatalog, error) { +func (r *Repository) ListCatalogs(ctx context.Context, scopeIds []string, opt ...host.Option) ([]*HostCatalog, []*hostplugin.Plugin, error) { const op = "plugin.(Repository).ListCatalogs" if len(scopeIds) == 0 { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id") } opts, err := host.GetOpts(opt...) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } limit := r.defaultLimit if opts.WithLimit != 0 { @@ -183,9 +181,17 @@ func (r *Repository) ListCatalogs(ctx context.Context, scopeIds []string, opt .. } var hostCatalogs []*HostCatalog if err := r.reader.SearchWhere(ctx, &hostCatalogs, "scope_id in (?)", []interface{}{scopeIds}, db.WithLimit(limit)); err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } - return hostCatalogs, nil + plgIds := make([]string, 0, len(hostCatalogs)) + for _, c := range hostCatalogs { + plgIds = append(plgIds, c.PluginId) + } + var plgs []*hostplugin.Plugin + if err := r.reader.SearchWhere(ctx, &plgs, "public_id in (?)", []interface{}{plgIds}); err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + return hostCatalogs, plgs, nil } // getCatalog retrieves the *HostCatalog with the provided id. If it is not found or there @@ -200,6 +206,16 @@ func (r *Repository) getCatalog(ctx context.Context, id string) (*HostCatalog, e return c, nil } +func (r *Repository) getPlugin(ctx context.Context, id string) (*hostplugin.Plugin, error) { + const op = "plugin.(Repository).getPlugin" + c := hostplugin.NewPlugin() + c.PublicId = id + if err := r.reader.LookupByPublicId(ctx, c); err != nil { + return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("failed for: %s", id))) + } + return c, nil +} + // getPersistedDataForCatalog returns the persisted data for a catalog if // present. c must have a valid Public Id and Scope Id set. // TODO: consider merging the functions for getting catalog and persisted data into a view. diff --git a/internal/host/plugin/repository_host_catalog_test.go b/internal/host/plugin/repository_host_catalog_test.go index e3f8ed94a..b4cc8c764 100644 --- a/internal/host/plugin/repository_host_catalog_test.go +++ b/internal/host/plugin/repository_host_catalog_test.go @@ -28,8 +28,8 @@ func TestRepository_CreateCatalog(t *testing.T) { rw := db.New(conn) wrapper := db.TestWrapper(t) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := hostplg.TestPlugin(t, conn, "test", "test") - unimplementedPlugin := hostplg.TestPlugin(t, conn, "unimplemented", "unimplemented") + plg := hostplg.TestPlugin(t, conn, "test") + unimplementedPlugin := hostplg.TestPlugin(t, conn, "unimplemented") // gotPluginAttrs tracks which attributes a plugin has received through a closure and can be compared in the // test against the expected values sent to the plugin. @@ -250,7 +250,7 @@ func TestRepository_CreateCatalog(t *testing.T) { repo, err := NewRepository(rw, rw, kmsCache, plgm) assert.NoError(err) assert.NotNil(repo) - got, err := repo.CreateCatalog(ctx, tt.in, tt.opts...) + got, _, err := repo.CreateCatalog(ctx, tt.in, tt.opts...) if tt.wantIsErr != 0 { assert.Truef(errors.Match(errors.T(tt.wantIsErr), err), "want err: %q got: %q", tt.wantIsErr, err) assert.Nil(got) @@ -311,7 +311,7 @@ func TestRepository_CreateCatalog(t *testing.T) { }, } - got, err := repo.CreateCatalog(context.Background(), in) + got, _, err := repo.CreateCatalog(context.Background(), in) assert.NoError(err) assert.NotNil(got) assertPluginBasedPublicId(t, HostCatalogPrefix, got.PublicId) @@ -320,7 +320,7 @@ func TestRepository_CreateCatalog(t *testing.T) { assert.Equal(in.Description, got.Description) assert.Equal(got.CreateTime, got.UpdateTime) - got2, err := repo.CreateCatalog(context.Background(), in) + got2, _, err := repo.CreateCatalog(context.Background(), in) assert.Truef(errors.Match(errors.T(errors.NotUnique), err), "want err code: %v got err: %v", errors.NotUnique, err) assert.Nil(got2) }) @@ -342,7 +342,7 @@ func TestRepository_CreateCatalog(t *testing.T) { in2 := in.clone() in.ScopeId = prj.GetPublicId() - got, err := repo.CreateCatalog(context.Background(), in) + got, _, err := repo.CreateCatalog(context.Background(), in) assert.NoError(err) assert.NotNil(got) assertPluginBasedPublicId(t, HostCatalogPrefix, got.PublicId) @@ -352,7 +352,7 @@ func TestRepository_CreateCatalog(t *testing.T) { assert.Equal(got.CreateTime, got.UpdateTime) in2.ScopeId = org.GetPublicId() - got2, err := repo.CreateCatalog(context.Background(), in2) + got2, _, err := repo.CreateCatalog(context.Background(), in2) assert.NoError(err) assert.NotNil(got2) assertPluginBasedPublicId(t, HostCatalogPrefix, got2.PublicId) @@ -367,7 +367,7 @@ func assertPluginBasedPublicId(t *testing.T, prefix, actual string) { t.Helper() assert.NotEmpty(t, actual) parts := strings.Split(actual, "_") - assert.Equalf(t, 3, len(parts), "want two '_' in PublicId, got %d in %q", len(parts), actual) + assert.Equalf(t, 2, len(parts), "want 1 '_' in PublicId, got %d in %q", len(parts), actual) assert.Equalf(t, prefix, parts[0], "PublicId want prefix: %q, got: %q in %q", prefix, parts[0], actual) } @@ -377,12 +377,12 @@ func TestRepository_LookupCatalog(t *testing.T) { rw := db.New(conn) wrapper := db.TestWrapper(t) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := hostplg.TestPlugin(t, conn, "test", "test") + plg := hostplg.TestPlugin(t, conn, "test") plgm := map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, } cat := TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) - badId, err := newHostCatalogId(ctx, plg.GetIdPrefix()) + badId, err := newHostCatalogId(ctx) assert.NoError(t, err) assert.NotNil(t, badId) @@ -419,7 +419,7 @@ func TestRepository_LookupCatalog(t *testing.T) { assert.NoError(err) assert.NotNil(repo) - got, err := repo.LookupCatalog(ctx, tt.id) + got, _, err := repo.LookupCatalog(ctx, tt.id) if tt.wantErr != 0 { assert.Truef(errors.Match(errors.T(tt.wantErr), err), "want err: %q got: %q", tt.wantErr, err) return @@ -443,7 +443,7 @@ func TestRepository_ListCatalogs_Multiple_Scopes(t *testing.T) { wrapper := db.TestWrapper(t) rw := db.New(conn) kms := kms.TestKms(t, conn, wrapper) - plg := hostplg.TestPlugin(t, conn, "test", "test") + plg := hostplg.TestPlugin(t, conn, "test") plgm := map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, } @@ -463,7 +463,8 @@ func TestRepository_ListCatalogs_Multiple_Scopes(t *testing.T) { } } - got, err := repo.ListCatalogs(context.Background(), projs) + got, plgs, err := repo.ListCatalogs(context.Background(), projs) require.NoError(t, err) assert.Equal(t, total, len(got)) + assert.Contains(t, plgs, plg) } diff --git a/internal/host/plugin/repository_host_set.go b/internal/host/plugin/repository_host_set.go index a189331bb..72e58ecd4 100644 --- a/internal/host/plugin/repository_host_set.go +++ b/internal/host/plugin/repository_host_set.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/boundary/internal/host" "github.com/hashicorp/boundary/internal/kms" "github.com/hashicorp/boundary/internal/oplog" - hostplg "github.com/hashicorp/boundary/internal/plugin/host" + hostplugin "github.com/hashicorp/boundary/internal/plugin/host" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostsets" plgpb "github.com/hashicorp/boundary/sdk/pbs/plugin" "google.golang.org/grpc/codes" @@ -29,70 +29,64 @@ import ( // // Both s.Name and s.Description are optional. If s.Name is set, it must be // unique within s.CatalogId. -func (r *Repository) CreateSet(ctx context.Context, scopeId string, s *HostSet, _ ...Option) (*HostSet, error) { +func (r *Repository) CreateSet(ctx context.Context, scopeId string, s *HostSet, _ ...Option) (*HostSet, *hostplugin.Plugin, error) { const op = "plugin.(Repository).CreateSet" if s == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "nil HostSet") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil HostSet") } if s.HostSet == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "nil embedded HostSet") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil embedded HostSet") } if s.CatalogId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no catalog id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no catalog id") } if s.PublicId != "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "public id not empty") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "public id not empty") } if scopeId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no scope id") } if s.Attributes == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "nil attributes") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "nil attributes") } s = s.clone() c, err := r.getCatalog(ctx, s.CatalogId) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("looking up catalog")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("looking up catalog")) } per, err := r.getPersistedDataForCatalog(ctx, c) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("looking up persisted data")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("looking up persisted data")) } - - plg := hostplg.NewPlugin("", "") - plg.PublicId = c.GetPluginId() - if err := r.reader.LookupByPublicId(ctx, plg); err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get host plugin")) - } - - id, err := newHostSetId(ctx, plg.GetIdPrefix()) + id, err := newHostSetId(ctx) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } s.PublicId = id - plgClient, ok := r.plugins[plg.GetPublicId()] + plgClient, ok := r.plugins[c.GetPluginId()] if !ok || plgClient == nil { - return nil, errors.New(ctx, errors.Internal, op, fmt.Sprintf("plugin with plugin name %q not available", plg.GetPluginName())) + return nil, nil, errors.New(ctx, errors.Internal, op, fmt.Sprintf("plugin %q not available", c.GetPluginId())) } + plgHc, err := toPluginCatalog(ctx, c) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } plgHs, err := toPluginSet(ctx, s) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } if _, err := plgClient.OnCreateSet(ctx, &plgpb.OnCreateSetRequest{Catalog: plgHc, Set: plgHs, Persisted: per}); err != nil { if status.Code(err) != codes.Unimplemented { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } } oplogWrapper, err := r.kms.GetWrapper(ctx, scopeId, kms.KeyPurposeOplog) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get oplog wrapper")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get oplog wrapper")) } var preferredEndpoints []interface{} @@ -101,7 +95,7 @@ func (r *Repository) CreateSet(ctx context.Context, scopeId string, s *HostSet, for i, e := range s.PreferredEndpoints { obj, err := host.NewPreferredEndpoint(ctx, s.PublicId, uint32(i+1), e) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } preferredEndpoints = append(preferredEndpoints, obj) } @@ -146,67 +140,71 @@ func (r *Repository) CreateSet(ctx context.Context, scopeId string, s *HostSet, if err != nil { if errors.IsUniqueError(err) { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in catalog: %s: name %s already exists", s.CatalogId, s.Name))) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in catalog: %s: name %s already exists", s.CatalogId, s.Name))) } - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in catalog: %s", s.CatalogId))) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in catalog: %s", s.CatalogId))) } - return returnedHostSet, nil + plg, err := r.getPlugin(ctx, c.GetPluginId()) + if err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + return returnedHostSet, plg, nil } // LookupSet will look up a host set in the repository and return the host // set. If the host set is not found, it will return nil, nil. // All options are ignored. -func (r *Repository) LookupSet(ctx context.Context, publicId string, opt ...host.Option) (*HostSet, error) { +func (r *Repository) LookupSet(ctx context.Context, publicId string, opt ...host.Option) (*HostSet, *hostplugin.Plugin, error) { const op = "plugin.(Repository).LookupSet" if publicId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no public id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "no public id") } - sets, err := r.getSets(ctx, publicId, "", opt...) + sets, plg, err := r.getSets(ctx, publicId, "", opt...) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } switch { case len(sets) == 0: - return nil, nil // not an error to return no rows for a "lookup" + return nil, nil, nil // not an error to return no rows for a "lookup" case len(sets) > 1: - return nil, errors.New(ctx, errors.NotSpecificIntegrity, op, fmt.Sprintf("%s matched more than 1 ", publicId)) + return nil, nil, errors.New(ctx, errors.NotSpecificIntegrity, op, fmt.Sprintf("%s matched more than 1 ", publicId)) default: - return sets[0], nil + return sets[0], plg, nil } } // ListSets returns a slice of HostSets for the catalogId. WithLimit is the // only option supported. -func (r *Repository) ListSets(ctx context.Context, catalogId string, opt ...host.Option) ([]*HostSet, error) { +func (r *Repository) ListSets(ctx context.Context, catalogId string, opt ...host.Option) ([]*HostSet, *hostplugin.Plugin, error) { const op = "plugin.(Repository).ListSets" if catalogId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "missing catalog id") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "missing catalog id") } - sets, err := r.getSets(ctx, "", catalogId, opt...) + sets, plg, err := r.getSets(ctx, "", catalogId, opt...) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } - return sets, nil + return sets, plg, nil } -func (r *Repository) getSets(ctx context.Context, publicId string, catalogId string, opt ...host.Option) ([]*HostSet, error) { +func (r *Repository) getSets(ctx context.Context, publicId string, catalogId string, opt ...host.Option) ([]*HostSet, *hostplugin.Plugin, error) { const op = "plugin.(Repository).getSets" const aggregateDelimiter = "|" const priorityDelimiter = "=" if publicId == "" && catalogId == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "missing search criteria: both host set id and catalog id are empty") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "missing search criteria: both host set id and catalog id are empty") } if publicId != "" && catalogId != "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "searching for both a host set id and a catalog id is not supported") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "searching for both a host set id and a catalog id is not supported") } opts, err := host.GetOpts(opt...) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } limit := r.defaultLimit @@ -237,12 +235,13 @@ func (r *Repository) getSets(ctx context.Context, publicId string, catalogId str var aggHostSets []*hostSetAgg if err := r.reader.SearchWhere(ctx, &aggHostSets, where, args, dbArgs...); err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in %s", publicId))) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("in %s", publicId))) } if len(aggHostSets) == 0 { - return nil, nil + return nil, nil, nil } + plgId := aggHostSets[0].PluginId sets := make([]*HostSet, 0, len(aggHostSets)) for _, agg := range aggHostSets { @@ -285,7 +284,7 @@ func (r *Repository) getSets(ctx context.Context, publicId string, catalogId str return indexi < indexj }) if sortErr != nil { - return nil, sortErr + return nil, nil, sortErr } for i, ep := range eps { // At this point they're in the correct order, but we still @@ -298,8 +297,15 @@ func (r *Repository) getSets(ctx context.Context, publicId string, catalogId str } sets = append(sets, hs) } + var plg *hostplugin.Plugin + if plgId != "" { + plg, err = r.getPlugin(ctx, plgId) + if err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + } - return sets, nil + return sets, plg, nil } // hostSetAgg is a view that aggregates the host set's value objects in to diff --git a/internal/host/plugin/repository_host_set_test.go b/internal/host/plugin/repository_host_set_test.go index c32c52853..3ffb12142 100644 --- a/internal/host/plugin/repository_host_set_test.go +++ b/internal/host/plugin/repository_host_set_test.go @@ -31,8 +31,8 @@ func TestRepository_CreateSet(t *testing.T) { kms := kms.TestKms(t, conn, wrapper) iamRepo := iam.TestRepo(t, conn, wrapper) _, prj := iam.TestScopes(t, iamRepo) - plg := hostplg.TestPlugin(t, conn, "create", "create") - unimplementedPlugin := hostplg.TestPlugin(t, conn, "unimplemented", "unimplemented") + plg := hostplg.TestPlugin(t, conn, "create") + unimplementedPlugin := hostplg.TestPlugin(t, conn, "unimplemented") var pluginReceivedAttrs *structpb.Struct plgm := map[string]plgpb.HostPluginServiceServer{ @@ -209,7 +209,7 @@ func TestRepository_CreateSet(t *testing.T) { repo, err := NewRepository(rw, rw, kms, plgm) require.NoError(err) require.NotNil(repo) - got, err := repo.CreateSet(context.Background(), prj.GetPublicId(), tt.in, tt.opts...) + got, plgInfo, err := repo.CreateSet(context.Background(), prj.GetPublicId(), tt.in, tt.opts...) if tt.wantIsErr != 0 { assert.Truef(errors.Match(errors.T(tt.wantIsErr), err), "want err: %q got: %q", tt.wantIsErr, err) assert.Nil(got) @@ -226,6 +226,7 @@ func TestRepository_CreateSet(t *testing.T) { wantedPluginAttributes := &structpb.Struct{} require.NoError(proto.Unmarshal(tt.want.Attributes, wantedPluginAttributes)) assert.Empty(cmp.Diff(wantedPluginAttributes, pluginReceivedAttrs, protocmp.Transform())) + assert.Empty(cmp.Diff(plgInfo, plg, protocmp.Transform())) assert.NoError(db.TestVerifyOplog(t, rw, got.GetPublicId(), db.WithOperation(oplog.OpType_OP_TYPE_CREATE), db.WithCreateNotBefore(10*time.Second))) }) @@ -248,7 +249,7 @@ func TestRepository_CreateSet(t *testing.T) { }, } - got, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in) + got, _, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in) require.NoError(err) require.NotNil(got) assert.True(strings.HasPrefix(got.GetPublicId(), HostSetPrefix)) @@ -257,7 +258,7 @@ func TestRepository_CreateSet(t *testing.T) { assert.Equal(in.Description, got.GetDescription()) assert.Equal(got.GetCreateTime(), got.GetUpdateTime()) - got2, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in) + got2, _, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in) assert.Truef(errors.Match(errors.T(errors.NotUnique), err), "want err code: %v got err: %v", errors.NotUnique, err) assert.Nil(got2) }) @@ -281,7 +282,7 @@ func TestRepository_CreateSet(t *testing.T) { in2 := in.clone() in.CatalogId = catalogA.PublicId - got, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in) + got, _, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in) require.NoError(err) require.NotNil(got) assert.True(strings.HasPrefix(got.GetPublicId(), HostSetPrefix)) @@ -291,7 +292,7 @@ func TestRepository_CreateSet(t *testing.T) { assert.Equal(got.GetCreateTime(), got.GetUpdateTime()) in2.CatalogId = catalogB.PublicId - got2, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in2) + got2, _, err := repo.CreateSet(context.Background(), prj.GetPublicId(), in2) require.NoError(err) require.NotNil(got2) assert.True(strings.HasPrefix(got.GetPublicId(), HostSetPrefix)) @@ -310,7 +311,7 @@ func TestRepository_LookupSet(t *testing.T) { kms := kms.TestKms(t, conn, wrapper) iamRepo := iam.TestRepo(t, conn, wrapper) _, prj := iam.TestScopes(t, iamRepo) - plg := hostplg.TestPlugin(t, conn, "lookup", "lookup") + plg := hostplg.TestPlugin(t, conn, "lookup") plgm := map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, } @@ -319,7 +320,7 @@ func TestRepository_LookupSet(t *testing.T) { hostSet := TestSet(t, conn, kms, catalog, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, }) - hostSetId, err := newHostSetId(ctx, plg.GetIdPrefix()) + hostSetId, err := newHostSetId(ctx) require.NoError(t, err) tests := []struct { @@ -350,7 +351,7 @@ func TestRepository_LookupSet(t *testing.T) { repo, err := NewRepository(rw, rw, kms, plgm) assert.NoError(err) require.NotNil(repo) - got, err := repo.LookupSet(ctx, tt.in) + got, _, err := repo.LookupSet(ctx, tt.in) if tt.wantIsErr != 0 { assert.Truef(errors.Match(errors.T(tt.wantIsErr), err), "want err: %q got: %q", tt.wantIsErr, err) assert.Nil(got) @@ -372,7 +373,7 @@ func TestRepository_ListSets(t *testing.T) { iamRepo := iam.TestRepo(t, conn, wrapper) _, prj := iam.TestScopes(t, iamRepo) - plg := hostplg.TestPlugin(t, conn, "list", "list") + plg := hostplg.TestPlugin(t, conn, "list") plgm := map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, } @@ -385,6 +386,8 @@ func TestRepository_ListSets(t *testing.T) { TestSet(t, conn, kms, catalogA, plgm), } + printoutTable(t, rw) + tests := []struct { name string in string @@ -415,7 +418,7 @@ func TestRepository_ListSets(t *testing.T) { repo, err := NewRepository(rw, rw, kms, plgm) assert.NoError(err) require.NotNil(repo) - got, err := repo.ListSets(context.Background(), tt.in, tt.opts...) + got, gotPlg, err := repo.ListSets(context.Background(), tt.in, tt.opts...) if tt.wantIsErr != 0 { assert.Truef(errors.Match(errors.T(tt.wantIsErr), err), "want err: %q got: %q", tt.wantIsErr, err) assert.Nil(got) @@ -427,6 +430,9 @@ func TestRepository_ListSets(t *testing.T) { protocmp.Transform(), } assert.Empty(cmp.Diff(tt.want, got, opts...)) + if got != nil { + assert.Empty(cmp.Diff(plg, gotPlg, protocmp.Transform())) + } }) } } @@ -439,7 +445,7 @@ func TestRepository_ListSets_Limits(t *testing.T) { iamRepo := iam.TestRepo(t, conn, wrapper) _, prj := iam.TestScopes(t, iamRepo) - plg := hostplg.TestPlugin(t, conn, "listlimit", "listlimit") + plg := hostplg.TestPlugin(t, conn, "listlimit") plgm := map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &TestPluginServer{}, } @@ -501,9 +507,19 @@ func TestRepository_ListSets_Limits(t *testing.T) { repo, err := NewRepository(rw, rw, kms, plgm, tt.repoOpts...) assert.NoError(err) require.NotNil(repo) - got, err := repo.ListSets(context.Background(), hostSets[0].CatalogId, tt.listOpts...) + got, gotPlg, err := repo.ListSets(context.Background(), hostSets[0].CatalogId, tt.listOpts...) require.NoError(err) assert.Len(got, tt.wantLen) + assert.Empty(cmp.Diff(plg, gotPlg, protocmp.Transform())) }) } } + +func printoutTable(t *testing.T, rw *db.Db) { + ctx := context.Background() + hsas := []*hostSetAgg{} + require.NoError(t, rw.SearchWhere(ctx, &hsas, "", nil)) + for _, hs := range hsas { + t.Logf("%#v", hs) + } +} diff --git a/internal/host/plugin/testing.go b/internal/host/plugin/testing.go index ed4c502df..a52814fd1 100644 --- a/internal/host/plugin/testing.go +++ b/internal/host/plugin/testing.go @@ -25,11 +25,11 @@ func TestCatalog(t *testing.T, conn *gorm.DB, scopeId, pluginId string, opt ...O require.NoError(t, err) assert.NotNil(t, cat) - plg := host.NewPlugin("", "") + plg := host.NewPlugin() plg.PublicId = pluginId require.NoError(t, w.LookupByPublicId(ctx, plg)) - id, err := newHostCatalogId(ctx, plg.GetIdPrefix()) + id, err := newHostCatalogId(ctx) assert.NoError(t, err) assert.NotEmpty(t, id) cat.PublicId = id @@ -54,15 +54,15 @@ func TestSet(t *testing.T, conn *gorm.DB, kmsCache *kms.Kms, hc *HostCatalog, pl require.NoError(err) require.NotNil(set) - plg := host.NewPlugin("", "") + plg := host.NewPlugin() plg.PublicId = hc.GetPluginId() require.NoError(rw.LookupByPublicId(ctx, plg)) - id, err := newHostSetId(ctx, plg.GetIdPrefix()) + id, err := newHostSetId(ctx) require.NoError(err) require.NotEmpty(id) - set, err = repo.CreateSet(ctx, hc.ScopeId, set, opt...) + set, _, err = repo.CreateSet(ctx, hc.ScopeId, set, opt...) require.NoError(err) return set diff --git a/internal/host/plugin/testing_test.go b/internal/host/plugin/testing_test.go index d5b7efbf1..713869669 100644 --- a/internal/host/plugin/testing_test.go +++ b/internal/host/plugin/testing_test.go @@ -1,8 +1,6 @@ package plugin import ( - "fmt" - "strings" "testing" "github.com/hashicorp/boundary/internal/db" @@ -22,13 +20,13 @@ func Test_TestCatalogs(t *testing.T) { require.NotNil(proj) assert.NotEmpty(proj.GetPublicId()) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") require.NotNil(plg) assert.NotEmpty(plg.GetPublicId()) cs := TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId(), WithName("foo"), WithDescription("bar")) assert.NotEmpty(cs.GetPublicId()) - assert.True(strings.HasPrefix(cs.GetPublicId(), fmt.Sprintf("%s_%s", HostCatalogPrefix, "prefix"))) + db.AssertPublicId(t, HostCatalogPrefix, cs.GetPublicId()) assert.Equal("foo", cs.GetName()) assert.Equal("bar", cs.GetDescription()) } @@ -42,14 +40,14 @@ func Test_TestSet(t *testing.T) { require.NotNil(prj) assert.NotEmpty(prj.GetPublicId()) - plg := host.TestPlugin(t, conn, "test", "prefix") + plg := host.TestPlugin(t, conn, "test") require.NotNil(plg) assert.NotEmpty(plg.GetPublicId()) c := TestCatalog(t, conn, prj.GetPublicId(), plg.GetPublicId()) set := TestSet(t, conn, kmsCache, c, map[string]plgpb.HostPluginServiceServer{plg.GetPublicId(): &TestPluginServer{}}, WithName("foo"), WithDescription("bar")) assert.NotEmpty(set.GetPublicId()) - assert.True(strings.HasPrefix(set.GetPublicId(), fmt.Sprintf("%s_%s", HostSetPrefix, "prefix"))) + db.AssertPublicId(t, HostSetPrefix, set.GetPublicId()) assert.Equal("foo", set.GetName()) assert.Equal("bar", set.GetDescription()) } diff --git a/internal/host/preferred_endpoint_test.go b/internal/host/preferred_endpoint_test.go index aaaca17e7..738a16b40 100644 --- a/internal/host/preferred_endpoint_test.go +++ b/internal/host/preferred_endpoint_test.go @@ -25,7 +25,7 @@ func TestPreferredEndpoint_Create(t *testing.T) { kmsCache := kms.TestKms(t, conn, wrapper) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := hostplg.TestPlugin(t, conn, "create", "create") + plg := hostplg.TestPlugin(t, conn, "create") catalog := plugin.TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) set := plugin.TestSet(t, conn, kmsCache, catalog, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -155,7 +155,7 @@ func TestPreferredEndpoint_Delete(t *testing.T) { kmsCache := kms.TestKms(t, conn, wrapper) _, prj := iam.TestScopes(t, iam.TestRepo(t, conn, wrapper)) - plg := hostplg.TestPlugin(t, conn, "create", "create") + plg := hostplg.TestPlugin(t, conn, "create") catalog := plugin.TestCatalog(t, conn, prj.PublicId, plg.GetPublicId()) set := plugin.TestSet(t, conn, kmsCache, catalog, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plgpb.UnimplementedHostPluginServiceServer{}, diff --git a/internal/perms/output_fields.go b/internal/perms/output_fields.go index 9f6a497e1..b50a39d88 100644 --- a/internal/perms/output_fields.go +++ b/internal/perms/output_fields.go @@ -71,6 +71,8 @@ func (o OutputFieldsMap) SelfOrDefaults(userId string) OutputFieldsMap { globals.IdField: true, globals.ScopeField: true, globals.ScopeIdField: true, + globals.PluginIdField: true, + globals.PluginField: true, globals.NameField: true, globals.DescriptionField: true, globals.TypeField: true, diff --git a/internal/perms/output_fields_test.go b/internal/perms/output_fields_test.go index a2f2b96e0..7a7080559 100644 --- a/internal/perms/output_fields_test.go +++ b/internal/perms/output_fields_test.go @@ -253,6 +253,8 @@ func Test_ACLSelfOrDefault(t *testing.T) { globals.IdField: true, globals.ScopeField: true, globals.ScopeIdField: true, + globals.PluginField: true, + globals.PluginIdField: true, globals.NameField: true, globals.DescriptionField: true, globals.TypeField: true, diff --git a/internal/plugin/host/ids.go b/internal/plugin/host/ids.go index c042b3c2a..5aafccb31 100644 --- a/internal/plugin/host/ids.go +++ b/internal/plugin/host/ids.go @@ -7,7 +7,7 @@ import ( // PublicId prefixes for the resources in the plugin package. const ( - PluginPrefix = "plgh" + PluginPrefix = "pl" ) func newPluginId() (string, error) { diff --git a/internal/plugin/host/immutable_fields_test.go b/internal/plugin/host/immutable_fields_test.go index d4e48b6e8..ebb2faf3b 100644 --- a/internal/plugin/host/immutable_fields_test.go +++ b/internal/plugin/host/immutable_fields_test.go @@ -19,7 +19,7 @@ func TestHostPlugin_ImmutableFields(t *testing.T) { w := db.New(conn) ts := timestamp.Timestamp{Timestamp: ×tamppb.Timestamp{Seconds: 0, Nanos: 0}} - plg := TestPlugin(t, conn, "test", "prefix") + plg := TestPlugin(t, conn, "test") newPlugin := plg @@ -46,15 +46,6 @@ func TestHostPlugin_ImmutableFields(t *testing.T) { }(), fieldMask: []string{"CreateTime"}, }, - { - name: "pluginName", - update: func() *Plugin { - c := newPlugin.testClonePlugin() - c.PluginName = "different pluginName" - return c - }(), - fieldMask: []string{"PluginName"}, - }, } for _, tt := range tests { tt := tt diff --git a/internal/plugin/host/plugin.go b/internal/plugin/host/plugin.go index b6a205ca7..a7ef7c9f5 100644 --- a/internal/plugin/host/plugin.go +++ b/internal/plugin/host/plugin.go @@ -16,12 +16,10 @@ type Plugin struct { // NewPlugin creates a new in memory Plugin assigned to the global scope. // Name, Description are the only allowed option. All other options are ignored. -func NewPlugin(pluginName, idPrefix string, opt ...Option) *Plugin { +func NewPlugin(opt ...Option) *Plugin { opts := getOpts(opt...) p := &Plugin{ Plugin: &store.Plugin{ - PluginName: pluginName, - IdPrefix: idPrefix, ScopeId: scope.Global.String(), Name: opts.withName, Description: opts.withDescription, diff --git a/internal/plugin/host/plugin_test.go b/internal/plugin/host/plugin_test.go index a70476494..0bd6a3c30 100644 --- a/internal/plugin/host/plugin_test.go +++ b/internal/plugin/host/plugin_test.go @@ -15,168 +15,50 @@ import ( func TestPlugin_Create(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") - type args struct { - pluginName string - idPrefix string - opts []Option - } + type args struct{} tests := []struct { name string - args args + opts []Option want *Plugin wantErr bool }{ { - name: "blank-pluginName", - args: args{ - idPrefix: "prefix", - }, + name: "valid", want: &Plugin{ Plugin: &store.Plugin{ - IdPrefix: "prefix", - ScopeId: scope.Global.String(), - }, - }, - wantErr: true, - }, - { - name: "blank-idPrefix", - args: args{ - pluginName: "plugin name", - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "plugin name", - ScopeId: scope.Global.String(), - }, - }, - wantErr: true, - }, - { - name: "idprefix-capitalized", - args: args{ - pluginName: "idprefixcapitalized", - idPrefix: "IdPrefixCapitalized", - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "idprefixcapitalized", - IdPrefix: "IdPrefixCapitalized", - ScopeId: scope.Global.String(), - }, - }, - wantErr: true, - }, - { - name: "idprefix-space", - args: args{ - pluginName: "idprefix space", - idPrefix: "idprefix space", - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "idprefix space", - IdPrefix: "idprefix space", - ScopeId: scope.Global.String(), - }, - }, - wantErr: true, - }, - { - name: "pluginName-capitalized", - args: args{ - pluginName: "PluginNameCapitalized", - idPrefix: "pluginnamecapitalized", - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "PluginNameCapitalized", - IdPrefix: "pluginnamecapitalized", - ScopeId: scope.Global.String(), - }, - }, - wantErr: true, - }, - { - name: "valid-no-options", - args: args{ - pluginName: "validnooptions", - idPrefix: "validnooptions", - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "validnooptions", - IdPrefix: "validnooptions", - ScopeId: scope.Global.String(), + ScopeId: scope.Global.String(), }, }, }, { - name: "valid-with-description", - args: args{ - pluginName: "validwithdescription", - idPrefix: "validwithdescription", - opts: []Option{ - WithDescription("description"), - }, - }, + name: "with-name", + opts: []Option{WithName("foo")}, want: &Plugin{ Plugin: &store.Plugin{ - PluginName: "validwithdescription", - IdPrefix: "validwithdescription", + Name: "foo", + ScopeId: scope.Global.String(), + }, + }, + }, + { + name: "with-description", + opts: []Option{WithDescription("foo")}, + want: &Plugin{ + Plugin: &store.Plugin{ + Description: "foo", ScopeId: scope.Global.String(), - Description: "description", - }, - }, - }, - { - name: "valid-pluginName-name-option", - args: args{ - pluginName: "validpluginnamenameoption", - idPrefix: "validpluginnamenameoption", - opts: []Option{ - WithName("valid-pluginName-name-option"), - WithDescription("description"), - }, - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "validpluginnamenameoption", - IdPrefix: "validpluginnamenameoption", - ScopeId: scope.Global.String(), - Name: "valid-pluginName-name-option", - Description: "description", }, }, }, // This must be run after the "valid-no-options" test { - name: "duplicate-pluginName", - args: args{ - pluginName: "validnooptions", - idPrefix: "duplicatepluginname", - }, + name: "duplicate-name", + opts: []Option{WithName("foo")}, want: &Plugin{ Plugin: &store.Plugin{ - PluginName: "validnooptions", - IdPrefix: "duplicatepluginname", - ScopeId: scope.Global.String(), - }, - }, - wantErr: true, - }, - { - name: "duplicate-idPrefix", - args: args{ - pluginName: "duplicateidprefix", - idPrefix: "validnooptions", - }, - want: &Plugin{ - Plugin: &store.Plugin{ - PluginName: "duplicateidprefix", - IdPrefix: "validnooptions", - ScopeId: scope.Global.String(), + Name: "foo", + ScopeId: scope.Global.String(), }, }, wantErr: true, @@ -186,7 +68,7 @@ func TestPlugin_Create(t *testing.T) { for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { - got := NewPlugin(tt.args.pluginName, tt.args.idPrefix, tt.args.opts...) + got := NewPlugin(tt.opts...) require.NotNil(t, got) require.Emptyf(t, got.PublicId, "PublicId set") @@ -212,7 +94,7 @@ func TestPlugin_Update(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") w := db.New(conn) ctx := context.Background() - plg := TestPlugin(t, conn, "delete-plugin", "prefix") + plg := TestPlugin(t, conn, "delete-plugin") assert.Equal(t, uint32(1), plg.Version) plg.Name = "New" @@ -230,7 +112,7 @@ func TestPlugin_Delete(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") w := db.New(conn) ctx := context.Background() - plg := TestPlugin(t, conn, "delete-plugin", "prefix") + plg := TestPlugin(t, conn, "delete-plugin") deleted, err := w.Delete(ctx, plg) require.NoError(t, err) @@ -261,7 +143,7 @@ func TestPlugin_SetTableName(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) - def := NewPlugin("", "prefix") + def := NewPlugin() require.Equal(defaultTableName, def.TableName()) s := &Plugin{ Plugin: &store.Plugin{}, diff --git a/internal/plugin/host/repository_plugin.go b/internal/plugin/host/repository_plugin.go index 574ade970..e3669fefa 100644 --- a/internal/plugin/host/repository_plugin.go +++ b/internal/plugin/host/repository_plugin.go @@ -16,9 +16,6 @@ import ( // contain a valid ScopeID. p must not contain a PublicId. The PublicId is // generated and assigned by this method. opt is ignored. // -// Both p.IdPrefix and p.PluginName are required and must match. The -// p.IdPrefix must contain only lower case alphanumeric characters. -// // Both p.Name and p.Description are optional. If p.Name is set, it must be // unique within p.ScopeID. // @@ -40,17 +37,6 @@ func (r *Repository) CreatePlugin(ctx context.Context, p *Plugin, _ ...Option) ( if p.PublicId != "" { return nil, errors.New(ctx, errors.InvalidParameter, op, "public id not empty") } - if p.PluginName == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no plugin name") - } - if p.IdPrefix == "" { - return nil, errors.New(ctx, errors.InvalidParameter, op, "no id prefix") - } - // TODO: remove the restriction on prefix having to be the same as plugin name - if p.PluginName != p.IdPrefix { - return nil, errors.New(ctx, errors.InvalidParameter, op, "id prefix and plugin name don't match") - } - p = p.clone() id, err := newPluginId() @@ -112,16 +98,16 @@ func (r *Repository) LookupPlugin(ctx context.Context, id string, _ ...Option) ( return c, nil } -// LookupPluginByPluginName returns the Plugin for a given name. Returns nil, nil if no +// LookupPluginByName returns the Plugin for a given name. Returns nil, nil if no // Plugin is found with that plugin name. -func (r *Repository) LookupPluginByPluginName(ctx context.Context, name string, _ ...Option) (*Plugin, error) { - const op = "host.(Repository).LookupPluginByPluginName" +func (r *Repository) LookupPluginByName(ctx context.Context, name string, _ ...Option) (*Plugin, error) { + const op = "host.(Repository).LookupPluginByName" if name == "" { return nil, errors.New(ctx, errors.InvalidParameter, op, "no plugin name") } p := allocPlugin() - if err := r.reader.LookupWhere(ctx, p, "plugin_name=?", name); err != nil { + if err := r.reader.LookupWhere(ctx, p, "name=?", name); err != nil { if errors.IsNotFoundError(err) { return nil, nil } diff --git a/internal/plugin/host/repository_plugin_test.go b/internal/plugin/host/repository_plugin_test.go index 262aaf99c..2ec31fa46 100644 --- a/internal/plugin/host/repository_plugin_test.go +++ b/internal/plugin/host/repository_plugin_test.go @@ -41,39 +41,18 @@ func TestRepository_CreatePlugin(t *testing.T) { in: &Plugin{}, wantIsErr: errors.InvalidParameter, }, - { - name: "valid-no-options", - in: &Plugin{ - Plugin: &store.Plugin{ - ScopeId: scope.Global.String(), - IdPrefix: "validnooptions", - PluginName: "validnooptions", - }, - }, - want: &Plugin{ - Plugin: &store.Plugin{ - ScopeId: scope.Global.String(), - IdPrefix: "validnooptions", - PluginName: "validnooptions", - }, - }, - }, { name: "valid-with-name", in: &Plugin{ Plugin: &store.Plugin{ - Name: "test-name-repo", - ScopeId: scope.Global.String(), - IdPrefix: "validwithname", - PluginName: "validwithname", + Name: "test-name-repo", + ScopeId: scope.Global.String(), }, }, want: &Plugin{ Plugin: &store.Plugin{ - Name: "test-name-repo", - ScopeId: scope.Global.String(), - IdPrefix: "validwithname", - PluginName: "validwithname", + Name: "test-name-repo", + ScopeId: scope.Global.String(), }, }, }, @@ -83,37 +62,20 @@ func TestRepository_CreatePlugin(t *testing.T) { Plugin: &store.Plugin{ Description: "test-description-repo", ScopeId: scope.Global.String(), - IdPrefix: "validwithdescription", - PluginName: "validwithdescription", }, }, want: &Plugin{ Plugin: &store.Plugin{ Description: "test-description-repo", ScopeId: scope.Global.String(), - IdPrefix: "validwithdescription", - PluginName: "validwithdescription", }, }, }, - { - name: "mismatching-prefix-plugin-name", - in: &Plugin{ - Plugin: &store.Plugin{ - ScopeId: scope.Global.String(), - IdPrefix: "foo", - PluginName: "bar", - }, - }, - wantIsErr: errors.InvalidParameter, - }, { name: "non-global-scope", in: &Plugin{ Plugin: &store.Plugin{ - ScopeId: "o_1234567890", - IdPrefix: "foo", - PluginName: "foo", + ScopeId: "o_1234567890", }, }, wantIsErr: errors.InvalidParameter, @@ -150,38 +112,8 @@ func TestRepository_CreatePlugin(t *testing.T) { assert.NotNil(repo) in := &Plugin{ Plugin: &store.Plugin{ - ScopeId: scope.Global.String(), - IdPrefix: "invalidduplicatenames", - PluginName: "invalidduplicatenames", - Name: "invalid-duplicate-names", - }, - } - - got, err := repo.CreatePlugin(context.Background(), in) - assert.NoError(err) - assert.NotNil(got) - assertPublicId(t, PluginPrefix, got.PublicId) - assert.NotSame(in, got) - assert.Equal(in.Name, got.Name) - assert.Equal(in.Description, got.Description) - assert.Equal(got.CreateTime, got.UpdateTime) - - got2, err := repo.CreatePlugin(context.Background(), in) - assert.Truef(errors.Match(errors.T(errors.NotUnique), err), "want err code: %v got err: %v", errors.NotUnique, err) - assert.Nil(got2) - }) - - t.Run("invalid-duplicate-plugin-names-prefixes", func(t *testing.T) { - assert := assert.New(t) - kms := kms.TestKms(t, conn, wrapper) - repo, err := NewRepository(rw, rw, kms) - assert.NoError(err) - assert.NotNil(repo) - in := &Plugin{ - Plugin: &store.Plugin{ - ScopeId: scope.Global.String(), - IdPrefix: "invalidduplicatepluginnames", - PluginName: "invalidduplicatepluginnames", + ScopeId: scope.Global.String(), + Name: "invalid-duplicate-names", }, } @@ -212,7 +144,7 @@ func TestRepository_LookupPlugin(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") rw := db.New(conn) wrapper := db.TestWrapper(t) - plg := TestPlugin(t, conn, "test", "test") + plg := TestPlugin(t, conn, "test") badId, err := newPluginId() assert.NoError(t, err) assert.NotNil(t, badId) @@ -268,11 +200,11 @@ func TestRepository_LookupPlugin(t *testing.T) { } } -func TestRepository_LookupPluginByPluginName(t *testing.T) { +func TestRepository_LookupPluginByName(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") rw := db.New(conn) wrapper := db.TestWrapper(t) - plg := TestPlugin(t, conn, "name123", "name123") + plg := TestPlugin(t, conn, "name123") tests := []struct { name string @@ -282,7 +214,7 @@ func TestRepository_LookupPluginByPluginName(t *testing.T) { }{ { name: "found", - pluginName: plg.GetPluginName(), + pluginName: plg.GetName(), want: plg, }, { @@ -307,7 +239,7 @@ func TestRepository_LookupPluginByPluginName(t *testing.T) { assert.NoError(err) assert.NotNil(repo) - got, err := repo.LookupPluginByPluginName(context.Background(), tt.pluginName) + got, err := repo.LookupPluginByName(context.Background(), tt.pluginName) if tt.wantErr != 0 { assert.Truef(errors.Match(errors.T(tt.wantErr), err), "want err: %q got: %q", tt.wantErr, err) return diff --git a/internal/plugin/host/store/plugin.pb.go b/internal/plugin/host/store/plugin.pb.go index ac2cade04..413893e11 100644 --- a/internal/plugin/host/store/plugin.pb.go +++ b/internal/plugin/host/store/plugin.pb.go @@ -49,12 +49,6 @@ type Plugin struct { ScopeId string `protobuf:"bytes,60,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" gorm:"not_null"` // @inject_tag: `gorm:"default:null"` Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty" gorm:"default:null"` - // plugin_name is required. The value must be unique across all host plugins - // @inject_tag: `gorm:"default:null"` - PluginName string `protobuf:"bytes,80,opt,name=plugin_name,json=pluginName,proto3" json:"plugin_name,omitempty" gorm:"default:null"` - // id_prefix is required. The value must be unique across all host plugins - // @inject_tag: `gorm:"default:null"` - IdPrefix string `protobuf:"bytes,90,opt,name=id_prefix,json=idPrefix,proto3" json:"id_prefix,omitempty" gorm:"default:null"` } func (x *Plugin) Reset() { @@ -138,20 +132,6 @@ func (x *Plugin) GetVersion() uint32 { return 0 } -func (x *Plugin) GetPluginName() string { - if x != nil { - return x.PluginName - } - return "" -} - -func (x *Plugin) GetIdPrefix() string { - if x != nil { - return x.IdPrefix - } - return "" -} - var File_controller_storage_plugin_host_store_v1_plugin_proto protoreflect.FileDescriptor var file_controller_storage_plugin_host_store_v1_plugin_proto_rawDesc = []byte{ @@ -166,7 +146,7 @@ var file_controller_storage_plugin_host_store_v1_plugin_proto_rawDesc = []byte{ 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, 0x9a, 0x03, 0x0a, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdc, 0x02, 0x0a, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x0a, 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, @@ -188,16 +168,12 @@ var file_controller_storage_plugin_host_store_v1_plugin_proto_rawDesc = []byte{ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x3c, 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, 0x46, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, - 0x69, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x69, 0x64, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 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, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 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, + 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 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, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 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 ( diff --git a/internal/plugin/host/testing.go b/internal/plugin/host/testing.go index ff585ed4b..2bc6fa35d 100644 --- a/internal/plugin/host/testing.go +++ b/internal/plugin/host/testing.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/require" ) -func TestPlugin(t *testing.T, conn *gorm.DB, name string, prefix string) *Plugin { +func TestPlugin(t *testing.T, conn *gorm.DB, name string) *Plugin { t.Helper() - p := NewPlugin(name, prefix) + p := NewPlugin(WithName(name)) id, err := newPluginId() require.NoError(t, err) p.PublicId = id diff --git a/internal/plugin/host/testing_test.go b/internal/plugin/host/testing_test.go index 916883773..f72a7f755 100644 --- a/internal/plugin/host/testing_test.go +++ b/internal/plugin/host/testing_test.go @@ -12,7 +12,7 @@ func Test_TestPlugins(t *testing.T) { assert, require := assert.New(t), require.New(t) conn, _ := db.TestSetup(t, "postgres") - plg := TestPlugin(t, conn, "test", "prefix") + plg := TestPlugin(t, conn, "test") require.NotNil(plg) assert.NotEmpty(plg.GetPublicId()) } diff --git a/internal/proto/local/controller/api/resources/hostcatalogs/v1/host_catalog.proto b/internal/proto/local/controller/api/resources/hostcatalogs/v1/host_catalog.proto index 80faeae35..325768684 100644 --- a/internal/proto/local/controller/api/resources/hostcatalogs/v1/host_catalog.proto +++ b/internal/proto/local/controller/api/resources/hostcatalogs/v1/host_catalog.proto @@ -8,6 +8,7 @@ import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; import "controller/api/resources/scopes/v1/scope.proto"; +import "controller/api/resources/plugins/v1/plugin.proto"; import "controller/custom_options/v1/options.proto"; // HostCatalog manages Hosts and Host Sets @@ -21,6 +22,12 @@ message HostCatalog { // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; + // The ID of the plugin of which this catalog is created. + string plugin_id = 34 [json_name="plugin_id"]; + + // Output only. Plugin information for this resource. + resources.plugins.v1.PluginInfo plugin = 35; + // Optional name for identification purposes. google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}]; diff --git a/internal/proto/local/controller/api/resources/hosts/v1/host.proto b/internal/proto/local/controller/api/resources/hosts/v1/host.proto index 64ddd494e..1a7794329 100644 --- a/internal/proto/local/controller/api/resources/hosts/v1/host.proto +++ b/internal/proto/local/controller/api/resources/hosts/v1/host.proto @@ -8,6 +8,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "controller/api/resources/scopes/v1/scope.proto"; +import "controller/api/resources/plugins/v1/plugin.proto"; import "controller/custom_options/v1/options.proto"; // Host contains all fields related to a Host resource @@ -21,6 +22,9 @@ message Host { // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; + // Output only. Plugin information for this resource. + resources.plugins.v1.PluginInfo plugin = 35; + // Optional name for identification purposes. google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}]; diff --git a/internal/proto/local/controller/api/resources/hostsets/v1/host_set.proto b/internal/proto/local/controller/api/resources/hostsets/v1/host_set.proto index 28f4d204b..2fcdba617 100644 --- a/internal/proto/local/controller/api/resources/hostsets/v1/host_set.proto +++ b/internal/proto/local/controller/api/resources/hostsets/v1/host_set.proto @@ -8,6 +8,7 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "controller/api/resources/scopes/v1/scope.proto"; +import "controller/api/resources/plugins/v1/plugin.proto"; import "controller/custom_options/v1/options.proto"; // HostSet is a collection of Hosts created and managed by a Host Catalog @@ -21,6 +22,9 @@ message HostSet { // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; + // Output only. Plugin information for this resource. + resources.plugins.v1.PluginInfo plugin = 35; + // Optional name for identification purposes. google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}]; diff --git a/internal/proto/local/controller/api/resources/plugins/v1/plugin.proto b/internal/proto/local/controller/api/resources/plugins/v1/plugin.proto new file mode 100644 index 000000000..2b1e28b38 --- /dev/null +++ b/internal/proto/local/controller/api/resources/plugins/v1/plugin.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package controller.api.resources.plugins.v1; + +option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins;plugins"; + +message PluginInfo { + // Output only. The ID of the Plugin. + string id = 1; + + // Output only. The name of the plugin resource in boundary, if any. + string name = 2; + + // Output only. The description of the plugin in boundary, if any. + string description = 3; +} \ No newline at end of file diff --git a/internal/proto/local/controller/api/services/v1/host_catalog_service.proto b/internal/proto/local/controller/api/services/v1/host_catalog_service.proto index 653f6e98e..ad6fc7dab 100644 --- a/internal/proto/local/controller/api/services/v1/host_catalog_service.proto +++ b/internal/proto/local/controller/api/services/v1/host_catalog_service.proto @@ -103,6 +103,9 @@ message ListHostCatalogsResponse { message CreateHostCatalogRequest { api.resources.hostcatalogs.v1.HostCatalog item = 1; + // As an alternative to providing the plugin id in the provided HostCatalog, + // this field can be used to lookup the plugin using it's name. + string plugin_name = 2; } message CreateHostCatalogResponse { diff --git a/internal/proto/local/controller/storage/plugin/host/store/v1/plugin.proto b/internal/proto/local/controller/storage/plugin/host/store/v1/plugin.proto index 75d2efc8e..3d7f54ba2 100644 --- a/internal/proto/local/controller/storage/plugin/host/store/v1/plugin.proto +++ b/internal/proto/local/controller/storage/plugin/host/store/v1/plugin.proto @@ -34,12 +34,4 @@ message Plugin { // @inject_tag: `gorm:"default:null"` uint32 version = 70; - - // plugin_name is required. The value must be unique across all host plugins - // @inject_tag: `gorm:"default:null"` - string plugin_name = 80; - - // id_prefix is required. The value must be unique across all host plugins - // @inject_tag: `gorm:"default:null"` - string id_prefix = 90; } \ No newline at end of file diff --git a/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go b/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go index 5772131d1..d5879439c 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go @@ -3,7 +3,6 @@ package host_catalogs import ( "context" "fmt" - "strings" "github.com/hashicorp/boundary/globals" "github.com/hashicorp/boundary/internal/errors" @@ -13,6 +12,7 @@ import ( "github.com/hashicorp/boundary/internal/host/static" "github.com/hashicorp/boundary/internal/host/static/store" "github.com/hashicorp/boundary/internal/perms" + hostplugin "github.com/hashicorp/boundary/internal/plugin/host" "github.com/hashicorp/boundary/internal/requests" "github.com/hashicorp/boundary/internal/servers/controller/auth" "github.com/hashicorp/boundary/internal/servers/controller/common" @@ -24,6 +24,7 @@ import ( "github.com/hashicorp/boundary/internal/types/resource" "github.com/hashicorp/boundary/internal/types/scope" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostcatalogs" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" "google.golang.org/grpc/codes" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/structpb" @@ -120,7 +121,7 @@ func (s Service) ListHostCatalogs(ctx context.Context, req *pbs.ListHostCatalogs return &pbs.ListHostCatalogsResponse{}, nil } - ul, err := s.listFromRepo(ctx, scopeIds) + ul, pluginInfoMap, err := s.listFromRepo(ctx, scopeIds) if err != nil { return nil, err } @@ -160,6 +161,12 @@ func (s Service) ListHostCatalogs(ctx context.Context, req *pbs.ListHostCatalogs } outputOpts = append(outputOpts, handlers.WithAuthorizedCollectionActions(collectionActions)) } + switch hc := item.(type) { + case *plugin.HostCatalog: + if plgInfo, ok := pluginInfoMap[hc.GetPluginId()]; ok { + outputOpts = append(outputOpts, handlers.WithPlugin(plgInfo)) + } + } item, err := toProto(ctx, item, outputOpts...) if err != nil { @@ -184,7 +191,7 @@ func (s Service) GetHostCatalog(ctx context.Context, req *pbs.GetHostCatalogRequ if authResults.Error != nil { return nil, authResults.Error } - hc, err := s.getFromRepo(ctx, req.GetId()) + hc, plg, err := s.getFromRepo(ctx, req.GetId()) if err != nil { return nil, err } @@ -209,6 +216,9 @@ func (s Service) GetHostCatalog(ctx context.Context, req *pbs.GetHostCatalogRequ } outputOpts = append(outputOpts, handlers.WithAuthorizedCollectionActions(collectionActions)) } + if plg != nil { + outputOpts = append(outputOpts, handlers.WithPlugin(plg)) + } item, err := toProto(ctx, hc, outputOpts...) if err != nil { @@ -229,7 +239,7 @@ func (s Service) CreateHostCatalog(ctx context.Context, req *pbs.CreateHostCatal if authResults.Error != nil { return nil, authResults.Error } - hc, err := s.createInRepo(ctx, authResults.Scope.GetId(), req.GetItem()) + hc, plg, err := s.createInRepo(ctx, authResults.Scope.GetId(), req) if err != nil { return nil, err } @@ -239,7 +249,7 @@ func (s Service) CreateHostCatalog(ctx context.Context, req *pbs.CreateHostCatal return nil, errors.New(ctx, errors.Internal, op, "no request context found") } - outputOpts := make([]handlers.Option, 0, 3) + outputOpts := make([]handlers.Option, 0, 4) outputOpts = append(outputOpts, handlers.WithOutputFields(&outputFields)) if outputFields.Has(globals.ScopeField) { outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) @@ -254,6 +264,9 @@ func (s Service) CreateHostCatalog(ctx context.Context, req *pbs.CreateHostCatal } outputOpts = append(outputOpts, handlers.WithAuthorizedCollectionActions(collectionActions)) } + if plg != nil { + outputOpts = append(outputOpts, handlers.WithPlugin(plg)) + } item, err := toProto(ctx, hc, outputOpts...) if err != nil { @@ -327,47 +340,49 @@ func (s Service) DeleteHostCatalog(ctx context.Context, req *pbs.DeleteHostCatal return nil, nil } -func (s Service) getFromRepo(ctx context.Context, id string) (host.Catalog, error) { +func (s Service) getFromRepo(ctx context.Context, id string) (host.Catalog, *plugins.PluginInfo, error) { + var plg *plugins.PluginInfo var cat host.Catalog switch host.SubtypeFromId(id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { - return nil, err + return nil, nil, err } hc, err := repo.LookupCatalog(ctx, id) if err != nil { - return nil, err + return nil, nil, err } if hc == nil { - return nil, handlers.NotFoundErrorf("Host Catalog %q doesn't exist.", id) + return nil, nil, handlers.NotFoundErrorf("Host Catalog %q doesn't exist.", id) } cat = hc case plugin.Subtype: repo, err := s.pluginHostRepoFn() if err != nil { - return nil, err + return nil, nil, err } - hc, err := repo.LookupCatalog(ctx, id) + hc, hcplg, err := repo.LookupCatalog(ctx, id) if err != nil { - return nil, err + return nil, nil, err } if hc == nil { - return nil, handlers.NotFoundErrorf("Host Catalog %q doesn't exist.", id) + return nil, nil, handlers.NotFoundErrorf("Host Catalog %q doesn't exist.", id) } cat = hc + plg = toPluginInfo(hcplg) } - return cat, nil + return cat, plg, nil } -func (s Service) listFromRepo(ctx context.Context, scopeIds []string) ([]host.Catalog, error) { +func (s Service) listFromRepo(ctx context.Context, scopeIds []string) ([]host.Catalog, map[string]*plugins.PluginInfo, error) { repo, err := s.staticRepoFn() if err != nil { - return nil, err + return nil, nil, err } ul, err := repo.ListCatalogs(ctx, scopeIds) if err != nil { - return nil, err + return nil, nil, err } var res []host.Catalog for _, c := range ul { @@ -375,16 +390,21 @@ func (s Service) listFromRepo(ctx context.Context, scopeIds []string) ([]host.Ca } pluginRepo, err := s.pluginHostRepoFn() if err != nil { - return nil, err + return nil, nil, err } - pl, err := pluginRepo.ListCatalogs(ctx, scopeIds) + pl, plgs, err := pluginRepo.ListCatalogs(ctx, scopeIds) if err != nil { - return nil, err + return nil, nil, err } for _, c := range pl { res = append(res, c) } - return res, nil + pluginsMap := make(map[string]*plugins.PluginInfo, len(plgs)) + for _, plg := range plgs { + pluginsMap[plg.GetPublicId()] = toPluginInfo(plg) + } + + return res, pluginsMap, nil } func (s Service) createStaticInRepo(ctx context.Context, projId string, item *pb.HostCatalog) (*static.HostCatalog, error) { @@ -407,42 +427,48 @@ func (s Service) createStaticInRepo(ctx context.Context, projId string, item *pb return out, nil } -func (s Service) createPluginInRepo(ctx context.Context, projId string, item *pb.HostCatalog) (*plugin.HostCatalog, error) { +func (s Service) createPluginInRepo(ctx context.Context, projId string, req *pbs.CreateHostCatalogRequest) (*plugin.HostCatalog, *plugins.PluginInfo, error) { const op = "host_catalogs.(Service).createInRepo" - plgRepo, err := s.pluginRepoFn() - if err != nil { - return nil, errors.Wrap(ctx, err, op) + item := req.GetItem() + pluginId := item.GetPluginId() + if pluginId == "" { + plgRepo, err := s.pluginRepoFn() + if err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + plg, err := plgRepo.LookupPluginByName(ctx, req.GetPluginName()) + if err != nil { + return nil, nil, errors.Wrap(ctx, err, op) + } + pluginId = plg.GetPublicId() } - plg, err := plgRepo.LookupPluginByPluginName(ctx, item.GetType()) + h, err := toStoragePluginCatalog(ctx, projId, pluginId, item) if err != nil { - return nil, errors.Wrap(ctx, err, op) - } - h, err := toStoragePluginCatalog(ctx, projId, plg.GetPublicId(), item) - if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to build catalog for creation")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to build catalog for creation")) } repo, err := s.pluginHostRepoFn() if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } - out, err := repo.CreateCatalog(ctx, h) + out, plg, err := repo.CreateCatalog(ctx, h) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to create host catalog")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to create host catalog")) } if out == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host catalog but no error returned from repository.") + return nil, nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host catalog but no error returned from repository.") } - return out, nil + return out, toPluginInfo(plg), nil } -func (s Service) createInRepo(ctx context.Context, projId string, item *pb.HostCatalog) (hc host.Catalog, err error) { - switch host.SubtypeFromType(item.GetType()) { +func (s Service) createInRepo(ctx context.Context, projId string, req *pbs.CreateHostCatalogRequest) (hc host.Catalog, info *plugins.PluginInfo, err error) { + var plg *plugins.PluginInfo + switch host.SubtypeFromType(req.GetItem().GetType()) { case static.Subtype: - hc, err = s.createStaticInRepo(ctx, projId, item) + hc, err = s.createStaticInRepo(ctx, projId, req.GetItem()) default: - hc, err = s.createPluginInRepo(ctx, projId, item) + hc, plg, err = s.createPluginInRepo(ctx, projId, req) } - return hc, err + return hc, plg, err } func (s Service) updateInRepo(ctx context.Context, projId, id string, mask []string, item *pb.HostCatalog) (*static.HostCatalog, error) { @@ -531,7 +557,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. res.Error = err return res } - cat, err := repo.LookupCatalog(ctx, id) + cat, _, err := repo.LookupCatalog(ctx, id) if err != nil { res.Error = err return res @@ -548,6 +574,17 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. return auth.Verify(ctx, opts...) } +func toPluginInfo(plg *hostplugin.Plugin) *plugins.PluginInfo { + if plg == nil { + return nil + } + return &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + } +} + func toProto(ctx context.Context, in host.Catalog, opt ...handlers.Option) (*pb.HostCatalog, error) { const op = "host_catalog_service.toProto" opts := handlers.GetOpts(opt...) @@ -563,17 +600,18 @@ func toProto(ctx context.Context, in host.Catalog, opt ...handlers.Option) (*pb. if outputFields.Has(globals.ScopeIdField) { out.ScopeId = in.GetScopeId() } + if outputFields.Has(globals.PluginIdField) { + switch hc := in.(type) { + case *plugin.HostCatalog: + out.PluginId = hc.GetPluginId() + } + } if outputFields.Has(globals.TypeField) { - switch host.SubtypeFromId(in.GetPublicId()) { - case static.Subtype: + switch in.(type) { + case *static.HostCatalog: out.Type = static.Subtype.String() - default: - // TODO: When id prefix and plugin name can diverge, update this logic. - out.Type = "plugin" - idParts := strings.Split(in.GetPublicId(), "_") - if len(idParts) > 2 { - out.Type = idParts[1] - } + case *plugin.HostCatalog: + out.Type = plugin.Subtype.String() } } if outputFields.Has(globals.DescriptionField) && in.GetDescription() != "" { @@ -594,6 +632,9 @@ func toProto(ctx context.Context, in host.Catalog, opt ...handlers.Option) (*pb. if outputFields.Has(globals.ScopeField) { out.Scope = opts.WithScope } + if outputFields.Has(globals.PluginField) { + out.Plugin = opts.WithPlugin + } if outputFields.Has(globals.AuthorizedActionsField) { out.AuthorizedActions = opts.WithAuthorizedActions } @@ -662,13 +703,7 @@ func toStoragePluginCatalog(ctx context.Context, scopeId, plgId string, item *pb // * The type asserted by the ID and/or field is known // * If relevant, the type derived from the id prefix matches what is claimed by the type field func validateGetRequest(req *pbs.GetHostCatalogRequest) error { - pluginPrefix := plugin.HostCatalogPrefix - idParts := strings.Split(req.GetId(), "_") - if len(idParts) > 2 && idParts[0] == plugin.HostCatalogPrefix { - pluginPrefix = strings.Join(idParts[:2], "_") - } - - return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, static.HostCatalogPrefix, pluginPrefix) + return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, static.HostCatalogPrefix, plugin.HostCatalogPrefix) } func validateCreateRequest(req *pbs.CreateHostCatalogRequest) error { @@ -677,8 +712,20 @@ func validateCreateRequest(req *pbs.CreateHostCatalogRequest) error { if !handlers.ValidId(handlers.Id(req.GetItem().GetScopeId()), scope.Project.Prefix()) { badFields[globals.ScopeIdField] = "This field must be a valid project scope id." } - if req.GetItem().GetType() == "" { - badFields[globals.TypeField] = "This field is required." + switch host.SubtypeFromType(req.GetItem().GetType()) { + case static.Subtype: + case plugin.Subtype: + if req.GetItem().GetPlugin() != nil { + badFields[globals.PluginField] = fmt.Sprintf("This is a read only field.") + } + if req.GetItem().GetPluginId() == "" && req.GetPluginName() == "" { + badFields[globals.PluginIdField] = fmt.Sprintf("This is a required field.") + } + if req.GetItem().GetPluginId() != "" && req.GetPluginName() != "" { + badFields[globals.PluginIdField] = fmt.Sprintf("Can't set the plugin name field along with this field.") + } + default: + badFields[globals.TypeField] = fmt.Sprintf("This is a required field and must be either %q or %q.", static.Subtype.String(), plugin.Subtype.String()) } return badFields }) @@ -690,7 +737,7 @@ func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest) error { switch host.SubtypeFromId(req.GetId()) { case static.Subtype: if req.GetItem().GetType() != "" && host.SubtypeFromType(req.GetItem().GetType()) != static.Subtype { - badFields["type"] = "Cannot modify resource type." + badFields[globals.TypeField] = "Cannot modify resource type." } } return badFields @@ -698,23 +745,17 @@ func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest) error { } func validateDeleteRequest(req *pbs.DeleteHostCatalogRequest) error { - pluginPrefix := plugin.HostCatalogPrefix - idParts := strings.Split(req.GetId(), "_") - if len(idParts) > 2 && idParts[0] == plugin.HostCatalogPrefix { - pluginPrefix = strings.Join(idParts[:2], "_") - } - - return handlers.ValidateDeleteRequest(handlers.NoopValidatorFn, req, static.HostCatalogPrefix, pluginPrefix) + return handlers.ValidateDeleteRequest(handlers.NoopValidatorFn, req, static.HostCatalogPrefix, plugin.HostCatalogPrefix) } func validateListRequest(req *pbs.ListHostCatalogsRequest) error { badFields := map[string]string{} if !handlers.ValidId(handlers.Id(req.GetScopeId()), scope.Project.Prefix()) && !req.GetRecursive() { - badFields["scope_id"] = "This field must be a valid project scope ID or the list operation must be recursive." + badFields[globals.ScopeIdField] = "This field must be a valid project scope ID or the list operation must be recursive." } if _, err := handlers.NewFilter(req.GetFilter()); err != nil { - badFields["filter"] = fmt.Sprintf("This field could not be parsed. %v", err) + badFields[globals.FilterField] = fmt.Sprintf("This field could not be parsed. %v", err) } if len(badFields) > 0 { return handlers.InvalidArgumentErrorf("Improperly formatted identifier.", badFields) diff --git a/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go b/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go index 6f2c64799..797ea630d 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers/host_catalogs" "github.com/hashicorp/boundary/internal/types/scope" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostcatalogs" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" scopepb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" plgpb "github.com/hashicorp/boundary/sdk/pbs/plugin" "google.golang.org/genproto/protobuf/field_mask" @@ -161,7 +162,7 @@ func TestGet_Plugin(t *testing.T) { return iam.TestRepo(t, conn, wrapper), nil } name := "test" - plg := host.TestPlugin(t, conn, name, name) + plg := host.TestPlugin(t, conn, name) hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) toMerge := &pbs.GetHostCatalogRequest{ @@ -169,12 +170,22 @@ func TestGet_Plugin(t *testing.T) { } pHostCatalog := &pb.HostCatalog{ - Id: hc.GetPublicId(), - ScopeId: hc.GetScopeId(), - Scope: &scopepb.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: proj.GetParentId()}, + Id: hc.GetPublicId(), + ScopeId: hc.GetScopeId(), + Scope: &scopepb.ScopeInfo{ + Id: proj.GetPublicId(), + Type: scope.Project.String(), + ParentScopeId: proj.GetParentId(), + }, + PluginId: plg.GetPublicId(), + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, CreatedTime: hc.CreateTime.GetTimestamp(), UpdatedTime: hc.UpdateTime.GetTimestamp(), - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, } @@ -272,17 +283,23 @@ func TestList(t *testing.T) { var testPluginCatalogs []*pb.HostCatalog name := "test" - plg := host.TestPlugin(t, conn, name, name) + plg := host.TestPlugin(t, conn, name) for i := 0; i < 3; i++ { hc := plugin.TestCatalog(t, conn, pWithCatalogs.GetPublicId(), plg.GetPublicId()) cat := &pb.HostCatalog{ - Id: hc.GetPublicId(), - ScopeId: hc.GetScopeId(), - CreatedTime: hc.GetCreateTime().GetTimestamp(), - UpdatedTime: hc.GetUpdateTime().GetTimestamp(), - Scope: &scopepb.ScopeInfo{Id: pWithCatalogs.GetPublicId(), Type: scope.Project.String(), ParentScopeId: oWithCatalogs.GetPublicId()}, + Id: hc.GetPublicId(), + ScopeId: hc.GetScopeId(), + CreatedTime: hc.GetCreateTime().GetTimestamp(), + UpdatedTime: hc.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: pWithCatalogs.GetPublicId(), Type: scope.Project.String(), ParentScopeId: oWithCatalogs.GetPublicId()}, + PluginId: plg.GetPublicId(), + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, Version: 1, - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, } @@ -306,17 +323,23 @@ func TestList(t *testing.T) { } name = "different" - plg = host.TestPlugin(t, conn, name, name) + diffPlg := host.TestPlugin(t, conn, name) for i := 0; i < 3; i++ { - hc := plugin.TestCatalog(t, conn, pWithOtherCatalogs.GetPublicId(), plg.GetPublicId()) + hc := plugin.TestCatalog(t, conn, pWithOtherCatalogs.GetPublicId(), diffPlg.GetPublicId()) wantOtherCatalogs = append(wantOtherCatalogs, &pb.HostCatalog{ - Id: hc.GetPublicId(), - ScopeId: hc.GetScopeId(), - CreatedTime: hc.GetCreateTime().GetTimestamp(), - UpdatedTime: hc.GetUpdateTime().GetTimestamp(), - Scope: &scopepb.ScopeInfo{Id: pWithOtherCatalogs.GetPublicId(), Type: scope.Project.String(), ParentScopeId: oWithOtherCatalogs.GetPublicId()}, + Id: hc.GetPublicId(), + ScopeId: hc.GetScopeId(), + CreatedTime: hc.GetCreateTime().GetTimestamp(), + UpdatedTime: hc.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: pWithOtherCatalogs.GetPublicId(), Type: scope.Project.String(), ParentScopeId: oWithOtherCatalogs.GetPublicId()}, + PluginId: diffPlg.GetPublicId(), + Plugin: &plugins.PluginInfo{ + Id: diffPlg.GetPublicId(), + Name: diffPlg.GetName(), + Description: diffPlg.GetDescription(), + }, Version: 1, - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }) @@ -369,10 +392,10 @@ func TestList(t *testing.T) { res: &pbs.ListHostCatalogsResponse{Items: wantSomeCatalogs}, }, { - name: "Filter To Catalog Test Type", + name: "Filter To Catalog Using Test Plugin", req: &pbs.ListHostCatalogsRequest{ ScopeId: scope.Global.String(), Recursive: true, - Filter: `"/item/type"=="test"`, + Filter: `"/item/plugin/name"=="test"`, }, res: &pbs.ListHostCatalogsResponse{Items: testPluginCatalogs}, }, @@ -684,7 +707,7 @@ func TestCreate_Plugin(t *testing.T) { wrapper := db.TestWrapper(t) kms := kms.TestKms(t, conn, wrapper) iamRepo := iam.TestRepo(t, conn, wrapper) - _, proj := iam.TestScopes(t, iamRepo) + org, proj := iam.TestScopes(t, iamRepo) rw := db.New(conn) repo := func() (*static.Repository, error) { return static.NewRepository(rw, rw, kms) @@ -697,7 +720,7 @@ func TestCreate_Plugin(t *testing.T) { } name := "test" - plg := host.TestPlugin(t, conn, name, name) + plg := host.TestPlugin(t, conn, name) pluginHostRepo := func() (*plugin.Repository, error) { return plugin.NewRepository(rw, rw, kms, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{ @@ -723,16 +746,23 @@ func TestCreate_Plugin(t *testing.T) { ScopeId: proj.GetPublicId(), Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), + PluginId: plg.GetPublicId(), }}, res: &pbs.CreateHostCatalogResponse{ - Uri: fmt.Sprintf("host-catalogs/%s_%s_", plugin.HostCatalogPrefix, name), + Uri: fmt.Sprintf("host-catalogs/%s_", plugin.HostCatalogPrefix), Item: &pb.HostCatalog{ - ScopeId: proj.GetPublicId(), - Scope: &scopepb.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: proj.GetParentId()}, + ScopeId: proj.GetPublicId(), + Scope: &scopepb.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: proj.GetParentId()}, + PluginId: plg.GetPublicId(), + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }, @@ -741,44 +771,45 @@ func TestCreate_Plugin(t *testing.T) { { name: "Cant create in org", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ - ScopeId: proj.GetParentId(), - Name: &wrappers.StringValue{Value: "name"}, - Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + ScopeId: org.GetParentId(), + Type: plugin.Subtype.String(), + PluginId: plg.GetPublicId(), }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, { name: "Cant create in global", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ - ScopeId: scope.Global.String(), - Name: &wrappers.StringValue{Value: "name"}, - Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + ScopeId: scope.Global.String(), + Type: plugin.Subtype.String(), + PluginId: plg.GetPublicId(), }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, { name: "Create with unknown type", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ - Name: &wrappers.StringValue{Value: "name"}, - Description: &wrappers.StringValue{Value: "desc"}, - Type: "thisismadeup", + ScopeId: proj.GetPublicId(), + PluginId: plg.GetPublicId(), + Type: "thisismadeup", }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, { name: "Create with no type", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ - Name: &wrappers.StringValue{Value: "name"}, - Description: &wrappers.StringValue{Value: "desc"}, + ScopeId: proj.GetPublicId(), + PluginId: plg.GetPublicId(), }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, { name: "Can't specify Id", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ - Id: "not allowed to be set", + Id: "not allowed to be set", + ScopeId: proj.GetPublicId(), + Type: plugin.Subtype.String(), + PluginId: plg.GetPublicId(), }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -787,6 +818,9 @@ func TestCreate_Plugin(t *testing.T) { name: "Can't specify Created Time", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ CreatedTime: timestamppb.Now(), + ScopeId: proj.GetPublicId(), + Type: plugin.Subtype.String(), + PluginId: plg.GetPublicId(), }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -795,6 +829,9 @@ func TestCreate_Plugin(t *testing.T) { name: "Can't specify Update Time", req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{ UpdatedTime: timestamppb.Now(), + ScopeId: proj.GetPublicId(), + Type: plugin.Subtype.String(), + PluginId: plg.GetPublicId(), }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -818,7 +855,7 @@ func TestCreate_Plugin(t *testing.T) { require.NoError(gErr) if got != nil { assert.Contains(got.GetUri(), tc.res.GetUri()) - assert.True(strings.HasPrefix(got.GetItem().GetId(), fmt.Sprintf("%s_%s_", plugin.HostCatalogPrefix, name))) + assert.True(strings.HasPrefix(got.GetItem().GetId(), fmt.Sprintf("%s_", plugin.HostCatalogPrefix))) gotCreateTime := got.GetItem().GetCreatedTime().AsTime() require.NoError(err, "Error converting proto to timestamp.") gotUpdateTime := got.GetItem().GetUpdatedTime().AsTime() diff --git a/internal/servers/controller/handlers/host_sets/host_set_service.go b/internal/servers/controller/handlers/host_sets/host_set_service.go index f4d8323f1..8cae153bb 100644 --- a/internal/servers/controller/handlers/host_sets/host_set_service.go +++ b/internal/servers/controller/handlers/host_sets/host_set_service.go @@ -3,7 +3,6 @@ package host_sets import ( "context" "fmt" - "strings" "github.com/hashicorp/boundary/globals" "github.com/hashicorp/boundary/internal/errors" @@ -14,6 +13,7 @@ import ( "github.com/hashicorp/boundary/internal/host/static/store" "github.com/hashicorp/boundary/internal/libs/endpoint" "github.com/hashicorp/boundary/internal/perms" + hostplugin "github.com/hashicorp/boundary/internal/plugin/host" "github.com/hashicorp/boundary/internal/requests" "github.com/hashicorp/boundary/internal/servers/controller/auth" "github.com/hashicorp/boundary/internal/servers/controller/common" @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/boundary/internal/types/action" "github.com/hashicorp/boundary/internal/types/resource" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostsets" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" "github.com/hashicorp/go-secure-stdlib/strutil" "google.golang.org/grpc/codes" "google.golang.org/protobuf/proto" @@ -92,7 +93,7 @@ func (s Service) ListHostSetsWithOptions(ctx context.Context, req *pbs.ListHostS if authResults.Error != nil { return nil, authResults.Error } - hl, err := s.listFromRepo(ctx, req.GetHostCatalogId(), opt...) + hl, plg, err := s.listFromRepo(ctx, req.GetHostCatalogId(), opt...) if err != nil { return nil, err } @@ -127,6 +128,9 @@ func (s Service) ListHostSetsWithOptions(ctx context.Context, req *pbs.ListHostS if outputFields.Has(globals.AuthorizedActionsField) { outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authorizedActions)) } + if plg != nil { + outputOpts = append(outputOpts, handlers.WithPlugin(plg)) + } item, err := toProto(ctx, item, nil, outputOpts...) if err != nil { @@ -151,7 +155,7 @@ func (s Service) GetHostSet(ctx context.Context, req *pbs.GetHostSetRequest) (*p if authResults.Error != nil { return nil, authResults.Error } - hs, hosts, err := s.getFromRepo(ctx, req.GetId()) + hs, hosts, plg, err := s.getFromRepo(ctx, req.GetId()) if err != nil { return nil, err } @@ -161,7 +165,7 @@ func (s Service) GetHostSet(ctx context.Context, req *pbs.GetHostSetRequest) (*p return nil, errors.New(ctx, errors.Internal, op, "no request context found") } - outputOpts := make([]handlers.Option, 0, 3) + outputOpts := make([]handlers.Option, 0, 4) outputOpts = append(outputOpts, handlers.WithOutputFields(&outputFields)) if outputFields.Has(globals.ScopeField) { outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) @@ -169,6 +173,9 @@ func (s Service) GetHostSet(ctx context.Context, req *pbs.GetHostSetRequest) (*p if outputFields.Has(globals.AuthorizedActionsField) { outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), IdActions).Strings())) } + if plg != nil { + outputOpts = append(outputOpts, handlers.WithPlugin(plg)) + } item, err := toProto(ctx, hs, hosts, outputOpts...) if err != nil { @@ -189,7 +196,7 @@ func (s Service) CreateHostSet(ctx context.Context, req *pbs.CreateHostSetReques if authResults.Error != nil { return nil, authResults.Error } - hs, err := s.createInRepo(ctx, authResults.Scope.GetId(), req.GetItem().GetHostCatalogId(), req.GetItem()) + hs, plg, err := s.createInRepo(ctx, authResults.Scope.GetId(), req.GetItem().GetHostCatalogId(), req.GetItem()) if err != nil { return nil, err } @@ -207,6 +214,9 @@ func (s Service) CreateHostSet(ctx context.Context, req *pbs.CreateHostSetReques if outputFields.Has(globals.AuthorizedActionsField) { outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), IdActions).Strings())) } + if plg != nil { + outputOpts = append(outputOpts, handlers.WithPlugin(plg)) + } item, err := toProto(ctx, hs, nil, outputOpts...) if err != nil { @@ -386,21 +396,22 @@ func (s Service) RemoveHostSetHosts(ctx context.Context, req *pbs.RemoveHostSetH return &pbs.RemoveHostSetHostsResponse{Item: item}, nil } -func (s Service) getFromRepo(ctx context.Context, id string) (host.Set, []host.Host, error) { +func (s Service) getFromRepo(ctx context.Context, id string) (host.Set, []host.Host, *plugins.PluginInfo, error) { var hs host.Set var hl []host.Host + var plg *plugins.PluginInfo switch host.SubtypeFromId(id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { - return nil, nil, err + return nil, nil, nil, err } hset, hosts, err := repo.LookupSet(ctx, id) if err != nil { - return nil, nil, err + return nil, nil, nil, err } if hset == nil { - return nil, nil, handlers.NotFoundErrorf("Host Set %q doesn't exist.", id) + return nil, nil, nil, handlers.NotFoundErrorf("Host Set %q doesn't exist.", id) } for _, h := range hosts { hl = append(hl, h) @@ -409,65 +420,68 @@ func (s Service) getFromRepo(ctx context.Context, id string) (host.Set, []host.H case plugin.Subtype: repo, err := s.pluginRepoFn() if err != nil { - return nil, nil, err + return nil, nil, nil, err } - hset, err := repo.LookupSet(ctx, id) + hset, hsplg, err := repo.LookupSet(ctx, id) if err != nil { - return nil, nil, err + return nil, nil, nil, err } if hset == nil { - return nil, nil, handlers.NotFoundErrorf("Host Set %q doesn't exist.", id) + return nil, nil, nil, handlers.NotFoundErrorf("Host Set %q doesn't exist.", id) } hs = hset + plg = toPluginInfo(hsplg) } - return hs, hl, nil + return hs, hl, plg, nil } -func (s Service) createInRepo(ctx context.Context, scopeId, catalogId string, item *pb.HostSet) (host.Set, error) { +func (s Service) createInRepo(ctx context.Context, scopeId, catalogId string, item *pb.HostSet) (host.Set, *plugins.PluginInfo, error) { const op = "host_sets.(Service).createInRepo" if item == nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "missing item") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "missing item") } var hSet host.Set + var plg *plugins.PluginInfo switch host.SubtypeFromId(catalogId) { case static.Subtype: h, err := toStorageStaticSet(ctx, catalogId, item) if err != nil { - return nil, err + return nil, nil, err } repo, err := s.staticRepoFn() if err != nil { - return nil, err + return nil, nil, err } out, err := repo.CreateSet(ctx, scopeId, h) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to create host set")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to create host set")) } if out == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host set but no error returned from repository.") + return nil, nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host set but no error returned from repository.") } hSet = out case plugin.Subtype: h, err := toStoragePluginSet(ctx, catalogId, item) if err != nil { - return nil, err + return nil, nil, err } repo, err := s.pluginRepoFn() if err != nil { - return nil, err + return nil, nil, err } - out, err := repo.CreateSet(ctx, scopeId, h) + out, hsplg, err := repo.CreateSet(ctx, scopeId, h) if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to create host set")) + return nil, nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to create host set")) } if out == nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host set but no error returned from repository.") + return nil, nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to create host set but no error returned from repository.") } hSet = out + plg = toPluginInfo(hsplg) default: - return nil, errors.New(ctx, errors.InvalidParameter, op, "unrecognized catalog type") + return nil, nil, errors.New(ctx, errors.InvalidParameter, op, "unrecognized catalog type") } - return hSet, nil + return hSet, plg, nil } func (s Service) updateInRepo(ctx context.Context, scopeId, catalogId string, req *pbs.UpdateHostSetRequest) (host.Set, []host.Host, error) { @@ -513,18 +527,19 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, return rows > 0, nil } -func (s Service) listFromRepo(ctx context.Context, catalogId string, opt ...host.Option) ([]host.Set, error) { +func (s Service) listFromRepo(ctx context.Context, catalogId string, opt ...host.Option) ([]host.Set, *plugins.PluginInfo, error) { const op = "host_sets.(Service).listFromRepo" + var plg *plugins.PluginInfo var sets []host.Set switch host.SubtypeFromId(catalogId) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { - return nil, err + return nil, nil, err } sl, err := repo.ListSets(ctx, catalogId) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } for _, a := range sl { sets = append(sets, a) @@ -532,17 +547,18 @@ func (s Service) listFromRepo(ctx context.Context, catalogId string, opt ...host case plugin.Subtype: repo, err := s.pluginRepoFn() if err != nil { - return nil, err + return nil, nil, err } - sl, err := repo.ListSets(ctx, catalogId, opt...) + sl, hsplg, err := repo.ListSets(ctx, catalogId, opt...) if err != nil { - return nil, errors.Wrap(ctx, err, op) + return nil, nil, errors.Wrap(ctx, err, op) } for _, a := range sl { sets = append(sets, a) } + plg = toPluginInfo(hsplg) } - return sets, nil + return sets, plg, nil } func (s Service) addInRepo(ctx context.Context, scopeId, setId string, hostIds []string, version uint32) (*static.HostSet, []host.Host, error) { @@ -652,7 +668,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } set = ss case plugin.Subtype: - ps, err := pluginRepo.LookupSet(ctx, id) + ps, _, err := pluginRepo.LookupSet(ctx, id) if err != nil { res.Error = err return nil, res @@ -681,7 +697,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } cat = cs case plugin.Subtype: - pc, err := pluginRepo.LookupCatalog(ctx, parentId) + pc, _, err := pluginRepo.LookupCatalog(ctx, parentId) if err != nil { res.Error = err return nil, res @@ -696,6 +712,17 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty return cat, auth.Verify(ctx, opts...) } +func toPluginInfo(plg *hostplugin.Plugin) *plugins.PluginInfo { + if plg == nil { + return nil + } + return &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + } +} + func toProto(ctx context.Context, in host.Set, hosts []host.Host, opt ...handlers.Option) (*pb.HostSet, error) { const op = "host_set_service.toProto" opts := handlers.GetOpts(opt...) @@ -712,15 +739,11 @@ func toProto(ctx context.Context, in host.Set, hosts []host.Host, opt ...handler out.HostCatalogId = in.GetCatalogId() } if outputFields.Has(globals.TypeField) { - switch host.SubtypeFromId(in.GetPublicId()) { - case static.Subtype: + switch in.(type) { + case *static.HostSet: out.Type = static.Subtype.String() - case plugin.Subtype: - out.Type = "plugin" - idParts := strings.Split(in.GetPublicId(), "_") - if len(idParts) > 2 { - out.Type = idParts[1] - } + case *plugin.HostSet: + out.Type = plugin.Subtype.String() } } if outputFields.Has(globals.DescriptionField) && in.GetDescription() != "" { @@ -741,6 +764,9 @@ func toProto(ctx context.Context, in host.Set, hosts []host.Host, opt ...handler if outputFields.Has(globals.ScopeField) { out.Scope = opts.WithScope } + if outputFields.Has(globals.PluginField) { + out.Plugin = opts.WithPlugin + } if outputFields.Has(globals.AuthorizedActionsField) { out.AuthorizedActions = opts.WithAuthorizedActions } @@ -816,26 +842,14 @@ func toStoragePluginSet(ctx context.Context, catalogId string, item *pb.HostSet) // * The type asserted by the ID and/or field is known // * If relevant, the type derived from the id prefix matches what is claimed by the type field func validateGetRequest(req *pbs.GetHostSetRequest) error { - pluginPrefix := plugin.HostSetPrefix - idParts := strings.Split(req.GetId(), "_") - if len(idParts) > 2 && idParts[0] == plugin.HostSetPrefix { - pluginPrefix = strings.Join(idParts[:2], "_") - } - - return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, static.HostSetPrefix, pluginPrefix) + return handlers.ValidateGetRequest(handlers.NoopValidatorFn, req, static.HostSetPrefix, plugin.HostSetPrefix) } func validateCreateRequest(ctx context.Context, req *pbs.CreateHostSetRequest) error { return handlers.ValidateCreateRequest(req.GetItem(), func() map[string]string { badFields := map[string]string{} - pluginPrefix := plugin.HostCatalogPrefix - idParts := strings.Split(req.GetItem().GetHostCatalogId(), "_") - if len(idParts) > 2 && idParts[0] == plugin.HostCatalogPrefix { - pluginPrefix = strings.Join(idParts[:2], "_") - } - - if !handlers.ValidId(handlers.Id(req.GetItem().GetHostCatalogId()), static.HostCatalogPrefix, pluginPrefix) { - badFields["host_catalog_id"] = "The field is incorrectly formatted." + if !handlers.ValidId(handlers.Id(req.GetItem().GetHostCatalogId()), static.HostCatalogPrefix, plugin.HostCatalogPrefix) { + badFields[globals.HostCatalogIdField] = "The field is incorrectly formatted." } if len(req.GetItem().GetPreferredEndpoints()) > 0 { _, err := endpoint.NewPreferencer(ctx, endpoint.WithPreferenceOrder(req.GetItem().GetPreferredEndpoints())) @@ -846,21 +860,11 @@ func validateCreateRequest(ctx context.Context, req *pbs.CreateHostSetRequest) e switch host.SubtypeFromId(req.GetItem().GetHostCatalogId()) { case static.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != static.Subtype.String() { - badFields["type"] = "Doesn't match the parent resource's type." + badFields[globals.TypeField] = "Doesn't match the parent resource's type." } case plugin.Subtype: - // TODO: Remove this check when plugin id prefixes can differ from plugin name - if req.GetItem().GetType() == "" { - break - } - idParts := strings.Split(req.GetItem().GetHostCatalogId(), "_") - if len(idParts) < 2 { - badFields["host_catalog_id"] = "The field is incorrectly formatted for a plugin id." - break - } - plgType := idParts[1] - if plgType != req.GetItem().GetType() { - badFields["type"] = "This type must match the type of the host catalog." + if req.GetItem().GetType() != "" && req.GetItem().GetType() != plugin.Subtype.String() { + badFields[globals.TypeField] = "Doesn't match the parent resource's type." } } return badFields @@ -891,18 +895,12 @@ func validateDeleteRequest(req *pbs.DeleteHostSetRequest) error { } func validateListRequest(req *pbs.ListHostSetsRequest) error { - pluginPrefix := plugin.HostCatalogPrefix - idParts := strings.Split(req.GetHostCatalogId(), "_") - if len(idParts) > 2 && idParts[0] == plugin.HostCatalogPrefix { - pluginPrefix = strings.Join(idParts[:2], "_") - } - badFields := map[string]string{} - if !handlers.ValidId(handlers.Id(req.GetHostCatalogId()), static.HostCatalogPrefix, pluginPrefix) { - badFields["host_catalog_id"] = "The field is incorrectly formatted." + if !handlers.ValidId(handlers.Id(req.GetHostCatalogId()), static.HostCatalogPrefix, plugin.HostCatalogPrefix) { + badFields[globals.HostCatalogIdField] = "The field is incorrectly formatted." } if _, err := handlers.NewFilter(req.GetFilter()); err != nil { - badFields["filter"] = fmt.Sprintf("This field could not be parsed. %v", err) + badFields[globals.FilterField] = fmt.Sprintf("This field could not be parsed. %v", err) } if len(badFields) > 0 { return handlers.InvalidArgumentErrorf("Improperly formatted identifier.", badFields) @@ -913,17 +911,17 @@ func validateListRequest(req *pbs.ListHostSetsRequest) error { func validateAddRequest(req *pbs.AddHostSetHostsRequest) error { badFields := map[string]string{} if !handlers.ValidId(handlers.Id(req.GetId()), static.HostSetPrefix) { - badFields["id"] = "Incorrectly formatted identifier." + badFields[globals.IdField] = "Incorrectly formatted identifier." } if req.GetVersion() == 0 { - badFields["version"] = "Required field." + badFields[globals.VersionField] = "Required field." } if len(req.GetHostIds()) == 0 { - badFields["host_ids"] = "Must be non-empty." + badFields[globals.HostIdsField] = "Must be non-empty." } for _, id := range req.GetHostIds() { if !handlers.ValidId(handlers.Id(id), static.HostPrefix) { - badFields["host_ids"] = "Incorrectly formatted host identifier." + badFields[globals.HostIdsField] = "Incorrectly formatted host identifier." break } } @@ -936,14 +934,14 @@ func validateAddRequest(req *pbs.AddHostSetHostsRequest) error { func validateSetRequest(req *pbs.SetHostSetHostsRequest) error { badFields := map[string]string{} if !handlers.ValidId(handlers.Id(req.GetId()), static.HostSetPrefix) { - badFields["id"] = "Incorrectly formatted identifier." + badFields[globals.IdField] = "Incorrectly formatted identifier." } if req.GetVersion() == 0 { - badFields["version"] = "Required field." + badFields[globals.VersionField] = "Required field." } for _, id := range req.GetHostIds() { if !handlers.ValidId(handlers.Id(id), static.HostPrefix) { - badFields["host_ids"] = "Incorrectly formatted host identifier." + badFields[globals.HostIdsField] = "Incorrectly formatted host identifier." break } } @@ -956,17 +954,17 @@ func validateSetRequest(req *pbs.SetHostSetHostsRequest) error { func validateRemoveRequest(req *pbs.RemoveHostSetHostsRequest) error { badFields := map[string]string{} if !handlers.ValidId(handlers.Id(req.GetId()), static.HostSetPrefix) { - badFields["id"] = "Incorrectly formatted identifier." + badFields[globals.IdField] = "Incorrectly formatted identifier." } if req.GetVersion() == 0 { - badFields["version"] = "Required field." + badFields[globals.VersionField] = "Required field." } if len(req.GetHostIds()) == 0 { - badFields["host_ids"] = "Must be non-empty." + badFields[globals.HostIdsField] = "Must be non-empty." } for _, id := range req.GetHostIds() { if !handlers.ValidId(handlers.Id(id), static.HostPrefix) { - badFields["host_ids"] = "Incorrectly formatted host identifier." + badFields[globals.HostIdsField] = "Incorrectly formatted host identifier." break } } diff --git a/internal/servers/controller/handlers/host_sets/host_set_service_test.go b/internal/servers/controller/handlers/host_sets/host_set_service_test.go index 09ab45673..a772e29cc 100644 --- a/internal/servers/controller/handlers/host_sets/host_set_service_test.go +++ b/internal/servers/controller/handlers/host_sets/host_set_service_test.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers/host_sets" "github.com/hashicorp/boundary/internal/types/scope" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostsets" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" plgpb "github.com/hashicorp/boundary/sdk/pbs/plugin" "github.com/stretchr/testify/assert" @@ -153,7 +154,7 @@ func TestGet_Plugin(t *testing.T) { name := "test" prefEndpoints := []string{"cidr:1.2.3.4", "cidr:2.3.4.5/24"} - plg := hostplugin.TestPlugin(t, conn, name, name) + plg := hostplugin.TestPlugin(t, conn, name) hc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) hs := plugin.TestSet(t, conn, kms, hc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -162,12 +163,17 @@ func TestGet_Plugin(t *testing.T) { toMerge := &pbs.GetHostSetRequest{} pHost := &pb.HostSet{ - HostCatalogId: hc.GetPublicId(), - Id: hs.GetPublicId(), - CreatedTime: hs.CreateTime.GetTimestamp(), - UpdatedTime: hs.UpdateTime.GetTimestamp(), - Type: name, - Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + HostCatalogId: hc.GetPublicId(), + Id: hs.GetPublicId(), + CreatedTime: hs.CreateTime.GetTimestamp(), + UpdatedTime: hs.UpdateTime.GetTimestamp(), + Type: plugin.Subtype.String(), + Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, PreferredEndpoints: prefEndpoints, AuthorizedActions: testAuthorizedActions, } @@ -342,7 +348,7 @@ func TestList_Plugin(t *testing.T) { return static.NewRepository(rw, rw, kms) } name := "test" - plg := hostplugin.TestPlugin(t, conn, name, name) + plg := hostplugin.TestPlugin(t, conn, name) plgm := map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, } @@ -357,13 +363,18 @@ func TestList_Plugin(t *testing.T) { for i := 0; i < 10; i++ { h := plugin.TestSet(t, conn, kms, hc, plgm, plugin.WithPreferredEndpoints(preferredEndpoints)) wantHs = append(wantHs, &pb.HostSet{ - Id: h.GetPublicId(), - HostCatalogId: h.GetCatalogId(), - Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Id: h.GetPublicId(), + HostCatalogId: h.GetCatalogId(), + Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, CreatedTime: h.GetCreateTime().GetTimestamp(), UpdatedTime: h.GetUpdateTime().GetTimestamp(), Version: h.GetVersion(), - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, PreferredEndpoints: preferredEndpoints, }) @@ -707,7 +718,7 @@ func TestCreate_Plugin(t *testing.T) { return static.NewRepository(rw, rw, kms) } name := "test" - plg := hostplugin.TestPlugin(t, conn, name, name) + plg := hostplugin.TestPlugin(t, conn, name) plgRepoFn := func() (*plugin.Repository, error) { return plugin.NewRepository(rw, rw, kms, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{ @@ -757,16 +768,21 @@ func TestCreate_Plugin(t *testing.T) { HostCatalogId: hc.GetPublicId(), Name: &wrappers.StringValue{Value: "No Attributes"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), }}, res: &pbs.CreateHostSetResponse{ - Uri: fmt.Sprintf("host-sets/%s_%s_", plugin.HostSetPrefix, name), + Uri: fmt.Sprintf("host-sets/%s_", plugin.HostSetPrefix), Item: &pb.HostSet{ - HostCatalogId: hc.GetPublicId(), - Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + HostCatalogId: hc.GetPublicId(), + Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, Name: &wrappers.StringValue{Value: "No Attributes"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, }, }, @@ -777,17 +793,22 @@ func TestCreate_Plugin(t *testing.T) { HostCatalogId: hc.GetPublicId(), Name: &wrappers.StringValue{Value: "With Attributes"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), Attributes: testAttrs, }}, res: &pbs.CreateHostSetResponse{ - Uri: fmt.Sprintf("host-sets/%s_%s_", plugin.HostSetPrefix, name), + Uri: fmt.Sprintf("host-sets/%s_", plugin.HostSetPrefix), Item: &pb.HostSet{ - HostCatalogId: hc.GetPublicId(), - Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + HostCatalogId: hc.GetPublicId(), + Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, Name: &wrappers.StringValue{Value: "With Attributes"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, Attributes: testAttrs, }, @@ -799,17 +820,22 @@ func TestCreate_Plugin(t *testing.T) { HostCatalogId: hc.GetPublicId(), Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), PreferredEndpoints: prefEndpoints, }}, res: &pbs.CreateHostSetResponse{ - Uri: fmt.Sprintf("host-sets/%s_%s_", plugin.HostSetPrefix, name), + Uri: fmt.Sprintf("host-sets/%s_", plugin.HostSetPrefix), Item: &pb.HostSet{ - HostCatalogId: hc.GetPublicId(), - Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + HostCatalogId: hc.GetPublicId(), + Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), PreferredEndpoints: prefEndpoints, AuthorizedActions: testAuthorizedActions, }, @@ -821,7 +847,7 @@ func TestCreate_Plugin(t *testing.T) { HostCatalogId: hc.GetPublicId(), Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, - Type: name, + Type: plugin.Subtype.String(), PreferredEndpoints: append(prefEndpoints, "foobar:1.2.3.4"), }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -844,13 +870,18 @@ func TestCreate_Plugin(t *testing.T) { Description: &wrappers.StringValue{Value: "no type desc"}, }}, res: &pbs.CreateHostSetResponse{ - Uri: fmt.Sprintf("host-sets/%s_%s_", plugin.HostSetPrefix, name), + Uri: fmt.Sprintf("host-sets/%s_", plugin.HostSetPrefix), Item: &pb.HostSet{ - HostCatalogId: hc.GetPublicId(), - Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + HostCatalogId: hc.GetPublicId(), + Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, + Plugin: &plugins.PluginInfo{ + Id: plg.GetPublicId(), + Name: plg.GetName(), + Description: plg.GetDescription(), + }, Name: &wrappers.StringValue{Value: "no type name"}, Description: &wrappers.StringValue{Value: "no type desc"}, - Type: name, + Type: plugin.Subtype.String(), AuthorizedActions: testAuthorizedActions, }, }, diff --git a/internal/servers/controller/handlers/options.go b/internal/servers/controller/handlers/options.go index 65414c2ca..c41c735df 100644 --- a/internal/servers/controller/handlers/options.go +++ b/internal/servers/controller/handlers/options.go @@ -2,6 +2,7 @@ package handlers import ( "github.com/hashicorp/boundary/internal/perms" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" "google.golang.org/protobuf/types/known/structpb" ) @@ -26,6 +27,7 @@ type options struct { WithUserIsAnonymous bool WithOutputFields *perms.OutputFieldsMap WithScope *scopes.ScopeInfo + WithPlugin *plugins.PluginInfo WithAuthorizedActions []string WithAuthorizedCollectionActions map[string]*structpb.ListValue WithManagedGroupIds []string @@ -69,6 +71,14 @@ func WithScope(scp *scopes.ScopeInfo) Option { } } +// WithPlugin provides an option when creating responses to include the given +// plugin if allowed +func WithPlugin(plg *plugins.PluginInfo) Option { + return func(o *options) { + o.WithPlugin = plg + } +} + // WithAuthorizedActions provides an option when creating responses to include the given // authorized actions if allowed func WithAuthorizedActions(acts []string) Option { diff --git a/internal/servers/controller/handlers/targets/target_service_test.go b/internal/servers/controller/handlers/targets/target_service_test.go index 98da7aab1..cedd2b038 100644 --- a/internal/servers/controller/handlers/targets/target_service_test.go +++ b/internal/servers/controller/handlers/targets/target_service_test.go @@ -982,7 +982,7 @@ func TestAddTargetHostSets(t *testing.T) { hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0] hs := static.TestSets(t, conn, hc.GetPublicId(), 2) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") pluginHc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) pluginHs := plugin.TestSet(t, conn, kms, pluginHc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -1116,7 +1116,7 @@ func TestSetTargetHostSets(t *testing.T) { hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0] hs := static.TestSets(t, conn, hc.GetPublicId(), 2) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") pluginHc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) pluginHs := plugin.TestSet(t, conn, kms, pluginHc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -1244,7 +1244,7 @@ func TestRemoveTargetHostSets(t *testing.T) { hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0] hs := static.TestSets(t, conn, hc.GetPublicId(), 2) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") pluginHc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) pluginHs := plugin.TestSet(t, conn, kms, pluginHc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -1384,7 +1384,7 @@ func TestAddTargetHostSources(t *testing.T) { hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0] hs := static.TestSets(t, conn, hc.GetPublicId(), 2) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") pluginHc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) pluginHs := plugin.TestSet(t, conn, kms, pluginHc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -1518,7 +1518,7 @@ func TestSetTargetHostSources(t *testing.T) { hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0] hs := static.TestSets(t, conn, hc.GetPublicId(), 2) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") pluginHc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) pluginHs := plugin.TestSet(t, conn, kms, pluginHc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, @@ -1640,7 +1640,7 @@ func TestRemoveTargetHostSources(t *testing.T) { hc := static.TestCatalogs(t, conn, proj.GetPublicId(), 1)[0] hs := static.TestSets(t, conn, hc.GetPublicId(), 2) - plg := host.TestPlugin(t, conn, "test", "test") + plg := host.TestPlugin(t, conn, "test") pluginHc := plugin.TestCatalog(t, conn, proj.GetPublicId(), plg.GetPublicId()) pluginHs := plugin.TestSet(t, conn, kms, pluginHc, map[string]plgpb.HostPluginServiceServer{ plg.GetPublicId(): &plugin.TestPluginServer{}, diff --git a/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go index f72352587..988b3ccb9 100644 --- a/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go +++ b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go @@ -7,6 +7,7 @@ package hostcatalogs import ( + plugins "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" scopes "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -37,6 +38,10 @@ type HostCatalog struct { ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` // Output only. Scope information for this resource. Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,omitempty"` + // The ID of the plugin of which this catalog is created. + PluginId string `protobuf:"bytes,34,opt,name=plugin_id,proto3" json:"plugin_id,omitempty"` + // Output only. Plugin information for this resource. + Plugin *plugins.PluginInfo `protobuf:"bytes,35,opt,name=plugin,proto3" json:"plugin,omitempty"` // Optional name for identification purposes. Name *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=name,proto3" json:"name,omitempty"` // Optional user-set description for identification purposes. @@ -113,6 +118,20 @@ func (x *HostCatalog) GetScope() *scopes.ScopeInfo { return nil } +func (x *HostCatalog) GetPluginId() string { + if x != nil { + return x.PluginId + } + return "" +} + +func (x *HostCatalog) GetPlugin() *plugins.PluginInfo { + if x != nil { + return x.Plugin + } + return nil +} + func (x *HostCatalog) GetName() *wrapperspb.StringValue { if x != nil { return x.Name @@ -201,73 +220,82 @@ var file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_rawDesc = [ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, - 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, 0x8d, 0x07, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, - 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x22, - 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x07, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x73, 0x65, - 0x63, 0x72, 0x65, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb6, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x56, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, - 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x42, 0x5a, 0x5a, 0x58, 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, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, - 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x30, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 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, 0xf4, 0x07, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, + 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, + 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x5f, 0x69, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x23, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x46, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, + 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, + 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, + 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, + 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x12, 0x2f, + 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x9d, 0x01, 0x0a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0xb6, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x56, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, + 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x5a, 0x5a, 0x58, 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, 0x73, 0x64, 0x6b, + 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, + 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x63, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -287,26 +315,28 @@ var file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_goTypes = [ (*HostCatalog)(nil), // 0: controller.api.resources.hostcatalogs.v1.HostCatalog nil, // 1: controller.api.resources.hostcatalogs.v1.HostCatalog.AuthorizedCollectionActionsEntry (*scopes.ScopeInfo)(nil), // 2: controller.api.resources.scopes.v1.ScopeInfo - (*wrapperspb.StringValue)(nil), // 3: google.protobuf.StringValue - (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 5: google.protobuf.Struct - (*structpb.ListValue)(nil), // 6: google.protobuf.ListValue + (*plugins.PluginInfo)(nil), // 3: controller.api.resources.plugins.v1.PluginInfo + (*wrapperspb.StringValue)(nil), // 4: google.protobuf.StringValue + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 6: google.protobuf.Struct + (*structpb.ListValue)(nil), // 7: google.protobuf.ListValue } var file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_depIdxs = []int32{ - 2, // 0: controller.api.resources.hostcatalogs.v1.HostCatalog.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo - 3, // 1: controller.api.resources.hostcatalogs.v1.HostCatalog.name:type_name -> google.protobuf.StringValue - 3, // 2: controller.api.resources.hostcatalogs.v1.HostCatalog.description:type_name -> google.protobuf.StringValue - 4, // 3: controller.api.resources.hostcatalogs.v1.HostCatalog.created_time:type_name -> google.protobuf.Timestamp - 4, // 4: controller.api.resources.hostcatalogs.v1.HostCatalog.updated_time:type_name -> google.protobuf.Timestamp - 5, // 5: controller.api.resources.hostcatalogs.v1.HostCatalog.attributes:type_name -> google.protobuf.Struct - 5, // 6: controller.api.resources.hostcatalogs.v1.HostCatalog.secrets:type_name -> google.protobuf.Struct - 1, // 7: controller.api.resources.hostcatalogs.v1.HostCatalog.authorized_collection_actions:type_name -> controller.api.resources.hostcatalogs.v1.HostCatalog.AuthorizedCollectionActionsEntry - 6, // 8: controller.api.resources.hostcatalogs.v1.HostCatalog.AuthorizedCollectionActionsEntry.value:type_name -> google.protobuf.ListValue - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 2, // 0: controller.api.resources.hostcatalogs.v1.HostCatalog.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo + 3, // 1: controller.api.resources.hostcatalogs.v1.HostCatalog.plugin:type_name -> controller.api.resources.plugins.v1.PluginInfo + 4, // 2: controller.api.resources.hostcatalogs.v1.HostCatalog.name:type_name -> google.protobuf.StringValue + 4, // 3: controller.api.resources.hostcatalogs.v1.HostCatalog.description:type_name -> google.protobuf.StringValue + 5, // 4: controller.api.resources.hostcatalogs.v1.HostCatalog.created_time:type_name -> google.protobuf.Timestamp + 5, // 5: controller.api.resources.hostcatalogs.v1.HostCatalog.updated_time:type_name -> google.protobuf.Timestamp + 6, // 6: controller.api.resources.hostcatalogs.v1.HostCatalog.attributes:type_name -> google.protobuf.Struct + 6, // 7: controller.api.resources.hostcatalogs.v1.HostCatalog.secrets:type_name -> google.protobuf.Struct + 1, // 8: controller.api.resources.hostcatalogs.v1.HostCatalog.authorized_collection_actions:type_name -> controller.api.resources.hostcatalogs.v1.HostCatalog.AuthorizedCollectionActionsEntry + 7, // 9: controller.api.resources.hostcatalogs.v1.HostCatalog.AuthorizedCollectionActionsEntry.value:type_name -> google.protobuf.ListValue + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_init() } diff --git a/sdk/pbs/controller/api/resources/hosts/host.pb.go b/sdk/pbs/controller/api/resources/hosts/host.pb.go index cca080e1e..f568bde37 100644 --- a/sdk/pbs/controller/api/resources/hosts/host.pb.go +++ b/sdk/pbs/controller/api/resources/hosts/host.pb.go @@ -7,6 +7,7 @@ package hosts import ( + plugins "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" scopes "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -37,6 +38,8 @@ type Host struct { HostCatalogId string `protobuf:"bytes,20,opt,name=host_catalog_id,proto3" json:"host_catalog_id,omitempty"` // Output only. Scope information for this resource. Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,omitempty"` + // Output only. Plugin information for this resource. + Plugin *plugins.PluginInfo `protobuf:"bytes,35,opt,name=plugin,proto3" json:"plugin,omitempty"` // Optional name for identification purposes. Name *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=name,proto3" json:"name,omitempty"` // Optional user-set description for identification purposes. @@ -111,6 +114,13 @@ func (x *Host) GetScope() *scopes.ScopeInfo { return nil } +func (x *Host) GetPlugin() *plugins.PluginInfo { + if x != nil { + return x.Plugin + } + return nil +} + func (x *Host) GetName() *wrapperspb.StringValue { if x != nil { return x.Name @@ -239,61 +249,69 @@ var file_controller_api_resources_hosts_v1_host_proto_rawDesc = []byte{ 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 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, 0xf3, 0x04, 0x0a, - 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x12, - 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, - 0x0a, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x64, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, - 0x64, 0x73, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, - 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, + 0x1a, 0x30, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 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, 0xbc, + 0x05, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, + 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, + 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, + 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x22, 0xa0, 0xda, 0x29, 0x01, + 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x5a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x64, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x3d, 0x0a, + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x6e, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, + 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0x75, 0x0a, 0x14, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x25, 0xa0, 0xda, 0x29, 0x01, 0xc2, - 0xdd, 0x29, 0x1d, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x4c, 0x5a, 0x4a, 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, 0x73, 0x64, 0x6b, 0x2f, 0x70, - 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, - 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x75, 0x0a, + 0x14, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x42, 0x25, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1d, 0x0a, 0x12, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x42, 0x4c, 0x5a, 0x4a, 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, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, + 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -313,23 +331,25 @@ var file_controller_api_resources_hosts_v1_host_proto_goTypes = []interface{}{ (*Host)(nil), // 0: controller.api.resources.hosts.v1.Host (*StaticHostAttributes)(nil), // 1: controller.api.resources.hosts.v1.StaticHostAttributes (*scopes.ScopeInfo)(nil), // 2: controller.api.resources.scopes.v1.ScopeInfo - (*wrapperspb.StringValue)(nil), // 3: google.protobuf.StringValue - (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 5: google.protobuf.Struct + (*plugins.PluginInfo)(nil), // 3: controller.api.resources.plugins.v1.PluginInfo + (*wrapperspb.StringValue)(nil), // 4: google.protobuf.StringValue + (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 6: google.protobuf.Struct } var file_controller_api_resources_hosts_v1_host_proto_depIdxs = []int32{ 2, // 0: controller.api.resources.hosts.v1.Host.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo - 3, // 1: controller.api.resources.hosts.v1.Host.name:type_name -> google.protobuf.StringValue - 3, // 2: controller.api.resources.hosts.v1.Host.description:type_name -> google.protobuf.StringValue - 4, // 3: controller.api.resources.hosts.v1.Host.created_time:type_name -> google.protobuf.Timestamp - 4, // 4: controller.api.resources.hosts.v1.Host.updated_time:type_name -> google.protobuf.Timestamp - 5, // 5: controller.api.resources.hosts.v1.Host.attributes:type_name -> google.protobuf.Struct - 3, // 6: controller.api.resources.hosts.v1.StaticHostAttributes.address:type_name -> google.protobuf.StringValue - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 3, // 1: controller.api.resources.hosts.v1.Host.plugin:type_name -> controller.api.resources.plugins.v1.PluginInfo + 4, // 2: controller.api.resources.hosts.v1.Host.name:type_name -> google.protobuf.StringValue + 4, // 3: controller.api.resources.hosts.v1.Host.description:type_name -> google.protobuf.StringValue + 5, // 4: controller.api.resources.hosts.v1.Host.created_time:type_name -> google.protobuf.Timestamp + 5, // 5: controller.api.resources.hosts.v1.Host.updated_time:type_name -> google.protobuf.Timestamp + 6, // 6: controller.api.resources.hosts.v1.Host.attributes:type_name -> google.protobuf.Struct + 4, // 7: controller.api.resources.hosts.v1.StaticHostAttributes.address:type_name -> google.protobuf.StringValue + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_controller_api_resources_hosts_v1_host_proto_init() } diff --git a/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go b/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go index 153dbdf1f..787136971 100644 --- a/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go +++ b/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go @@ -7,6 +7,7 @@ package hostsets import ( + plugins "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" scopes "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -37,6 +38,8 @@ type HostSet struct { HostCatalogId string `protobuf:"bytes,20,opt,name=host_catalog_id,proto3" json:"host_catalog_id,omitempty"` // Output only. Scope information for this resource. Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,omitempty"` + // Output only. Plugin information for this resource. + Plugin *plugins.PluginInfo `protobuf:"bytes,35,opt,name=plugin,proto3" json:"plugin,omitempty"` // Optional name for identification purposes. Name *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=name,proto3" json:"name,omitempty"` // Optional user-set description for identification purposes. @@ -114,6 +117,13 @@ func (x *HostSet) GetScope() *scopes.ScopeInfo { return nil } +func (x *HostSet) GetPlugin() *plugins.PluginInfo { + if x != nil { + return x.Plugin + } + return nil +} + func (x *HostSet) GetName() *wrapperspb.StringValue { if x != nil { return x.Name @@ -201,58 +211,65 @@ var file_controller_api_resources_hostsets_v1_host_set_proto_rawDesc = []byte{ 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, - 0x63, 0x6f, 0x70, 0x65, 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, 0xa0, 0x05, 0x0a, 0x07, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, - 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, - 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x30, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 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, 0xe9, 0x05, 0x0a, 0x07, 0x48, 0x6f, 0x73, + 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x68, + 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x12, 0x43, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x23, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x46, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, + 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, + 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x22, 0xa0, 0xda, - 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, - 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, - 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, - 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, - 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x68, - 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x64, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, - 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x36, 0x0a, 0x13, 0x70, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x72, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x65, - 0x20, 0x03, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x13, 0x70, 0x72, 0x65, 0x66, - 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, - 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x6e, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, - 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x52, 0x5a, 0x50, 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, 0x73, 0x64, 0x6b, 0x2f, 0x70, - 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, - 0x73, 0x65, 0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x64, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x73, 0x12, 0x36, 0x0a, 0x13, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, + 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x65, 0x20, 0x03, 0x28, 0x09, 0x42, + 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x13, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, + 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x52, 0x5a, 0x50, 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, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x3b, + 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -271,22 +288,24 @@ var file_controller_api_resources_hostsets_v1_host_set_proto_msgTypes = make([]p var file_controller_api_resources_hostsets_v1_host_set_proto_goTypes = []interface{}{ (*HostSet)(nil), // 0: controller.api.resources.hostsets.v1.HostSet (*scopes.ScopeInfo)(nil), // 1: controller.api.resources.scopes.v1.ScopeInfo - (*wrapperspb.StringValue)(nil), // 2: google.protobuf.StringValue - (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 4: google.protobuf.Struct + (*plugins.PluginInfo)(nil), // 2: controller.api.resources.plugins.v1.PluginInfo + (*wrapperspb.StringValue)(nil), // 3: google.protobuf.StringValue + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 5: google.protobuf.Struct } var file_controller_api_resources_hostsets_v1_host_set_proto_depIdxs = []int32{ 1, // 0: controller.api.resources.hostsets.v1.HostSet.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo - 2, // 1: controller.api.resources.hostsets.v1.HostSet.name:type_name -> google.protobuf.StringValue - 2, // 2: controller.api.resources.hostsets.v1.HostSet.description:type_name -> google.protobuf.StringValue - 3, // 3: controller.api.resources.hostsets.v1.HostSet.created_time:type_name -> google.protobuf.Timestamp - 3, // 4: controller.api.resources.hostsets.v1.HostSet.updated_time:type_name -> google.protobuf.Timestamp - 4, // 5: controller.api.resources.hostsets.v1.HostSet.attributes:type_name -> google.protobuf.Struct - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 2, // 1: controller.api.resources.hostsets.v1.HostSet.plugin:type_name -> controller.api.resources.plugins.v1.PluginInfo + 3, // 2: controller.api.resources.hostsets.v1.HostSet.name:type_name -> google.protobuf.StringValue + 3, // 3: controller.api.resources.hostsets.v1.HostSet.description:type_name -> google.protobuf.StringValue + 4, // 4: controller.api.resources.hostsets.v1.HostSet.created_time:type_name -> google.protobuf.Timestamp + 4, // 5: controller.api.resources.hostsets.v1.HostSet.updated_time:type_name -> google.protobuf.Timestamp + 5, // 6: controller.api.resources.hostsets.v1.HostSet.attributes:type_name -> google.protobuf.Struct + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_controller_api_resources_hostsets_v1_host_set_proto_init() } diff --git a/sdk/pbs/controller/api/resources/plugins/plugin.pb.go b/sdk/pbs/controller/api/resources/plugins/plugin.pb.go new file mode 100644 index 000000000..b670e6a36 --- /dev/null +++ b/sdk/pbs/controller/api/resources/plugins/plugin.pb.go @@ -0,0 +1,172 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: controller/api/resources/plugins/v1/plugin.proto + +package plugins + +import ( + 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) +) + +type PluginInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Output only. The ID of the Plugin. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Output only. The name of the plugin resource in boundary, if any. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Output only. The description of the plugin in boundary, if any. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` +} + +func (x *PluginInfo) Reset() { + *x = PluginInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_resources_plugins_v1_plugin_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginInfo) ProtoMessage() {} + +func (x *PluginInfo) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_resources_plugins_v1_plugin_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 PluginInfo.ProtoReflect.Descriptor instead. +func (*PluginInfo) Descriptor() ([]byte, []int) { + return file_controller_api_resources_plugins_v1_plugin_proto_rawDescGZIP(), []int{0} +} + +func (x *PluginInfo) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PluginInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PluginInfo) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +var File_controller_api_resources_plugins_v1_plugin_proto protoreflect.FileDescriptor + +var file_controller_api_resources_plugins_v1_plugin_proto_rawDesc = []byte{ + 0x0a, 0x30, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x23, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x52, 0x0a, 0x0a, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 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, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x50, 0x5a, 0x4e, 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, 0x73, 0x64, 0x6b, + 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x73, 0x3b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_controller_api_resources_plugins_v1_plugin_proto_rawDescOnce sync.Once + file_controller_api_resources_plugins_v1_plugin_proto_rawDescData = file_controller_api_resources_plugins_v1_plugin_proto_rawDesc +) + +func file_controller_api_resources_plugins_v1_plugin_proto_rawDescGZIP() []byte { + file_controller_api_resources_plugins_v1_plugin_proto_rawDescOnce.Do(func() { + file_controller_api_resources_plugins_v1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_resources_plugins_v1_plugin_proto_rawDescData) + }) + return file_controller_api_resources_plugins_v1_plugin_proto_rawDescData +} + +var file_controller_api_resources_plugins_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_controller_api_resources_plugins_v1_plugin_proto_goTypes = []interface{}{ + (*PluginInfo)(nil), // 0: controller.api.resources.plugins.v1.PluginInfo +} +var file_controller_api_resources_plugins_v1_plugin_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_api_resources_plugins_v1_plugin_proto_init() } +func file_controller_api_resources_plugins_v1_plugin_proto_init() { + if File_controller_api_resources_plugins_v1_plugin_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_api_resources_plugins_v1_plugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PluginInfo); 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_api_resources_plugins_v1_plugin_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_controller_api_resources_plugins_v1_plugin_proto_goTypes, + DependencyIndexes: file_controller_api_resources_plugins_v1_plugin_proto_depIdxs, + MessageInfos: file_controller_api_resources_plugins_v1_plugin_proto_msgTypes, + }.Build() + File_controller_api_resources_plugins_v1_plugin_proto = out.File + file_controller_api_resources_plugins_v1_plugin_proto_rawDesc = nil + file_controller_api_resources_plugins_v1_plugin_proto_goTypes = nil + file_controller_api_resources_plugins_v1_plugin_proto_depIdxs = nil +}