From 5440195cce4500de98956095f247748062fddcd1 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Wed, 13 Apr 2022 12:56:31 -0400 Subject: [PATCH] feat(hosts): Classify host proto fields --- Makefile | 3 + .../api/services/host_service.pb.go | 211 +++++++-------- internal/host/host.go | 3 + internal/host/plugin/ids.go | 2 +- internal/host/static/public_ids.go | 2 +- internal/host/subtype.go | 26 -- .../api/resources/hosts/v1/host.proto | 40 +-- .../api/resources/plugins/v1/plugin.proto | 8 +- .../api/services/v1/host_service.proto | 15 +- .../host_catalogs/host_catalog_service.go | 18 +- .../handlers/host_sets/host_set_service.go | 32 +-- .../controller/handlers/hosts/host_service.go | 62 +++-- .../handlers/hosts/host_service_test.go | 128 +++++---- .../handlers/targets/target_service.go | 5 +- .../tests/api/hosts/classification_test.go | 144 +++++++++++ internal/tests/api/hosts/host_test.go | 2 +- .../controller/api/resources/hosts/host.pb.go | 242 +++++++++++------- .../api/resources/plugins/plugin.pb.go | 6 +- 18 files changed, 586 insertions(+), 363 deletions(-) delete mode 100644 internal/host/subtype.go create mode 100644 internal/tests/api/hosts/classification_test.go diff --git a/Makefile b/Makefile index 1ff1294d5..25199b57d 100644 --- a/Makefile +++ b/Makefile @@ -158,6 +158,9 @@ protobuild: @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/targets/target.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/accounts/account.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/account_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hosts/host.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/plugins/plugin.pb.go # these protos, services and openapi artifacts are purely for testing purposes @protoc-go-inject-tag -input=./internal/gen/testing/event/event.pb.go diff --git a/internal/gen/controller/api/services/host_service.pb.go b/internal/gen/controller/api/services/host_service.pb.go index fa0b9bfa2..5385efe47 100644 --- a/internal/gen/controller/api/services/host_service.pb.go +++ b/internal/gen/controller/api/services/host_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" hosts "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hosts" + _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -29,7 +30,7 @@ type GetHostRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *GetHostRequest) Reset() { @@ -123,8 +124,8 @@ type ListHostsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - HostCatalogId string `protobuf:"bytes,1,opt,name=host_catalog_id,proto3" json:"host_catalog_id,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + HostCatalogId string `protobuf:"bytes,1,opt,name=host_catalog_id,proto3" json:"host_catalog_id,omitempty" class:"public"` // @gotags: `class:"public"` + Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *ListHostsRequest) Reset() { @@ -272,7 +273,7 @@ type CreateHostResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` + Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty" class:"public"` // @gotags: `class:"public"` Item *hosts.Host `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -327,7 +328,7 @@ type UpdateHostRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` Item *hosts.Host `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=update_mask,proto3" json:"update_mask,omitempty"` } @@ -437,7 +438,7 @@ type DeleteHostRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *DeleteHostRequest) Reset() { @@ -534,112 +535,116 @@ var file_controller_api_services_v1_host_service_proto_rawDesc = []byte{ 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 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, 0x2f, 0x76, 0x31, 0x2f, 0x68, - 0x6f, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x20, 0x0a, 0x0e, 0x47, 0x65, 0x74, - 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4e, 0x0a, 0x0f, 0x47, - 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, - 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x54, 0x0a, 0x10, 0x4c, - 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x22, 0x52, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x05, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x50, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, - 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x69, 0x74, + 0x6f, 0x73, 0x74, 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, 0x20, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4e, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x48, 0x6f, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, - 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x63, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x48, 0x6f, 0x73, 0x74, 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, - 0x3b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x9e, 0x01, 0x0a, - 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x3b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 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, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, - 0x3c, 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, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x51, 0x0a, - 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x54, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x68, + 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, + 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x52, 0x0a, + 0x11, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, - 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb9, 0x06, 0x0a, 0x0b, - 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x2a, 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, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, + 0x73, 0x22, 0x50, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x22, 0x63, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, + 0x74, 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, 0x3b, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, + 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x9e, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3b, + 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x3c, 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, 0x0b, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x51, 0x0a, 0x12, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 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, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x23, 0x0a, 0x11, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb9, 0x06, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x12, 0x2a, 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, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x34, 0x92, 0x41, 0x15, 0x12, 0x13, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, - 0x12, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa9, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x48, - 0x6f, 0x73, 0x74, 0x73, 0x12, 0x2c, 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, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2d, 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, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x3f, 0x92, 0x41, 0x2b, 0x12, 0x29, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, - 0x20, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, - 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, - 0x74, 0x73, 0x12, 0xa4, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, - 0x74, 0x12, 0x2d, 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, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2e, 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, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x37, 0x92, 0x41, 0x17, 0x12, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, - 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x17, 0x22, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa2, 0x01, 0x0a, 0x0a, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x2d, 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, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 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, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x92, 0x41, 0x10, 0x12, 0x0e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x1c, 0x32, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x69, - 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x96, - 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x2d, 0x2e, + 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2b, 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, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x92, 0x41, + 0x15, 0x12, 0x13, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, + 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x0e, 0x2f, 0x76, + 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x12, 0xa9, 0x01, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, + 0x12, 0x2c, 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, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, + 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, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3f, 0x92, + 0x41, 0x2b, 0x12, 0x29, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x48, 0x6f, 0x73, + 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x12, 0xa4, + 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x2d, 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, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 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, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x92, 0x41, - 0x10, 0x12, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, - 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x2a, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, - 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 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, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x48, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x92, 0x41, + 0x17, 0x12, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x09, + 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa2, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x6f, 0x73, 0x74, 0x12, 0x2d, 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, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2e, 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, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x35, 0x92, 0x41, 0x10, 0x12, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x32, 0x0e, + 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x96, 0x01, 0x0a, 0x0a, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x2d, 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, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 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, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x92, 0x41, 0x10, 0x12, 0x0e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x10, 0x2a, 0x0e, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2f, 0x7b, + 0x69, 0x64, 0x7d, 0x42, 0x55, 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, 0xa2, 0xe3, 0x29, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/internal/host/host.go b/internal/host/host.go index bddd99191..794131891 100644 --- a/internal/host/host.go +++ b/internal/host/host.go @@ -2,6 +2,9 @@ package host import "github.com/hashicorp/boundary/internal/boundary" +// Domain defines the domain for the host package +const Domain = "host" + // Catalog contains the common methods across all the different types of host // catalogs. type Catalog interface { diff --git a/internal/host/plugin/ids.go b/internal/host/plugin/ids.go index ab8e77e4e..338d1a18f 100644 --- a/internal/host/plugin/ids.go +++ b/internal/host/plugin/ids.go @@ -10,7 +10,7 @@ import ( ) func init() { - if err := host.Register(Subtype, HostCatalogPrefix, HostSetPrefix, HostPrefix); err != nil { + if err := subtypes.Register(host.Domain, Subtype, HostCatalogPrefix, HostSetPrefix, HostPrefix); err != nil { panic(err) } } diff --git a/internal/host/static/public_ids.go b/internal/host/static/public_ids.go index 2d291e178..cbc828dae 100644 --- a/internal/host/static/public_ids.go +++ b/internal/host/static/public_ids.go @@ -8,7 +8,7 @@ import ( ) func init() { - if err := host.Register(Subtype, HostCatalogPrefix, HostSetPrefix, HostPrefix); err != nil { + if err := subtypes.Register(host.Domain, Subtype, HostCatalogPrefix, HostSetPrefix, HostPrefix); err != nil { panic(err) } } diff --git a/internal/host/subtype.go b/internal/host/subtype.go deleted file mode 100644 index b9da2e5c6..000000000 --- a/internal/host/subtype.go +++ /dev/null @@ -1,26 +0,0 @@ -package host - -import ( - "github.com/hashicorp/boundary/internal/types/subtypes" -) - -var registry = subtypes.NewRegistry() - -// SubtypeFromType returns the Subtype from the provided string or if -// no Subtype was registered with that string Unknown is returned. -func SubtypeFromType(t string) subtypes.Subtype { - return registry.SubtypeFromType(t) -} - -// SubtypeFromId returns the Subtype from the provided id if the id's prefix -// was registered with a Subtype. Otherwise Unknown is returned. -func SubtypeFromId(id string) subtypes.Subtype { - return registry.SubtypeFromId(id) -} - -// Register registers all the prefixes for a provided Subtype. Register returns -// an error if the subtype has already been registered or if any of the -// prefixes are associated with another subtype. -func Register(subtype subtypes.Subtype, prefixes ...string) error { - return registry.Register(subtype, prefixes...) -} diff --git a/internal/proto/controller/api/resources/hosts/v1/host.proto b/internal/proto/controller/api/resources/hosts/v1/host.proto index 2ac2732a7..84cfe1b62 100644 --- a/internal/proto/controller/api/resources/hosts/v1/host.proto +++ b/internal/proto/controller/api/resources/hosts/v1/host.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/api/resources/plugins/v1/plugin.proto"; import "controller/custom_options/v1/options.proto"; @@ -14,10 +15,10 @@ import "controller/custom_options/v1/options.proto"; // Host contains all fields related to a Host resource message Host { // Output only. The ID of the Host. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The Host Catalog of which this Host is a part. - string host_catalog_id = 20 [json_name="host_catalog_id"]; + string host_catalog_id = 20 [json_name="host_catalog_id", (custom_options.v1.subtype_source_id) = true]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; @@ -26,44 +27,51 @@ message Host { 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"}]; + google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}]; // @gotags: `class:"public"` // Optional user-set description for identification purposes. - google.protobuf.StringValue description = 50 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}]; + google.protobuf.StringValue description = 50 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}]; // @gotags: `class:"public"` // Output only. The time this resource was created. - google.protobuf.Timestamp created_time = 60 [json_name="created_time"]; + google.protobuf.Timestamp created_time = 60 [json_name="created_time"]; // @gotags: `class:"public"` // Output only. The time this resource was last updated. - google.protobuf.Timestamp updated_time = 70 [json_name="updated_time"]; + google.protobuf.Timestamp updated_time = 70 [json_name="updated_time"]; // @gotags: `class:"public"` // Version is used in mutation requests, after the initial creation, to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 80; + uint32 version = 80; // @gotags: `class:"public"` // The type of the resource. - string type = 90; + string type = 90; // @gotags: `class:"public"` // Output only. A list of Host Sets containing this Host. - repeated string host_set_ids = 100 [json_name="host_set_ids"]; + repeated string host_set_ids = 100 [json_name="host_set_ids"]; // @gotags: `class:"public"` - // The attributes that are applicable to the specific Host type. - google.protobuf.Struct attributes = 110 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable to the specific Host type. + google.protobuf.Struct attributes = 110 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "default"]; + StaticHostAttributes static_host_attributes = 111 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "static" + ]; + } // Output only. The list of ip addresses associated with this host. - repeated string ip_addresses = 120; + repeated string ip_addresses = 120; // @gotags: `class:"public"` // Output only. The list of dns addresses associated with this host. - repeated string dns_names = 130; + repeated string dns_names = 130; // @gotags: `class:"public"` // Output only. The external ID of the host, if any. - string external_id = 140; + string external_id = 140; // @gotags: `class:"public"` // Output only. The available actions on this resource for this user. - repeated string authorized_actions = 300 [json_name="authorized_actions"]; + repeated string authorized_actions = 300 [json_name="authorized_actions"]; // @gotags: `class:"public"` } message StaticHostAttributes { // The address (DNS or IP name) used to reach the Host. - google.protobuf.StringValue address = 10 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.address" that: "address"}]; + google.protobuf.StringValue address = 10 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.address" that: "address"}]; // @gotags: `class:"public"` } diff --git a/internal/proto/controller/api/resources/plugins/v1/plugin.proto b/internal/proto/controller/api/resources/plugins/v1/plugin.proto index 2b1e28b38..22960787c 100644 --- a/internal/proto/controller/api/resources/plugins/v1/plugin.proto +++ b/internal/proto/controller/api/resources/plugins/v1/plugin.proto @@ -6,11 +6,11 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour message PluginInfo { // Output only. The ID of the Plugin. - string id = 1; + string id = 1; // @gotags: `class:"public"` // Output only. The name of the plugin resource in boundary, if any. - string name = 2; + string name = 2; // @gotags: `class:"public"` // Output only. The description of the plugin in boundary, if any. - string description = 3; -} \ No newline at end of file + string description = 3; // @gotags: `class:"public"` +} diff --git a/internal/proto/controller/api/services/v1/host_service.proto b/internal/proto/controller/api/services/v1/host_service.proto index 18399edf1..a7a4c5552 100644 --- a/internal/proto/controller/api/services/v1/host_service.proto +++ b/internal/proto/controller/api/services/v1/host_service.proto @@ -8,6 +8,9 @@ import "protoc-gen-openapiv2/options/annotations.proto"; import "google/api/annotations.proto"; import "google/protobuf/field_mask.proto"; import "controller/api/resources/hosts/v1/host.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "host"; service HostService { // GetHost returns a stored Host if present. The provided request @@ -85,7 +88,7 @@ service HostService { } message GetHostRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetHostResponse { @@ -93,8 +96,8 @@ message GetHostResponse { } message ListHostsRequest { - string host_catalog_id = 1 [json_name="host_catalog_id"]; - string filter = 30 [json_name="filter"]; + string host_catalog_id = 1 [json_name="host_catalog_id"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListHostsResponse { @@ -106,12 +109,12 @@ message CreateHostRequest { } message CreateHostResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` api.resources.hosts.v1.Host item = 2; } message UpdateHostRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` api.resources.hosts.v1.Host item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -121,7 +124,7 @@ message UpdateHostResponse { } message DeleteHostRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteHostResponse {} 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 4c3140a72..128f5d6b7 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go @@ -396,7 +396,7 @@ func (s Service) DeleteHostCatalog(ctx context.Context, req *pbs.DeleteHostCatal 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) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -518,7 +518,7 @@ func (s Service) createPluginInRepo(ctx context.Context, projId string, req *pbs 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()) { + switch subtypes.SubtypeFromType("host", req.GetItem().GetType()) { case static.Subtype: hc, err = s.createStaticInRepo(ctx, projId, req.GetItem()) default: @@ -582,7 +582,7 @@ func (s Service) updatePluginInRepo(ctx context.Context, projId, id string, mask func (s Service) updateInRepo(ctx context.Context, projId string, req *pbs.UpdateHostCatalogRequest) (hc host.Catalog, plg *plugins.PluginInfo, err error) { const op = "host_catalogs.(Service).updateInRepo" - switch host.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("host", req.GetId()) { case static.Subtype: hc, err = s.updateStaticInRepo(ctx, projId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) case plugin.Subtype: @@ -594,7 +594,7 @@ func (s Service) updateInRepo(ctx context.Context, projId string, req *pbs.Updat func (s Service) deleteFromRepo(ctx context.Context, id string) (bool, error) { const op = "host_catalogs.(Service).deleteFromRepo" rows := 0 - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -640,7 +640,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. return res } default: - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -822,7 +822,7 @@ func validateCreateRequest(req *pbs.CreateHostCatalogRequest) error { if req.GetItem().GetSecretsHmac() != "" { badFields[globals.SecretsHmacField] = "This is a read only field." } - switch host.SubtypeFromType(req.GetItem().GetType()) { + switch subtypes.SubtypeFromType("host", req.GetItem().GetType()) { case static.Subtype: case plugin.Subtype: if req.GetItem().GetPlugin() != nil { @@ -849,16 +849,16 @@ func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest) error { if req.GetItem().GetSecretsHmac() != "" { badFields[globals.SecretsHmacField] = "This is a read only field." } - switch host.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("host", req.GetId()) { case static.Subtype: - if req.GetItem().GetType() != "" && host.SubtypeFromType(req.GetItem().GetType()) != static.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("host", req.GetItem().GetType()) != static.Subtype { badFields[globals.TypeField] = "Cannot modify resource type." } if req.GetItem().GetPlugin() != nil { badFields[globals.PluginField] = "This field is unused for this type of host catalog." } case plugin.Subtype: - if req.GetItem().GetType() != "" && host.SubtypeFromType(req.GetItem().GetType()) != plugin.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("host", req.GetItem().GetType()) != plugin.Subtype { badFields[globals.TypeField] = "Cannot modify resource type." } if req.GetItem().GetPlugin() != nil { 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 03cf4c011..9af2cdc82 100644 --- a/internal/servers/controller/handlers/host_sets/host_set_service.go +++ b/internal/servers/controller/handlers/host_sets/host_set_service.go @@ -127,7 +127,7 @@ func (s Service) ListHostSetsWithOptions(ctx context.Context, req *pbs.ListHostS } for _, item := range hl { res.Id = item.GetPublicId() - idActions := idActionsTypeMap[host.SubtypeFromId(res.Id)] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", res.Id)] authorizedActions := authResults.FetchActionSetForId(ctx, item.GetPublicId(), idActions, auth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue @@ -185,7 +185,7 @@ func (s Service) GetHostSet(ctx context.Context, req *pbs.GetHostSetRequest) (*p outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } if plg != nil { @@ -227,7 +227,7 @@ func (s Service) CreateHostSet(ctx context.Context, req *pbs.CreateHostSetReques outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetItem().GetHostCatalogId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", req.GetItem().GetHostCatalogId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } if plg != nil { @@ -275,7 +275,7 @@ func (s Service) UpdateHostSet(ctx context.Context, req *pbs.UpdateHostSetReques outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -330,7 +330,7 @@ func (s Service) AddHostSetHosts(ctx context.Context, req *pbs.AddHostSetHostsRe outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -368,7 +368,7 @@ func (s Service) SetHostSetHosts(ctx context.Context, req *pbs.SetHostSetHostsRe outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -407,7 +407,7 @@ func (s Service) RemoveHostSetHosts(ctx context.Context, req *pbs.RemoveHostSetH outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -423,7 +423,7 @@ func (s Service) getFromRepo(ctx context.Context, id string) (host.Set, []host.H var hs host.Set var hl []host.Host var plg *plugins.PluginInfo - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -473,7 +473,7 @@ func (s Service) createInRepo(ctx context.Context, scopeId, catalogId string, it } var hSet host.Set var plg *plugins.PluginInfo - switch host.SubtypeFromId(catalogId) { + switch subtypes.SubtypeFromId("host", catalogId) { case static.Subtype: h, err := toStorageStaticSet(ctx, catalogId, item) if err != nil { @@ -577,7 +577,7 @@ func (s Service) updatePluginInRepo(ctx context.Context, scopeId string, req *pb func (s Service) updateInRepo(ctx context.Context, scopeId, catalogId string, req *pbs.UpdateHostSetRequest) (hs host.Set, hosts []host.Host, plg *plugins.PluginInfo, err error) { const op = "host_sets.(Service).updateInRepo" - switch host.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("host", req.GetId()) { case static.Subtype: hs, hosts, err = s.updateStaticInRepo(ctx, scopeId, catalogId, req) case plugin.Subtype: @@ -589,7 +589,7 @@ func (s Service) updateInRepo(ctx context.Context, scopeId, catalogId string, re func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, error) { const op = "host_sets.(Service).deleteFromRepo" rows := 0 - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -616,7 +616,7 @@ func (s Service) listFromRepo(ctx context.Context, catalogId string, opt ...host const op = "host_sets.(Service).listFromRepo" var plg *plugins.PluginInfo var sets []host.Set - switch host.SubtypeFromId(catalogId) { + switch subtypes.SubtypeFromId("host", catalogId) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -740,7 +740,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty parentId = id default: var set host.Set - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: ss, _, err := staticRepo.LookupSet(ctx, id) if err != nil { @@ -769,7 +769,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } var cat host.Catalog - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("host", id) { case static.Subtype: cs, err := staticRepo.LookupCatalog(ctx, parentId) if err != nil { @@ -948,7 +948,7 @@ func validateCreateRequest(ctx context.Context, req *pbs.CreateHostSetRequest) e badFields[globals.PreferredEndpointsField] = fmt.Errorf("Error parsing preferred endpoints: %w.", err).Error() } } - switch host.SubtypeFromId(req.GetItem().GetHostCatalogId()) { + switch subtypes.SubtypeFromId("host", req.GetItem().GetHostCatalogId()) { case static.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != static.Subtype.String() { badFields[globals.TypeField] = "Doesn't match the parent resource's type." @@ -979,7 +979,7 @@ func validateUpdateRequest(ctx context.Context, req *pbs.UpdateHostSetRequest) e badFields[globals.PreferredEndpointsField] = fmt.Errorf("Error parsing preferred endpoints: %w.", err).Error() } } - switch host.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("host", req.GetId()) { case static.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != static.Subtype.String() { badFields[globals.TypeField] = "Cannot modify the resource type." diff --git a/internal/servers/controller/handlers/hosts/host_service.go b/internal/servers/controller/handlers/hosts/host_service.go index 4acbff08b..3f052c8fa 100644 --- a/internal/servers/controller/handlers/hosts/host_service.go +++ b/internal/servers/controller/handlers/hosts/host_service.go @@ -54,6 +54,8 @@ var ( } ) +const domain = "host" + func init() { var err error if maskManager, err = handlers.NewMaskManager(handlers.MaskDestination{&store.Host{}}, handlers.MaskSource{&pb.Host{}, &pb.StaticHostAttributes{}}); err != nil { @@ -112,7 +114,7 @@ func (s Service) ListHosts(ctx context.Context, req *pbs.ListHostsRequest) (*pbs } for _, item := range hl { res.Id = item.GetPublicId() - idActions := idActionsTypeMap[host.SubtypeFromId(res.Id)] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, res.Id)] authorizedActions := authResults.FetchActionSetForId(ctx, item.GetPublicId(), idActions, auth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue @@ -136,7 +138,13 @@ func (s Service) ListHosts(ctx context.Context, req *pbs.ListHostsRequest) (*pbs return nil, err } - if filter.Match(item) { + // This comes last so that we can use item fields in the filter after + // the allowed fields are populated above + filterable, err := subtypes.Filterable(item) + if err != nil { + return nil, err + } + if filter.Match(filterable) { finalItems = append(finalItems, item) } } @@ -173,7 +181,7 @@ func (s Service) GetHost(ctx context.Context, req *pbs.GetHostRequest) (*pbs.Get outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, h.GetPublicId(), idActions).Strings())) } outputOpts = append(outputOpts, handlers.WithHostSetIds(h.GetSetIds())) @@ -212,7 +220,7 @@ func (s Service) CreateHost(ctx context.Context, req *pbs.CreateHostRequest) (*p outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetItem().GetHostCatalogId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetItem().GetHostCatalogId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, h.GetPublicId(), idActions).Strings())) } @@ -254,7 +262,7 @@ func (s Service) UpdateHost(ctx context.Context, req *pbs.UpdateHostRequest) (*p outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - idActions := idActionsTypeMap[host.SubtypeFromId(req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, h.GetPublicId(), idActions).Strings())) } outputOpts = append(outputOpts, handlers.WithHostSetIds(h.GetSetIds())) @@ -286,7 +294,7 @@ func (s Service) DeleteHost(ctx context.Context, req *pbs.DeleteHostRequest) (*p func (s Service) getFromRepo(ctx context.Context, id string) (host.Host, *plugins.PluginInfo, error) { var h host.Host var plg *plugins.PluginInfo - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -319,10 +327,7 @@ func (s Service) getFromRepo(ctx context.Context, id string) (host.Host, *plugin func (s Service) createInRepo(ctx context.Context, scopeId, catalogId string, item *pb.Host) (*static.Host, error) { const op = "hosts.(Service).createInRepo" - ha := &pb.StaticHostAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), ha); err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Failed converting attributes to subtype proto: %s", err) - } + ha := item.GetStaticHostAttributes() var opts []static.Option if ha.GetAddress() != nil { opts = append(opts, static.WithAddress(ha.GetAddress().GetValue())) @@ -354,10 +359,7 @@ func (s Service) createInRepo(ctx context.Context, scopeId, catalogId string, it func (s Service) updateInRepo(ctx context.Context, scopeId, catalogId, id string, mask []string, item *pb.Host) (*static.Host, error) { const op = "hosts.(Service).updateInRepo" - ha := &pb.StaticHostAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), ha); err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Failed converting attributes to subtype proto: %s", err) - } + ha := item.GetStaticHostAttributes() var opts []static.Option if desc := item.GetDescription(); desc != nil { opts = append(opts, static.WithDescription(desc.GetValue())) @@ -407,7 +409,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, func (s Service) listFromRepo(ctx context.Context, catalogId string) ([]host.Host, *plugins.PluginInfo, error) { var hosts []host.Host var plg *plugins.PluginInfo - switch host.SubtypeFromId(catalogId) { + switch subtypes.SubtypeFromId(domain, catalogId) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -456,7 +458,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty case action.List, action.Create: parentId = id default: - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: h, err := staticRepo.LookupHost(ctx, id) if err != nil { @@ -484,7 +486,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } var cat host.Catalog - switch host.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: stcat, err := staticRepo.LookupCatalog(ctx, parentId) if err != nil { @@ -572,11 +574,11 @@ func toProto(ctx context.Context, in host.Host, opt ...handlers.Option) (*pb.Hos if outputFields.Has(globals.AttributesField) { switch h := in.(type) { case *static.Host: - st, err := handlers.ProtoToStruct(&pb.StaticHostAttributes{Address: wrapperspb.String(h.GetAddress())}) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to convert static attribute to struct: %s", err) + out.Attrs = &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String(h.GetAddress()), + }, } - out.Attributes = st } } if outputFields.Has(globals.PluginField) { @@ -607,7 +609,7 @@ func toProto(ctx context.Context, in host.Host, opt ...handlers.Option) (*pb.Hos func validateGetRequest(req *pbs.GetHostRequest) error { return handlers.ValidateGetRequest(func() map[string]string { badFields := map[string]string{} - ct := host.SubtypeFromId(req.GetId()) + ct := subtypes.SubtypeFromId(domain, req.GetId()) if ct == subtypes.UnknownSubtype { badFields["id"] = "Improperly formatted identifier used." } @@ -621,7 +623,7 @@ func validateCreateRequest(req *pbs.CreateHostRequest) error { if !handlers.ValidId(handlers.Id(req.GetItem().GetHostCatalogId()), static.HostCatalogPrefix) { badFields["host_catalog_id"] = "The field is incorrectly formatted." } - switch host.SubtypeFromId(req.GetItem().GetHostCatalogId()) { + switch subtypes.SubtypeFromId(domain, req.GetItem().GetHostCatalogId()) { case static.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != static.Subtype.String() { badFields[globals.TypeField] = "Doesn't match the parent resource's type." @@ -632,10 +634,7 @@ func validateCreateRequest(req *pbs.CreateHostRequest) error { if len(req.GetItem().GetDnsNames()) > 0 { badFields[globals.DnsNamesField] = "This field is not supported for this host type." } - attrs := &pb.StaticHostAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = "Attribute fields do not match the expected format." - } + attrs := req.GetItem().GetStaticHostAttributes() if attrs.GetAddress() == nil || len(attrs.GetAddress().GetValue()) < static.MinHostAddressLength || len(attrs.GetAddress().GetValue()) > static.MaxHostAddressLength { @@ -660,14 +659,11 @@ func validateCreateRequest(req *pbs.CreateHostRequest) error { func validateUpdateRequest(req *pbs.UpdateHostRequest) error { return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch host.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case static.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != static.Subtype.String() { badFields[globals.TypeField] = "Cannot modify the resource type." - attrs := &pb.StaticHostAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields["attributes"] = "Attribute fields do not match the expected format." - } + attrs := req.GetItem().GetStaticHostAttributes() if handlers.MaskContains(req.GetUpdateMask().GetPaths(), "attributes.address") { if attrs.GetAddress() == nil || @@ -689,7 +685,7 @@ func validateUpdateRequest(req *pbs.UpdateHostRequest) error { func validateDeleteRequest(req *pbs.DeleteHostRequest) error { return handlers.ValidateDeleteRequest(func() map[string]string { badFields := map[string]string{} - switch host.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case plugin.Subtype: badFields[globals.IdField] = "Cannot manually delete this type of host." } diff --git a/internal/servers/controller/handlers/hosts/host_service_test.go b/internal/servers/controller/handlers/hosts/host_service_test.go index 1ed2e3aa8..4e76ff0bb 100644 --- a/internal/servers/controller/handlers/hosts/host_service_test.go +++ b/internal/servers/controller/handlers/hosts/host_service_test.go @@ -33,7 +33,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/testing/protocmp" - "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -76,9 +75,11 @@ func TestGet_Static(t *testing.T) { UpdatedTime: h.UpdateTime.GetTimestamp(), Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String(), ParentScopeId: org.GetPublicId()}, Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue(h.GetAddress()), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String(h.GetAddress()), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, } @@ -268,9 +269,12 @@ func TestList_Static(t *testing.T) { CreatedTime: h.GetCreateTime().GetTimestamp(), UpdatedTime: h.GetUpdateTime().GetTimestamp(), Version: h.GetVersion(), - Type: static.Subtype.String(), Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue(h.GetAddress()), - }}, + Type: static.Subtype.String(), + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String(h.GetAddress()), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{hset.GetPublicId()}, }) @@ -632,9 +636,11 @@ func TestCreate(t *testing.T) { Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("123.456.789"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("123.456.789"), + }, + }, }}, res: &pbs.CreateHostResponse{ Uri: fmt.Sprintf("hosts/%s_", static.HostPrefix), @@ -644,9 +650,11 @@ func TestCreate(t *testing.T) { Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("123.456.789"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("123.456.789"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], }, }, @@ -666,9 +674,11 @@ func TestCreate(t *testing.T) { Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue(""), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String(""), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -679,7 +689,11 @@ func TestCreate(t *testing.T) { Name: &wrappers.StringValue{Value: "name"}, Description: &wrappers.StringValue{Value: "desc"}, Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{}}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: nil, + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -699,9 +713,11 @@ func TestCreate(t *testing.T) { HostCatalogId: hc.GetPublicId(), Name: &wrappers.StringValue{Value: "no type name"}, Description: &wrappers.StringValue{Value: "no type desc"}, - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("123.456.789"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("123.456.789"), + }, + }, }}, res: &pbs.CreateHostResponse{ Uri: fmt.Sprintf("hosts/%s_", static.HostPrefix), @@ -711,9 +727,11 @@ func TestCreate(t *testing.T) { Name: &wrappers.StringValue{Value: "no type name"}, Description: &wrappers.StringValue{Value: "no type desc"}, Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("123.456.789"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("123.456.789"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], }, }, @@ -855,9 +873,11 @@ func TestUpdate_Static(t *testing.T) { Description: &wrappers.StringValue{Value: "desc"}, CreatedTime: h.GetCreateTime().GetTimestamp(), Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("defaultaddress"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("defaultaddress"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, }, @@ -884,9 +904,11 @@ func TestUpdate_Static(t *testing.T) { Description: &wrappers.StringValue{Value: "desc"}, CreatedTime: h.GetCreateTime().GetTimestamp(), Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("defaultaddress"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("defaultaddress"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, }, @@ -955,9 +977,11 @@ func TestUpdate_Static(t *testing.T) { Description: &wrappers.StringValue{Value: "default"}, CreatedTime: h.GetCreateTime().GetTimestamp(), Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("defaultaddress"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("defaultaddress"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, }, @@ -981,9 +1005,11 @@ func TestUpdate_Static(t *testing.T) { Name: &wrappers.StringValue{Value: "default"}, CreatedTime: h.GetCreateTime().GetTimestamp(), Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("defaultaddress"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("defaultaddress"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, }, @@ -1009,9 +1035,11 @@ func TestUpdate_Static(t *testing.T) { Description: &wrappers.StringValue{Value: "default"}, CreatedTime: h.GetCreateTime().GetTimestamp(), Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("defaultaddress"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("defaultaddress"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, }, @@ -1037,9 +1065,11 @@ func TestUpdate_Static(t *testing.T) { Description: &wrappers.StringValue{Value: "notignored"}, CreatedTime: h.GetCreateTime().GetTimestamp(), Type: "static", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue("defaultaddress"), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("defaultaddress"), + }, + }, AuthorizedActions: testAuthorizedActions[static.Subtype], HostSetIds: []string{s.GetPublicId()}, }, @@ -1085,9 +1115,11 @@ func TestUpdate_Static(t *testing.T) { Paths: []string{"attributes.address"}, }, Item: &pb.Host{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewNullValue(), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: nil, + }, + }, }, }, res: nil, @@ -1101,9 +1133,11 @@ func TestUpdate_Static(t *testing.T) { Paths: []string{"attributes.address"}, }, Item: &pb.Host{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "address": structpb.NewStringValue(""), - }}, + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String(""), + }, + }, }, }, res: nil, diff --git a/internal/servers/controller/handlers/targets/target_service.go b/internal/servers/controller/handlers/targets/target_service.go index 3a09ed6c1..55712fbd5 100644 --- a/internal/servers/controller/handlers/targets/target_service.go +++ b/internal/servers/controller/handlers/targets/target_service.go @@ -33,6 +33,7 @@ import ( "github.com/hashicorp/boundary/internal/types/action" "github.com/hashicorp/boundary/internal/types/resource" "github.com/hashicorp/boundary/internal/types/scope" + "github.com/hashicorp/boundary/internal/types/subtypes" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/targets" "github.com/hashicorp/go-bexpr" "github.com/hashicorp/go-secure-stdlib/strutil" @@ -960,7 +961,7 @@ func (s Service) AuthorizeSession(ctx context.Context, req *pbs.AuthorizeSession for _, hSource := range hostSources { hsId := hSource.Id() // FIXME: read in type from DB rather than rely on prefix - switch host.SubtypeFromId(hsId) { + switch subtypes.SubtypeFromId("host", hsId) { case static.Subtype: eps, err := staticHostRepo.Endpoints(ctx, hsId) if err != nil { @@ -2106,7 +2107,7 @@ func validateAuthorizeSessionRequest(req *pbs.AuthorizeSessionRequest) error { } } if req.GetHostId() != "" { - switch host.SubtypeFromId(req.GetHostId()) { + switch subtypes.SubtypeFromId("host", req.GetHostId()) { case static.Subtype, plugin.Subtype: default: badFields[globals.HostIdField] = "Incorrectly formatted identifier." diff --git a/internal/tests/api/hosts/classification_test.go b/internal/tests/api/hosts/classification_test.go new file mode 100644 index 000000000..66fd25215 --- /dev/null +++ b/internal/tests/api/hosts/classification_test.go @@ -0,0 +1,144 @@ +package hosts_test + +import ( + "context" + "encoding/json" + "testing" + "time" + + "github.com/hashicorp/boundary/sdk/pbs/controller/api" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hosts" + plugins "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/plugins" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + "github.com/hashicorp/boundary/sdk/wrapper" + "github.com/hashicorp/eventlogger" + "github.com/hashicorp/eventlogger/filters/encrypt" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +func TestClassification(t *testing.T) { + ctx := context.Background() + now := time.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + testEncryptingFilter.FilterOperationOverrides = map[encrypt.DataClassification]encrypt.FilterOperation{ + // Use HMAC for sensitive fields for easy test comparisons + encrypt.SensitiveClassification: encrypt.HmacSha256Operation, + } + + tests := []struct { + name string + testEvent *eventlogger.Event + wantEvent *eventlogger.Event + }{ + { + name: "validate-response-filtering", + testEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Host{ + Id: "public-id", + Scope: &scopes.ScopeInfo{ + Id: "public-scope_id", + Type: "public-scope_type", + Name: "public-scope_name", + Description: "public-scope_description", + ParentScopeId: "public-parent_scope_id", + }, + Plugin: &plugins.PluginInfo{ + Id: "public-plugin_id", + Name: "public-plugin_name", + Description: "public-plugin_description", + }, + Name: wrapperspb.String("public-name"), + Description: wrapperspb.String("public-description"), + CreatedTime: timestamppb.New(now), + UpdatedTime: timestamppb.New(now), + Version: 1, + Type: "public-type", + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("public-address"), + }, + }, + AuthorizedActions: []string{ + "public-action", + }, + HostCatalogId: "public-host_catalog_id", + HostSetIds: []string{ + "public-host_set_id", + }, + IpAddresses: []string{ + "public-ip_address", + }, + DnsNames: []string{ + "public-dns_name", + }, + ExternalId: "public-external_id", + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Host{ + Id: "public-id", + Scope: &scopes.ScopeInfo{ + Id: "public-scope_id", + Type: "public-scope_type", + Name: "public-scope_name", + Description: "public-scope_description", + ParentScopeId: "public-parent_scope_id", + }, + Plugin: &plugins.PluginInfo{ + Id: "public-plugin_id", + Name: "public-plugin_name", + Description: "public-plugin_description", + }, + Name: wrapperspb.String("public-name"), + Description: wrapperspb.String("public-description"), + CreatedTime: timestamppb.New(now), + UpdatedTime: timestamppb.New(now), + Version: 1, + Type: "public-type", + Attrs: &pb.Host_StaticHostAttributes{ + StaticHostAttributes: &pb.StaticHostAttributes{ + Address: wrapperspb.String("public-address"), + }, + }, + AuthorizedActions: []string{ + "public-action", + }, + HostCatalogId: "public-host_catalog_id", + HostSetIds: []string{ + "public-host_set_id", + }, + IpAddresses: []string{ + "public-ip_address", + }, + DnsNames: []string{ + "public-dns_name", + }, + ExternalId: "public-external_id", + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + got, err := testEncryptingFilter.Process(ctx, tt.testEvent) + require.NoError(err) + require.NotNil(got) + actualJson, err := json.Marshal(got) + require.NoError(err) + t.Log(string(actualJson)) + + wantJson, err := json.Marshal(tt.wantEvent) + require.NoError(err) + assert.JSONEq(string(wantJson), string(actualJson)) + }) + } +} diff --git a/internal/tests/api/hosts/host_test.go b/internal/tests/api/hosts/host_test.go index 26a2b8193..91d7c771a 100644 --- a/internal/tests/api/hosts/host_test.go +++ b/internal/tests/api/hosts/host_test.go @@ -43,7 +43,7 @@ func TestList(t *testing.T) { } hcr, err := hClient.Create(tc.Context(), hc.Item.Id, hosts.WithName(expected[0].Name), hosts.WithStaticHostAddress("someaddress")) - assert.NoError(err) + require.NoError(err) expected[0] = hcr.Item ul, err = hClient.List(tc.Context(), hc.Item.Id) diff --git a/sdk/pbs/controller/api/resources/hosts/host.pb.go b/sdk/pbs/controller/api/resources/hosts/host.pb.go index 01e2efd62..99b87da6f 100644 --- a/sdk/pbs/controller/api/resources/hosts/host.pb.go +++ b/sdk/pbs/controller/api/resources/hosts/host.pb.go @@ -10,6 +10,7 @@ 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" + _ "google.golang.org/genproto/googleapis/api/visibility" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" @@ -33,38 +34,40 @@ type Host struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Host. - Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty"` + Id string `protobuf:"bytes,10,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` // The Host Catalog of which this Host is a part. - HostCatalogId string `protobuf:"bytes,20,opt,name=host_catalog_id,proto3" json:"host_catalog_id,omitempty"` + HostCatalogId string `protobuf:"bytes,20,opt,name=host_catalog_id,proto3" json:"host_catalog_id,omitempty" class:"public"` // @gotags: `class:"public"` // 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"` + Name *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // Optional user-set description for identification purposes. - Description *wrapperspb.StringValue `protobuf:"bytes,50,opt,name=description,proto3" json:"description,omitempty"` + Description *wrapperspb.StringValue `protobuf:"bytes,50,opt,name=description,proto3" json:"description,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The time this resource was created. - CreatedTime *timestamppb.Timestamp `protobuf:"bytes,60,opt,name=created_time,proto3" json:"created_time,omitempty"` + CreatedTime *timestamppb.Timestamp `protobuf:"bytes,60,opt,name=created_time,proto3" json:"created_time,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The time this resource was last updated. - UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,70,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,70,opt,name=updated_time,proto3" json:"updated_time,omitempty" class:"public"` // @gotags: `class:"public"` // Version is used in mutation requests, after the initial creation, to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - Version uint32 `protobuf:"varint,80,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,80,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // The type of the resource. - Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. A list of Host Sets containing this Host. - HostSetIds []string `protobuf:"bytes,100,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty"` - // The attributes that are applicable to the specific Host type. - Attributes *structpb.Struct `protobuf:"bytes,110,opt,name=attributes,proto3" json:"attributes,omitempty"` + HostSetIds []string `protobuf:"bytes,100,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty" class:"public"` // @gotags: `class:"public"` + // Types that are assignable to Attrs: + // *Host_Attributes + // *Host_StaticHostAttributes + Attrs isHost_Attrs `protobuf_oneof:"attrs"` // Output only. The list of ip addresses associated with this host. - IpAddresses []string `protobuf:"bytes,120,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"` + IpAddresses []string `protobuf:"bytes,120,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The list of dns addresses associated with this host. - DnsNames []string `protobuf:"bytes,130,rep,name=dns_names,json=dnsNames,proto3" json:"dns_names,omitempty"` + DnsNames []string `protobuf:"bytes,130,rep,name=dns_names,json=dnsNames,proto3" json:"dns_names,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The external ID of the host, if any. - ExternalId string `protobuf:"bytes,140,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"` + ExternalId string `protobuf:"bytes,140,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The available actions on this resource for this user. - AuthorizedActions []string `protobuf:"bytes,300,rep,name=authorized_actions,proto3" json:"authorized_actions,omitempty"` + AuthorizedActions []string `protobuf:"bytes,300,rep,name=authorized_actions,proto3" json:"authorized_actions,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *Host) Reset() { @@ -176,13 +179,27 @@ func (x *Host) GetHostSetIds() []string { return nil } +func (m *Host) GetAttrs() isHost_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *Host) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*Host_Attributes); ok { return x.Attributes } return nil } +func (x *Host) GetStaticHostAttributes() *StaticHostAttributes { + if x, ok := x.GetAttrs().(*Host_StaticHostAttributes); ok { + return x.StaticHostAttributes + } + return nil +} + func (x *Host) GetIpAddresses() []string { if x != nil { return x.IpAddresses @@ -211,13 +228,30 @@ func (x *Host) GetAuthorizedActions() []string { return nil } +type isHost_Attrs interface { + isHost_Attrs() +} + +type Host_Attributes struct { + // The attributes that are applicable to the specific Host type. + Attributes *structpb.Struct `protobuf:"bytes,110,opt,name=attributes,proto3,oneof"` +} + +type Host_StaticHostAttributes struct { + StaticHostAttributes *StaticHostAttributes `protobuf:"bytes,111,opt,name=static_host_attributes,json=staticHostAttributes,proto3,oneof"` +} + +func (*Host_Attributes) isHost_Attrs() {} + +func (*Host_StaticHostAttributes) isHost_Attrs() {} + type StaticHostAttributes struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // The address (DNS or IP name) used to reach the Host. - Address *wrapperspb.StringValue `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` + Address *wrapperspb.StringValue `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *StaticHostAttributes) Reset() { @@ -273,78 +307,91 @@ var file_controller_api_resources_hosts_v1_host_proto_rawDesc = []byte{ 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 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, 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, 0x9f, - 0x06, 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, 0x21, 0x0a, 0x0c, - 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x78, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, - 0x1c, 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x82, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6e, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x20, 0x0a, - 0x0b, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x8c, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 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, - 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, + 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x69, 0x73, + 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 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, 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, 0xcd, 0x07, 0x0a, 0x04, + 0x48, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x2e, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, + 0xe3, 0x29, 0x01, 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, 0x4a, 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, 0x0f, 0xa0, + 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x48, 0x00, + 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x8f, 0x01, 0x0a, + 0x16, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 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, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1e, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, + 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x14, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, + 0x48, 0x6f, 0x73, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x21, + 0x0a, 0x0c, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x78, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, + 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x82, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x64, 0x6e, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, + 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x8c, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, + 0x64, 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, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 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 ( @@ -377,12 +424,13 @@ var file_controller_api_resources_hosts_v1_host_proto_depIdxs = []int32{ 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 + 1, // 7: controller.api.resources.hosts.v1.Host.static_host_attributes:type_name -> controller.api.resources.hosts.v1.StaticHostAttributes + 4, // 8: controller.api.resources.hosts.v1.StaticHostAttributes.address:type_name -> google.protobuf.StringValue + 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 } func init() { file_controller_api_resources_hosts_v1_host_proto_init() } @@ -416,6 +464,10 @@ func file_controller_api_resources_hosts_v1_host_proto_init() { } } } + file_controller_api_resources_hosts_v1_host_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Host_Attributes)(nil), + (*Host_StaticHostAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/sdk/pbs/controller/api/resources/plugins/plugin.pb.go b/sdk/pbs/controller/api/resources/plugins/plugin.pb.go index 4eec99dae..782cf4627 100644 --- a/sdk/pbs/controller/api/resources/plugins/plugin.pb.go +++ b/sdk/pbs/controller/api/resources/plugins/plugin.pb.go @@ -26,11 +26,11 @@ type PluginInfo struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Plugin. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The name of the plugin resource in boundary, if any. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The description of the plugin in boundary, if any. - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *PluginInfo) Reset() {