From 6a37bd9710db1de6f23e8681cad9135ca0b295d6 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Tue, 29 Mar 2022 14:20:08 -0400 Subject: [PATCH 01/45] Upgrade grpc-gateway version to v2.10.0 (#1954) This new version will let us hide fields from the OpenAPI output --- go.mod | 10 +- go.sum | 18 +- internal/gen/controller.swagger.json | 82 ++++---- .../api/services/account_service.pb.gw.go | 70 ++++--- .../api/services/auth_method_service.pb.gw.go | 70 ++++--- .../api/services/authtokens_service.pb.gw.go | 30 +-- .../credential_library_service.pb.gw.go | 50 +++-- .../credential_store_service.pb.gw.go | 50 +++-- .../api/services/group_service.pb.gw.go | 80 ++++---- .../services/host_catalog_service.pb.gw.go | 50 +++-- .../api/services/host_service.pb.gw.go | 50 +++-- .../api/services/host_set_service.pb.gw.go | 80 ++++---- .../services/managed_group_service.pb.gw.go | 50 +++-- .../api/services/role_service.pb.gw.go | 110 ++++++----- .../api/services/scope_service.pb.gw.go | 50 +++-- .../api/services/session_service.pb.gw.go | 30 +-- .../api/services/target_service.pb.gw.go | 180 +++++++++++------- .../api/services/user_service.pb.gw.go | 80 ++++---- .../ops/services/health_service.pb.gw.go | 10 +- internal/gen/testing/event/event.pb.gw.go | 10 +- .../gen/testing/event/testing.swagger.json | 2 +- .../gen/testing/protooptions/service.pb.gw.go | 20 +- 22 files changed, 699 insertions(+), 483 deletions(-) diff --git a/go.mod b/go.mod index d863db047..f84c2a77a 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/google/go-cmp v0.5.7 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 + github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0 github.com/hashicorp/boundary/api v0.0.23 github.com/hashicorp/boundary/sdk v0.0.14 github.com/hashicorp/cap v0.1.1 @@ -73,8 +73,8 @@ require ( golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 golang.org/x/tools v0.1.10 - google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 - google.golang.org/grpc v1.44.0 + google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e + google.golang.org/grpc v1.45.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 google.golang.org/protobuf v1.27.1 gorm.io/driver/postgres v1.2.2 @@ -116,7 +116,6 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.0.0 // indirect github.com/golang/snappy v0.0.4 // indirect @@ -177,7 +176,7 @@ require ( go.uber.org/goleak v1.1.10 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect - golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect + golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect @@ -188,4 +187,5 @@ require ( gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect gorm.io/driver/sqlite v1.2.4 // indirect gotest.tools/v3 v3.0.3 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index a081fa592..991a4aed0 100644 --- a/go.sum +++ b/go.sum @@ -218,7 +218,6 @@ github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUork github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -369,8 +368,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaW github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 h1:rgxjzoDmDXw5q8HONgyHhBas4to0/XWRo/gPpJhsUNQ= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0/go.mod h1:qrJPVzv9YlhsrxJc3P/Q85nr0w1lIRikTl4JlhdDH5w= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0 h1:ESEyqQqXXFIcImj/BE8oKEX37Zsuceb2cZI+EL/zNCY= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0/go.mod h1:XnLCLFp3tjoZJszVKjfpyAK6J8sYIcQXWQxmqLWF21I= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/cap v0.1.1 h1:GjO4+9+H0wv/89YoEsxeVc2jIizL19r5v5l2lpaH8Kg= github.com/hashicorp/cap v0.1.1/go.mod h1:VfBvK2ULRyqsuqAnjgZl7HJ7/CGMC7ro4H5eXiZuun8= @@ -1063,9 +1062,8 @@ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM= +golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1340,8 +1338,9 @@ google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 h1:pwzFiZfBTH/GjBWz1BcDwMBaHBo8mZvpLa7eBKJpFAk= google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg= +google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1369,8 +1368,9 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0-dev.0.20210907181116-2f3355d2244e/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1465,3 +1465,5 @@ nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index 81d803b73..54c1efe60 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -6,49 +6,49 @@ }, "tags": [ { - "name": "ScopeService" + "name": "controller.api.services.v1.ScopeService" }, { - "name": "AccountService" + "name": "controller.api.services.v1.AccountService" }, { - "name": "AuthMethodService" + "name": "controller.api.services.v1.AuthMethodService" }, { - "name": "AuthTokenService" + "name": "controller.api.services.v1.AuthTokenService" }, { - "name": "CredentialLibraryService" + "name": "controller.api.services.v1.CredentialLibraryService" }, { - "name": "CredentialStoreService" + "name": "controller.api.services.v1.CredentialStoreService" }, { - "name": "GroupService" + "name": "controller.api.services.v1.GroupService" }, { - "name": "HostCatalogService" + "name": "controller.api.services.v1.HostCatalogService" }, { - "name": "HostService" + "name": "controller.api.services.v1.HostService" }, { - "name": "HostSetService" + "name": "controller.api.services.v1.HostSetService" }, { - "name": "ManagedGroupService" + "name": "controller.api.services.v1.ManagedGroupService" }, { - "name": "RoleService" + "name": "controller.api.services.v1.RoleService" }, { - "name": "SessionService" + "name": "controller.api.services.v1.SessionService" }, { - "name": "TargetService" + "name": "controller.api.services.v1.TargetService" }, { - "name": "UserService" + "name": "controller.api.services.v1.UserService" } ], "schemes": [ @@ -105,7 +105,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -184,7 +184,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -341,7 +341,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -472,7 +472,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -663,7 +663,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -742,7 +742,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -810,7 +810,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -889,7 +889,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -957,7 +957,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1036,7 +1036,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1242,7 +1242,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1328,7 +1328,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1390,7 +1390,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1469,7 +1469,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1672,7 +1672,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1751,7 +1751,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1813,7 +1813,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1892,7 +1892,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -1960,7 +1960,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -2039,7 +2039,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -2383,7 +2383,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -2474,7 +2474,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -2643,7 +2643,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -2722,7 +2722,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -3414,7 +3414,7 @@ }, "parameters": [ { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { @@ -3493,7 +3493,7 @@ "type": "string" }, { - "name": "body", + "name": "item", "in": "body", "required": true, "schema": { diff --git a/internal/gen/controller/api/services/account_service.pb.gw.go b/internal/gen/controller/api/services/account_service.pb.gw.go index 8936b53db..1a31d76ed 100644 --- a/internal/gen/controller/api/services/account_service.pb.gw.go +++ b/internal/gen/controller/api/services/account_service.pb.gw.go @@ -453,12 +453,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/GetAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/GetAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_GetAccount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_GetAccount_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -476,12 +477,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ListAccounts", runtime.WithHTTPPathPattern("/v1/accounts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ListAccounts", runtime.WithHTTPPathPattern("/v1/accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_ListAccounts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_ListAccounts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -499,12 +501,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/CreateAccount", runtime.WithHTTPPathPattern("/v1/accounts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/CreateAccount", runtime.WithHTTPPathPattern("/v1/accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_CreateAccount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_CreateAccount_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -522,12 +525,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/UpdateAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/UpdateAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_UpdateAccount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_UpdateAccount_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -545,12 +549,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/DeleteAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/DeleteAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_DeleteAccount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_DeleteAccount_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -568,12 +573,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/SetPassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:set-password")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/SetPassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:set-password")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_SetPassword_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_SetPassword_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -591,12 +597,13 @@ func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ChangePassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:change-password")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ChangePassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:change-password")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AccountService_ChangePassword_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AccountService_ChangePassword_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -653,12 +660,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/GetAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/GetAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_GetAccount_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_GetAccount_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -673,12 +681,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ListAccounts", runtime.WithHTTPPathPattern("/v1/accounts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ListAccounts", runtime.WithHTTPPathPattern("/v1/accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_ListAccounts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_ListAccounts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -693,12 +702,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/CreateAccount", runtime.WithHTTPPathPattern("/v1/accounts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/CreateAccount", runtime.WithHTTPPathPattern("/v1/accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_CreateAccount_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_CreateAccount_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -713,12 +723,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/UpdateAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/UpdateAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_UpdateAccount_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_UpdateAccount_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -733,12 +744,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/DeleteAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/DeleteAccount", runtime.WithHTTPPathPattern("/v1/accounts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_DeleteAccount_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_DeleteAccount_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -753,12 +765,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/SetPassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:set-password")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/SetPassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:set-password")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_SetPassword_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_SetPassword_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -773,12 +786,13 @@ func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ChangePassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:change-password")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AccountService/ChangePassword", runtime.WithHTTPPathPattern("/v1/accounts/{id}:change-password")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AccountService_ChangePassword_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AccountService_ChangePassword_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/auth_method_service.pb.gw.go b/internal/gen/controller/api/services/auth_method_service.pb.gw.go index d9d54eb61..f7dc88294 100644 --- a/internal/gen/controller/api/services/auth_method_service.pb.gw.go +++ b/internal/gen/controller/api/services/auth_method_service.pb.gw.go @@ -453,12 +453,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/GetAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/GetAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_GetAuthMethod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_GetAuthMethod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -476,12 +477,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ListAuthMethods", runtime.WithHTTPPathPattern("/v1/auth-methods")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ListAuthMethods", runtime.WithHTTPPathPattern("/v1/auth-methods")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_ListAuthMethods_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_ListAuthMethods_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -499,12 +501,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/CreateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/CreateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_CreateAuthMethod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_CreateAuthMethod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -522,12 +525,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/UpdateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/UpdateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_UpdateAuthMethod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_UpdateAuthMethod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -545,12 +549,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/DeleteAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/DeleteAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_DeleteAuthMethod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_DeleteAuthMethod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -568,12 +573,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ChangeState", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}:change-state")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ChangeState", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}:change-state")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_ChangeState_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_ChangeState_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -591,12 +597,13 @@ func RegisterAuthMethodServiceHandlerServer(ctx context.Context, mux *runtime.Se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/Authenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/Authenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthMethodService_Authenticate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthMethodService_Authenticate_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -653,12 +660,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/GetAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/GetAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_GetAuthMethod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_GetAuthMethod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -673,12 +681,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ListAuthMethods", runtime.WithHTTPPathPattern("/v1/auth-methods")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ListAuthMethods", runtime.WithHTTPPathPattern("/v1/auth-methods")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_ListAuthMethods_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_ListAuthMethods_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -693,12 +702,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/CreateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/CreateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_CreateAuthMethod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_CreateAuthMethod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -713,12 +723,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/UpdateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/UpdateAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_UpdateAuthMethod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_UpdateAuthMethod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -733,12 +744,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/DeleteAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/DeleteAuthMethod", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_DeleteAuthMethod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_DeleteAuthMethod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -753,12 +765,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ChangeState", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}:change-state")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/ChangeState", runtime.WithHTTPPathPattern("/v1/auth-methods/{id}:change-state")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_ChangeState_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_ChangeState_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -773,12 +786,13 @@ func RegisterAuthMethodServiceHandlerClient(ctx context.Context, mux *runtime.Se ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/Authenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthMethodService/Authenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthMethodService_Authenticate_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthMethodService_Authenticate_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/authtokens_service.pb.gw.go b/internal/gen/controller/api/services/authtokens_service.pb.gw.go index 0502c9736..262ccbe55 100644 --- a/internal/gen/controller/api/services/authtokens_service.pb.gw.go +++ b/internal/gen/controller/api/services/authtokens_service.pb.gw.go @@ -183,12 +183,13 @@ func RegisterAuthTokenServiceHandlerServer(ctx context.Context, mux *runtime.Ser var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/GetAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/GetAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthTokenService_GetAuthToken_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthTokenService_GetAuthToken_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -206,12 +207,13 @@ func RegisterAuthTokenServiceHandlerServer(ctx context.Context, mux *runtime.Ser var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/ListAuthTokens", runtime.WithHTTPPathPattern("/v1/auth-tokens")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/ListAuthTokens", runtime.WithHTTPPathPattern("/v1/auth-tokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthTokenService_ListAuthTokens_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthTokenService_ListAuthTokens_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -229,12 +231,13 @@ func RegisterAuthTokenServiceHandlerServer(ctx context.Context, mux *runtime.Ser var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/DeleteAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/DeleteAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_AuthTokenService_DeleteAuthToken_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_AuthTokenService_DeleteAuthToken_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -291,12 +294,13 @@ func RegisterAuthTokenServiceHandlerClient(ctx context.Context, mux *runtime.Ser ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/GetAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/GetAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthTokenService_GetAuthToken_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthTokenService_GetAuthToken_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -311,12 +315,13 @@ func RegisterAuthTokenServiceHandlerClient(ctx context.Context, mux *runtime.Ser ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/ListAuthTokens", runtime.WithHTTPPathPattern("/v1/auth-tokens")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/ListAuthTokens", runtime.WithHTTPPathPattern("/v1/auth-tokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthTokenService_ListAuthTokens_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthTokenService_ListAuthTokens_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -331,12 +336,13 @@ func RegisterAuthTokenServiceHandlerClient(ctx context.Context, mux *runtime.Ser ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/DeleteAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.AuthTokenService/DeleteAuthToken", runtime.WithHTTPPathPattern("/v1/auth-tokens/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_AuthTokenService_DeleteAuthToken_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_AuthTokenService_DeleteAuthToken_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/credential_library_service.pb.gw.go b/internal/gen/controller/api/services/credential_library_service.pb.gw.go index e4be403b2..4a5275455 100644 --- a/internal/gen/controller/api/services/credential_library_service.pb.gw.go +++ b/internal/gen/controller/api/services/credential_library_service.pb.gw.go @@ -317,12 +317,13 @@ func RegisterCredentialLibraryServiceHandlerServer(ctx context.Context, mux *run var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/GetCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/GetCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialLibraryService_GetCredentialLibrary_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialLibraryService_GetCredentialLibrary_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -340,12 +341,13 @@ func RegisterCredentialLibraryServiceHandlerServer(ctx context.Context, mux *run var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/ListCredentialLibraries", runtime.WithHTTPPathPattern("/v1/credential-libraries")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/ListCredentialLibraries", runtime.WithHTTPPathPattern("/v1/credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialLibraryService_ListCredentialLibraries_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialLibraryService_ListCredentialLibraries_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -363,12 +365,13 @@ func RegisterCredentialLibraryServiceHandlerServer(ctx context.Context, mux *run var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/CreateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/CreateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialLibraryService_CreateCredentialLibrary_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialLibraryService_CreateCredentialLibrary_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -386,12 +389,13 @@ func RegisterCredentialLibraryServiceHandlerServer(ctx context.Context, mux *run var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/UpdateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/UpdateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialLibraryService_UpdateCredentialLibrary_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialLibraryService_UpdateCredentialLibrary_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -409,12 +413,13 @@ func RegisterCredentialLibraryServiceHandlerServer(ctx context.Context, mux *run var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/DeleteCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/DeleteCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialLibraryService_DeleteCredentialLibrary_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialLibraryService_DeleteCredentialLibrary_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -471,12 +476,13 @@ func RegisterCredentialLibraryServiceHandlerClient(ctx context.Context, mux *run ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/GetCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/GetCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialLibraryService_GetCredentialLibrary_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialLibraryService_GetCredentialLibrary_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -491,12 +497,13 @@ func RegisterCredentialLibraryServiceHandlerClient(ctx context.Context, mux *run ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/ListCredentialLibraries", runtime.WithHTTPPathPattern("/v1/credential-libraries")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/ListCredentialLibraries", runtime.WithHTTPPathPattern("/v1/credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialLibraryService_ListCredentialLibraries_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialLibraryService_ListCredentialLibraries_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -511,12 +518,13 @@ func RegisterCredentialLibraryServiceHandlerClient(ctx context.Context, mux *run ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/CreateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/CreateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialLibraryService_CreateCredentialLibrary_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialLibraryService_CreateCredentialLibrary_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -531,12 +539,13 @@ func RegisterCredentialLibraryServiceHandlerClient(ctx context.Context, mux *run ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/UpdateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/UpdateCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialLibraryService_UpdateCredentialLibrary_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialLibraryService_UpdateCredentialLibrary_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -551,12 +560,13 @@ func RegisterCredentialLibraryServiceHandlerClient(ctx context.Context, mux *run ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/DeleteCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialLibraryService/DeleteCredentialLibrary", runtime.WithHTTPPathPattern("/v1/credential-libraries/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialLibraryService_DeleteCredentialLibrary_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialLibraryService_DeleteCredentialLibrary_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/credential_store_service.pb.gw.go b/internal/gen/controller/api/services/credential_store_service.pb.gw.go index 83eed05ad..1453ffda8 100644 --- a/internal/gen/controller/api/services/credential_store_service.pb.gw.go +++ b/internal/gen/controller/api/services/credential_store_service.pb.gw.go @@ -317,12 +317,13 @@ func RegisterCredentialStoreServiceHandlerServer(ctx context.Context, mux *runti var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/GetCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/GetCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialStoreService_GetCredentialStore_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialStoreService_GetCredentialStore_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -340,12 +341,13 @@ func RegisterCredentialStoreServiceHandlerServer(ctx context.Context, mux *runti var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/ListCredentialStores", runtime.WithHTTPPathPattern("/v1/credential-stores")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/ListCredentialStores", runtime.WithHTTPPathPattern("/v1/credential-stores")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialStoreService_ListCredentialStores_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialStoreService_ListCredentialStores_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -363,12 +365,13 @@ func RegisterCredentialStoreServiceHandlerServer(ctx context.Context, mux *runti var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/CreateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/CreateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialStoreService_CreateCredentialStore_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialStoreService_CreateCredentialStore_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -386,12 +389,13 @@ func RegisterCredentialStoreServiceHandlerServer(ctx context.Context, mux *runti var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/UpdateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/UpdateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialStoreService_UpdateCredentialStore_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialStoreService_UpdateCredentialStore_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -409,12 +413,13 @@ func RegisterCredentialStoreServiceHandlerServer(ctx context.Context, mux *runti var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/DeleteCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/DeleteCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CredentialStoreService_DeleteCredentialStore_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_CredentialStoreService_DeleteCredentialStore_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -471,12 +476,13 @@ func RegisterCredentialStoreServiceHandlerClient(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/GetCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/GetCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialStoreService_GetCredentialStore_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialStoreService_GetCredentialStore_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -491,12 +497,13 @@ func RegisterCredentialStoreServiceHandlerClient(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/ListCredentialStores", runtime.WithHTTPPathPattern("/v1/credential-stores")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/ListCredentialStores", runtime.WithHTTPPathPattern("/v1/credential-stores")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialStoreService_ListCredentialStores_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialStoreService_ListCredentialStores_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -511,12 +518,13 @@ func RegisterCredentialStoreServiceHandlerClient(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/CreateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/CreateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialStoreService_CreateCredentialStore_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialStoreService_CreateCredentialStore_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -531,12 +539,13 @@ func RegisterCredentialStoreServiceHandlerClient(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/UpdateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/UpdateCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialStoreService_UpdateCredentialStore_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialStoreService_UpdateCredentialStore_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -551,12 +560,13 @@ func RegisterCredentialStoreServiceHandlerClient(ctx context.Context, mux *runti ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/DeleteCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.CredentialStoreService/DeleteCredentialStore", runtime.WithHTTPPathPattern("/v1/credential-stores/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CredentialStoreService_DeleteCredentialStore_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_CredentialStoreService_DeleteCredentialStore_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/group_service.pb.gw.go b/internal/gen/controller/api/services/group_service.pb.gw.go index cf5e890b1..c02e5d80b 100644 --- a/internal/gen/controller/api/services/group_service.pb.gw.go +++ b/internal/gen/controller/api/services/group_service.pb.gw.go @@ -521,12 +521,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/GetGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/GetGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_GetGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_GetGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -544,12 +545,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/ListGroups", runtime.WithHTTPPathPattern("/v1/groups")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/ListGroups", runtime.WithHTTPPathPattern("/v1/groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_ListGroups_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_ListGroups_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -567,12 +569,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/CreateGroup", runtime.WithHTTPPathPattern("/v1/groups")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/CreateGroup", runtime.WithHTTPPathPattern("/v1/groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_CreateGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_CreateGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -590,12 +593,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/UpdateGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/UpdateGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_UpdateGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_UpdateGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -613,12 +617,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/DeleteGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/DeleteGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_DeleteGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_DeleteGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -636,12 +641,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/AddGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:add-members")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/AddGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:add-members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_AddGroupMembers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_AddGroupMembers_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -659,12 +665,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/SetGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:set-members")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/SetGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:set-members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_SetGroupMembers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_SetGroupMembers_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -682,12 +689,13 @@ func RegisterGroupServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/RemoveGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:remove-members")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.GroupService/RemoveGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:remove-members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_GroupService_RemoveGroupMembers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_GroupService_RemoveGroupMembers_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -744,12 +752,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/GetGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/GetGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_GetGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_GetGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -764,12 +773,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/ListGroups", runtime.WithHTTPPathPattern("/v1/groups")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/ListGroups", runtime.WithHTTPPathPattern("/v1/groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_ListGroups_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_ListGroups_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -784,12 +794,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/CreateGroup", runtime.WithHTTPPathPattern("/v1/groups")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/CreateGroup", runtime.WithHTTPPathPattern("/v1/groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_CreateGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_CreateGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -804,12 +815,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/UpdateGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/UpdateGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_UpdateGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_UpdateGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -824,12 +836,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/DeleteGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/DeleteGroup", runtime.WithHTTPPathPattern("/v1/groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_DeleteGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_DeleteGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -844,12 +857,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/AddGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:add-members")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/AddGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:add-members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_AddGroupMembers_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_AddGroupMembers_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -864,12 +878,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/SetGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:set-members")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/SetGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:set-members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_SetGroupMembers_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_SetGroupMembers_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -884,12 +899,13 @@ func RegisterGroupServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/RemoveGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:remove-members")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.GroupService/RemoveGroupMembers", runtime.WithHTTPPathPattern("/v1/groups/{id}:remove-members")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_GroupService_RemoveGroupMembers_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_GroupService_RemoveGroupMembers_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/host_catalog_service.pb.gw.go b/internal/gen/controller/api/services/host_catalog_service.pb.gw.go index e76c2dbc8..9d0020a61 100644 --- a/internal/gen/controller/api/services/host_catalog_service.pb.gw.go +++ b/internal/gen/controller/api/services/host_catalog_service.pb.gw.go @@ -335,12 +335,13 @@ func RegisterHostCatalogServiceHandlerServer(ctx context.Context, mux *runtime.S var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/GetHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/GetHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostCatalogService_GetHostCatalog_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostCatalogService_GetHostCatalog_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -358,12 +359,13 @@ func RegisterHostCatalogServiceHandlerServer(ctx context.Context, mux *runtime.S var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/ListHostCatalogs", runtime.WithHTTPPathPattern("/v1/host-catalogs")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/ListHostCatalogs", runtime.WithHTTPPathPattern("/v1/host-catalogs")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostCatalogService_ListHostCatalogs_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostCatalogService_ListHostCatalogs_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -381,12 +383,13 @@ func RegisterHostCatalogServiceHandlerServer(ctx context.Context, mux *runtime.S var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/CreateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/CreateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostCatalogService_CreateHostCatalog_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostCatalogService_CreateHostCatalog_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -404,12 +407,13 @@ func RegisterHostCatalogServiceHandlerServer(ctx context.Context, mux *runtime.S var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/UpdateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/UpdateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostCatalogService_UpdateHostCatalog_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostCatalogService_UpdateHostCatalog_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -427,12 +431,13 @@ func RegisterHostCatalogServiceHandlerServer(ctx context.Context, mux *runtime.S var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/DeleteHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/DeleteHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostCatalogService_DeleteHostCatalog_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostCatalogService_DeleteHostCatalog_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -489,12 +494,13 @@ func RegisterHostCatalogServiceHandlerClient(ctx context.Context, mux *runtime.S ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/GetHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/GetHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostCatalogService_GetHostCatalog_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostCatalogService_GetHostCatalog_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -509,12 +515,13 @@ func RegisterHostCatalogServiceHandlerClient(ctx context.Context, mux *runtime.S ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/ListHostCatalogs", runtime.WithHTTPPathPattern("/v1/host-catalogs")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/ListHostCatalogs", runtime.WithHTTPPathPattern("/v1/host-catalogs")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostCatalogService_ListHostCatalogs_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostCatalogService_ListHostCatalogs_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -529,12 +536,13 @@ func RegisterHostCatalogServiceHandlerClient(ctx context.Context, mux *runtime.S ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/CreateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/CreateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostCatalogService_CreateHostCatalog_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostCatalogService_CreateHostCatalog_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -549,12 +557,13 @@ func RegisterHostCatalogServiceHandlerClient(ctx context.Context, mux *runtime.S ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/UpdateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/UpdateHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostCatalogService_UpdateHostCatalog_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostCatalogService_UpdateHostCatalog_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -569,12 +578,13 @@ func RegisterHostCatalogServiceHandlerClient(ctx context.Context, mux *runtime.S ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/DeleteHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostCatalogService/DeleteHostCatalog", runtime.WithHTTPPathPattern("/v1/host-catalogs/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostCatalogService_DeleteHostCatalog_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostCatalogService_DeleteHostCatalog_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/host_service.pb.gw.go b/internal/gen/controller/api/services/host_service.pb.gw.go index 2e218df43..f8242c385 100644 --- a/internal/gen/controller/api/services/host_service.pb.gw.go +++ b/internal/gen/controller/api/services/host_service.pb.gw.go @@ -317,12 +317,13 @@ func RegisterHostServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/GetHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/GetHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostService_GetHost_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostService_GetHost_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -340,12 +341,13 @@ func RegisterHostServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/ListHosts", runtime.WithHTTPPathPattern("/v1/hosts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/ListHosts", runtime.WithHTTPPathPattern("/v1/hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostService_ListHosts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostService_ListHosts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -363,12 +365,13 @@ func RegisterHostServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/CreateHost", runtime.WithHTTPPathPattern("/v1/hosts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/CreateHost", runtime.WithHTTPPathPattern("/v1/hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostService_CreateHost_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostService_CreateHost_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -386,12 +389,13 @@ func RegisterHostServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/UpdateHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/UpdateHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostService_UpdateHost_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostService_UpdateHost_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -409,12 +413,13 @@ func RegisterHostServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/DeleteHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostService/DeleteHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostService_DeleteHost_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostService_DeleteHost_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -471,12 +476,13 @@ func RegisterHostServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/GetHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/GetHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostService_GetHost_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostService_GetHost_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -491,12 +497,13 @@ func RegisterHostServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/ListHosts", runtime.WithHTTPPathPattern("/v1/hosts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/ListHosts", runtime.WithHTTPPathPattern("/v1/hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostService_ListHosts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostService_ListHosts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -511,12 +518,13 @@ func RegisterHostServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/CreateHost", runtime.WithHTTPPathPattern("/v1/hosts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/CreateHost", runtime.WithHTTPPathPattern("/v1/hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostService_CreateHost_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostService_CreateHost_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -531,12 +539,13 @@ func RegisterHostServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/UpdateHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/UpdateHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostService_UpdateHost_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostService_UpdateHost_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -551,12 +560,13 @@ func RegisterHostServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/DeleteHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostService/DeleteHost", runtime.WithHTTPPathPattern("/v1/hosts/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostService_DeleteHost_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostService_DeleteHost_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/host_set_service.pb.gw.go b/internal/gen/controller/api/services/host_set_service.pb.gw.go index 99ef76ee3..bc146cc94 100644 --- a/internal/gen/controller/api/services/host_set_service.pb.gw.go +++ b/internal/gen/controller/api/services/host_set_service.pb.gw.go @@ -521,12 +521,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/GetHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/GetHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_GetHostSet_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_GetHostSet_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -544,12 +545,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/ListHostSets", runtime.WithHTTPPathPattern("/v1/host-sets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/ListHostSets", runtime.WithHTTPPathPattern("/v1/host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_ListHostSets_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_ListHostSets_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -567,12 +569,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/CreateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/CreateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_CreateHostSet_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_CreateHostSet_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -590,12 +593,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/UpdateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/UpdateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_UpdateHostSet_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_UpdateHostSet_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -613,12 +617,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/DeleteHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/DeleteHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_DeleteHostSet_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_DeleteHostSet_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -636,12 +641,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/AddHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:add-hosts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/AddHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:add-hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_AddHostSetHosts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_AddHostSetHosts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -659,12 +665,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/SetHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:set-hosts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/SetHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:set-hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_SetHostSetHosts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_SetHostSetHosts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -682,12 +689,13 @@ func RegisterHostSetServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/RemoveHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:remove-hosts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/RemoveHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:remove-hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HostSetService_RemoveHostSetHosts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HostSetService_RemoveHostSetHosts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -744,12 +752,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/GetHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/GetHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_GetHostSet_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_GetHostSet_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -764,12 +773,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/ListHostSets", runtime.WithHTTPPathPattern("/v1/host-sets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/ListHostSets", runtime.WithHTTPPathPattern("/v1/host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_ListHostSets_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_ListHostSets_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -784,12 +794,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/CreateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/CreateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_CreateHostSet_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_CreateHostSet_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -804,12 +815,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/UpdateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/UpdateHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_UpdateHostSet_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_UpdateHostSet_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -824,12 +836,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/DeleteHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/DeleteHostSet", runtime.WithHTTPPathPattern("/v1/host-sets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_DeleteHostSet_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_DeleteHostSet_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -844,12 +857,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/AddHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:add-hosts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/AddHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:add-hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_AddHostSetHosts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_AddHostSetHosts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -864,12 +878,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/SetHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:set-hosts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/SetHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:set-hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_SetHostSetHosts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_SetHostSetHosts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -884,12 +899,13 @@ func RegisterHostSetServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/RemoveHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:remove-hosts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.HostSetService/RemoveHostSetHosts", runtime.WithHTTPPathPattern("/v1/host-sets/{id}:remove-hosts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HostSetService_RemoveHostSetHosts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HostSetService_RemoveHostSetHosts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/managed_group_service.pb.gw.go b/internal/gen/controller/api/services/managed_group_service.pb.gw.go index 780e9bcd2..4ada5ba5b 100644 --- a/internal/gen/controller/api/services/managed_group_service.pb.gw.go +++ b/internal/gen/controller/api/services/managed_group_service.pb.gw.go @@ -317,12 +317,13 @@ func RegisterManagedGroupServiceHandlerServer(ctx context.Context, mux *runtime. var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ManagedGroupService_GetManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ManagedGroupService_GetManagedGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -340,12 +341,13 @@ func RegisterManagedGroupServiceHandlerServer(ctx context.Context, mux *runtime. var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups", runtime.WithHTTPPathPattern("/v1/managed-groups")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups", runtime.WithHTTPPathPattern("/v1/managed-groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ManagedGroupService_ListManagedGroups_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ManagedGroupService_ListManagedGroups_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -363,12 +365,13 @@ func RegisterManagedGroupServiceHandlerServer(ctx context.Context, mux *runtime. var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ManagedGroupService_CreateManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ManagedGroupService_CreateManagedGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -386,12 +389,13 @@ func RegisterManagedGroupServiceHandlerServer(ctx context.Context, mux *runtime. var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ManagedGroupService_UpdateManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ManagedGroupService_UpdateManagedGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -409,12 +413,13 @@ func RegisterManagedGroupServiceHandlerServer(ctx context.Context, mux *runtime. var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ManagedGroupService_DeleteManagedGroup_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ManagedGroupService_DeleteManagedGroup_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -471,12 +476,13 @@ func RegisterManagedGroupServiceHandlerClient(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/GetManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ManagedGroupService_GetManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ManagedGroupService_GetManagedGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -491,12 +497,13 @@ func RegisterManagedGroupServiceHandlerClient(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups", runtime.WithHTTPPathPattern("/v1/managed-groups")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/ListManagedGroups", runtime.WithHTTPPathPattern("/v1/managed-groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ManagedGroupService_ListManagedGroups_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ManagedGroupService_ListManagedGroups_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -511,12 +518,13 @@ func RegisterManagedGroupServiceHandlerClient(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/CreateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ManagedGroupService_CreateManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ManagedGroupService_CreateManagedGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -531,12 +539,13 @@ func RegisterManagedGroupServiceHandlerClient(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/UpdateManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ManagedGroupService_UpdateManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ManagedGroupService_UpdateManagedGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -551,12 +560,13 @@ func RegisterManagedGroupServiceHandlerClient(ctx context.Context, mux *runtime. ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ManagedGroupService/DeleteManagedGroup", runtime.WithHTTPPathPattern("/v1/managed-groups/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ManagedGroupService_DeleteManagedGroup_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ManagedGroupService_DeleteManagedGroup_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/role_service.pb.gw.go b/internal/gen/controller/api/services/role_service.pb.gw.go index 8f8eb27b2..7a72487de 100644 --- a/internal/gen/controller/api/services/role_service.pb.gw.go +++ b/internal/gen/controller/api/services/role_service.pb.gw.go @@ -725,12 +725,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/GetRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/GetRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_GetRole_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_GetRole_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -748,12 +749,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/ListRoles", runtime.WithHTTPPathPattern("/v1/roles")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/ListRoles", runtime.WithHTTPPathPattern("/v1/roles")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_ListRoles_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_ListRoles_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -771,12 +773,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/CreateRole", runtime.WithHTTPPathPattern("/v1/roles")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/CreateRole", runtime.WithHTTPPathPattern("/v1/roles")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_CreateRole_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_CreateRole_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -794,12 +797,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/UpdateRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/UpdateRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_UpdateRole_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_UpdateRole_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -817,12 +821,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/DeleteRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/DeleteRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_DeleteRole_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_DeleteRole_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -840,12 +845,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-principals")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-principals")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_AddRolePrincipals_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_AddRolePrincipals_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -863,12 +869,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-principals")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-principals")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_SetRolePrincipals_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_SetRolePrincipals_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -886,12 +893,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-principals")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-principals")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_RemoveRolePrincipals_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_RemoveRolePrincipals_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -909,12 +917,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-grants")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-grants")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_AddRoleGrants_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_AddRoleGrants_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -932,12 +941,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-grants")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-grants")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_SetRoleGrants_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_SetRoleGrants_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -955,12 +965,13 @@ func RegisterRoleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-grants")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-grants")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_RoleService_RemoveRoleGrants_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_RoleService_RemoveRoleGrants_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1017,12 +1028,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/GetRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/GetRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_GetRole_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_GetRole_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1037,12 +1049,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/ListRoles", runtime.WithHTTPPathPattern("/v1/roles")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/ListRoles", runtime.WithHTTPPathPattern("/v1/roles")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_ListRoles_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_ListRoles_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1057,12 +1070,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/CreateRole", runtime.WithHTTPPathPattern("/v1/roles")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/CreateRole", runtime.WithHTTPPathPattern("/v1/roles")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_CreateRole_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_CreateRole_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1077,12 +1091,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/UpdateRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/UpdateRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_UpdateRole_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_UpdateRole_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1097,12 +1112,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/DeleteRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/DeleteRole", runtime.WithHTTPPathPattern("/v1/roles/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_DeleteRole_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_DeleteRole_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1117,12 +1133,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-principals")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-principals")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_AddRolePrincipals_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_AddRolePrincipals_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1137,12 +1154,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-principals")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-principals")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_SetRolePrincipals_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_SetRolePrincipals_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1157,12 +1175,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-principals")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRolePrincipals", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-principals")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_RemoveRolePrincipals_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_RemoveRolePrincipals_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1177,12 +1196,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-grants")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/AddRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:add-grants")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_AddRoleGrants_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_AddRoleGrants_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1197,12 +1217,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-grants")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/SetRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:set-grants")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_SetRoleGrants_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_SetRoleGrants_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1217,12 +1238,13 @@ func RegisterRoleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-grants")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.RoleService/RemoveRoleGrants", runtime.WithHTTPPathPattern("/v1/roles/{id}:remove-grants")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_RoleService_RemoveRoleGrants_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_RoleService_RemoveRoleGrants_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/scope_service.pb.gw.go b/internal/gen/controller/api/services/scope_service.pb.gw.go index 36f0302a1..896113880 100644 --- a/internal/gen/controller/api/services/scope_service.pb.gw.go +++ b/internal/gen/controller/api/services/scope_service.pb.gw.go @@ -335,12 +335,13 @@ func RegisterScopeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/GetScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/GetScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ScopeService_GetScope_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ScopeService_GetScope_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -358,12 +359,13 @@ func RegisterScopeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/ListScopes", runtime.WithHTTPPathPattern("/v1/scopes")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/ListScopes", runtime.WithHTTPPathPattern("/v1/scopes")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ScopeService_ListScopes_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ScopeService_ListScopes_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -381,12 +383,13 @@ func RegisterScopeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/CreateScope", runtime.WithHTTPPathPattern("/v1/scopes")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/CreateScope", runtime.WithHTTPPathPattern("/v1/scopes")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ScopeService_CreateScope_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ScopeService_CreateScope_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -404,12 +407,13 @@ func RegisterScopeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/UpdateScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/UpdateScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ScopeService_UpdateScope_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ScopeService_UpdateScope_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -427,12 +431,13 @@ func RegisterScopeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/DeleteScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/DeleteScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_ScopeService_DeleteScope_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_ScopeService_DeleteScope_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -489,12 +494,13 @@ func RegisterScopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/GetScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/GetScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ScopeService_GetScope_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ScopeService_GetScope_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -509,12 +515,13 @@ func RegisterScopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/ListScopes", runtime.WithHTTPPathPattern("/v1/scopes")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/ListScopes", runtime.WithHTTPPathPattern("/v1/scopes")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ScopeService_ListScopes_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ScopeService_ListScopes_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -529,12 +536,13 @@ func RegisterScopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/CreateScope", runtime.WithHTTPPathPattern("/v1/scopes")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/CreateScope", runtime.WithHTTPPathPattern("/v1/scopes")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ScopeService_CreateScope_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ScopeService_CreateScope_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -549,12 +557,13 @@ func RegisterScopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/UpdateScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/UpdateScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ScopeService_UpdateScope_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ScopeService_UpdateScope_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -569,12 +578,13 @@ func RegisterScopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/DeleteScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/DeleteScope", runtime.WithHTTPPathPattern("/v1/scopes/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_ScopeService_DeleteScope_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_ScopeService_DeleteScope_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/session_service.pb.gw.go b/internal/gen/controller/api/services/session_service.pb.gw.go index b0ba2815f..bb4112e96 100644 --- a/internal/gen/controller/api/services/session_service.pb.gw.go +++ b/internal/gen/controller/api/services/session_service.pb.gw.go @@ -199,12 +199,13 @@ func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/GetSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/GetSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SessionService_GetSession_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_SessionService_GetSession_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -222,12 +223,13 @@ func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSessions", runtime.WithHTTPPathPattern("/v1/sessions")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSessions", runtime.WithHTTPPathPattern("/v1/sessions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SessionService_ListSessions_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_SessionService_ListSessions_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -245,12 +247,13 @@ func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.Serve var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/CancelSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}:cancel")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/CancelSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}:cancel")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SessionService_CancelSession_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_SessionService_CancelSession_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -307,12 +310,13 @@ func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/GetSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/GetSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SessionService_GetSession_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_SessionService_GetSession_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -327,12 +331,13 @@ func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSessions", runtime.WithHTTPPathPattern("/v1/sessions")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSessions", runtime.WithHTTPPathPattern("/v1/sessions")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SessionService_ListSessions_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_SessionService_ListSessions_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -347,12 +352,13 @@ func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.Serve ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/CancelSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}:cancel")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/CancelSession", runtime.WithHTTPPathPattern("/v1/sessions/{id}:cancel")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SessionService_CancelSession_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_SessionService_CancelSession_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/target_service.pb.gw.go b/internal/gen/controller/api/services/target_service.pb.gw.go index 5d275a7fd..e242e6c24 100644 --- a/internal/gen/controller/api/services/target_service.pb.gw.go +++ b/internal/gen/controller/api/services/target_service.pb.gw.go @@ -1201,12 +1201,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/GetTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/GetTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_GetTarget_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_GetTarget_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1224,12 +1225,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/ListTargets", runtime.WithHTTPPathPattern("/v1/targets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/ListTargets", runtime.WithHTTPPathPattern("/v1/targets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_ListTargets_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_ListTargets_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1247,12 +1249,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/CreateTarget", runtime.WithHTTPPathPattern("/v1/targets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/CreateTarget", runtime.WithHTTPPathPattern("/v1/targets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_CreateTarget_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_CreateTarget_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1270,12 +1273,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/UpdateTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/UpdateTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_UpdateTarget_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_UpdateTarget_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1293,12 +1297,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/DeleteTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/DeleteTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_DeleteTarget_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_DeleteTarget_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1316,12 +1321,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AuthorizeSession", runtime.WithHTTPPathPattern("/v1/targets/{id}:authorize-session")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AuthorizeSession", runtime.WithHTTPPathPattern("/v1/targets/{id}:authorize-session")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_AuthorizeSession_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_AuthorizeSession_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1339,12 +1345,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_AddTargetHostSets_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_AddTargetHostSets_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1362,12 +1369,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_SetTargetHostSets_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_SetTargetHostSets_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1385,12 +1393,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sets")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_RemoveTargetHostSets_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_RemoveTargetHostSets_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1408,12 +1417,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sources")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_AddTargetHostSources_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_AddTargetHostSources_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1431,12 +1441,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sources")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_SetTargetHostSources_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_SetTargetHostSources_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1454,12 +1465,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sources")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_RemoveTargetHostSources_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_RemoveTargetHostSources_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1477,12 +1489,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-libraries")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_AddTargetCredentialLibraries_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_AddTargetCredentialLibraries_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1500,12 +1513,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-libraries")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_SetTargetCredentialLibraries_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_SetTargetCredentialLibraries_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1523,12 +1537,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-libraries")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_RemoveTargetCredentialLibraries_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_RemoveTargetCredentialLibraries_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1546,12 +1561,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-sources")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_AddTargetCredentialSources_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_AddTargetCredentialSources_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1569,12 +1585,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-sources")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_SetTargetCredentialSources_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_SetTargetCredentialSources_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1592,12 +1609,13 @@ func RegisterTargetServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-sources")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TargetService_RemoveTargetCredentialSources_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TargetService_RemoveTargetCredentialSources_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -1654,12 +1672,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/GetTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/GetTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_GetTarget_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_GetTarget_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1674,12 +1693,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/ListTargets", runtime.WithHTTPPathPattern("/v1/targets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/ListTargets", runtime.WithHTTPPathPattern("/v1/targets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_ListTargets_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_ListTargets_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1694,12 +1714,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/CreateTarget", runtime.WithHTTPPathPattern("/v1/targets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/CreateTarget", runtime.WithHTTPPathPattern("/v1/targets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_CreateTarget_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_CreateTarget_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1714,12 +1735,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/UpdateTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/UpdateTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_UpdateTarget_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_UpdateTarget_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1734,12 +1756,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/DeleteTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/DeleteTarget", runtime.WithHTTPPathPattern("/v1/targets/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_DeleteTarget_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_DeleteTarget_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1754,12 +1777,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AuthorizeSession", runtime.WithHTTPPathPattern("/v1/targets/{id}:authorize-session")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AuthorizeSession", runtime.WithHTTPPathPattern("/v1/targets/{id}:authorize-session")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_AuthorizeSession_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_AuthorizeSession_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1774,12 +1798,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_AddTargetHostSets_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_AddTargetHostSets_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1794,12 +1819,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_SetTargetHostSets_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_SetTargetHostSets_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1814,12 +1840,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sets")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSets", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sets")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_RemoveTargetHostSets_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_RemoveTargetHostSets_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1834,12 +1861,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sources")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-host-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_AddTargetHostSources_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_AddTargetHostSources_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1854,12 +1882,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sources")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-host-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_SetTargetHostSources_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_SetTargetHostSources_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1874,12 +1903,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sources")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetHostSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-host-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_RemoveTargetHostSources_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_RemoveTargetHostSources_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1894,12 +1924,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-libraries")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_AddTargetCredentialLibraries_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_AddTargetCredentialLibraries_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1914,12 +1945,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-libraries")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_SetTargetCredentialLibraries_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_SetTargetCredentialLibraries_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1934,12 +1966,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-libraries")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialLibraries", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-libraries")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_RemoveTargetCredentialLibraries_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_RemoveTargetCredentialLibraries_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1954,12 +1987,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-sources")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/AddTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:add-credential-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_AddTargetCredentialSources_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_AddTargetCredentialSources_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1974,12 +2008,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-sources")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/SetTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:set-credential-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_SetTargetCredentialSources_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_SetTargetCredentialSources_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1994,12 +2029,13 @@ func RegisterTargetServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-sources")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.TargetService/RemoveTargetCredentialSources", runtime.WithHTTPPathPattern("/v1/targets/{id}:remove-credential-sources")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TargetService_RemoveTargetCredentialSources_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TargetService_RemoveTargetCredentialSources_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/api/services/user_service.pb.gw.go b/internal/gen/controller/api/services/user_service.pb.gw.go index b5322a8a1..97af6cad1 100644 --- a/internal/gen/controller/api/services/user_service.pb.gw.go +++ b/internal/gen/controller/api/services/user_service.pb.gw.go @@ -521,12 +521,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_GetUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_GetUser_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -544,12 +545,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/v1/users")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/v1/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_ListUsers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_ListUsers_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -567,12 +569,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_CreateUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_CreateUser_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -590,12 +593,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_UpdateUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_UpdateUser_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -613,12 +617,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_DeleteUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_DeleteUser_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -636,12 +641,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/AddUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:add-accounts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/AddUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:add-accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_AddUserAccounts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_AddUserAccounts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -659,12 +665,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/SetUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:set-accounts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/SetUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:set-accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_SetUserAccounts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_SetUserAccounts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -682,12 +689,13 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/RemoveUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:remove-accounts")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.UserService/RemoveUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:remove-accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_RemoveUserAccounts_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_RemoveUserAccounts_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -744,12 +752,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/GetUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_GetUser_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_GetUser_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -764,12 +773,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/v1/users")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/ListUsers", runtime.WithHTTPPathPattern("/v1/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_ListUsers_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_ListUsers_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -784,12 +794,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/CreateUser", runtime.WithHTTPPathPattern("/v1/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_CreateUser_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_CreateUser_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -804,12 +815,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/UpdateUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_UpdateUser_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_UpdateUser_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -824,12 +836,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/DeleteUser", runtime.WithHTTPPathPattern("/v1/users/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_DeleteUser_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_DeleteUser_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -844,12 +857,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/AddUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:add-accounts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/AddUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:add-accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_AddUserAccounts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_AddUserAccounts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -864,12 +878,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/SetUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:set-accounts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/SetUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:set-accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_SetUserAccounts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_SetUserAccounts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -884,12 +899,13 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/RemoveUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:remove-accounts")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.UserService/RemoveUserAccounts", runtime.WithHTTPPathPattern("/v1/users/{id}:remove-accounts")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_RemoveUserAccounts_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_UserService_RemoveUserAccounts_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/controller/ops/services/health_service.pb.gw.go b/internal/gen/controller/ops/services/health_service.pb.gw.go index b9cb84cca..9b77dbb35 100644 --- a/internal/gen/controller/ops/services/health_service.pb.gw.go +++ b/internal/gen/controller/ops/services/health_service.pb.gw.go @@ -61,12 +61,13 @@ func RegisterHealthServiceHandlerServer(ctx context.Context, mux *runtime.ServeM var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_HealthService_GetHealth_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_HealthService_GetHealth_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -123,12 +124,13 @@ func RegisterHealthServiceHandlerClient(ctx context.Context, mux *runtime.ServeM ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/controller.ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_HealthService_GetHealth_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_HealthService_GetHealth_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/testing/event/event.pb.gw.go b/internal/gen/testing/event/event.pb.gw.go index 60a213b6b..3a6980f91 100644 --- a/internal/gen/testing/event/event.pb.gw.go +++ b/internal/gen/testing/event/event.pb.gw.go @@ -111,12 +111,13 @@ func RegisterTestAuthMethodServiceHandlerServer(ctx context.Context, mux *runtim var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.event.v1.TestAuthMethodService/TestAuthenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.event.v1.TestAuthMethodService/TestAuthenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TestAuthMethodService_TestAuthenticate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TestAuthMethodService_TestAuthenticate_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -173,12 +174,13 @@ func RegisterTestAuthMethodServiceHandlerClient(ctx context.Context, mux *runtim ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/testing.event.v1.TestAuthMethodService/TestAuthenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.event.v1.TestAuthMethodService/TestAuthenticate", runtime.WithHTTPPathPattern("/v1/auth-methods/{auth_method_id}:authenticate")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TestAuthMethodService_TestAuthenticate_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TestAuthMethodService_TestAuthenticate_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/internal/gen/testing/event/testing.swagger.json b/internal/gen/testing/event/testing.swagger.json index b44a42a72..041fef5ec 100644 --- a/internal/gen/testing/event/testing.swagger.json +++ b/internal/gen/testing/event/testing.swagger.json @@ -6,7 +6,7 @@ }, "tags": [ { - "name": "TestAuthMethodService" + "name": "testing.event.v1.TestAuthMethodService" } ], "consumes": [ diff --git a/internal/gen/testing/protooptions/service.pb.gw.go b/internal/gen/testing/protooptions/service.pb.gw.go index 738fc5d7f..7c6831391 100644 --- a/internal/gen/testing/protooptions/service.pb.gw.go +++ b/internal/gen/testing/protooptions/service.pb.gw.go @@ -131,12 +131,13 @@ func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v1/test/{id}")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v1/test/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TestService_TestMethod_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TestService_TestMethod_0(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -154,12 +155,13 @@ func RegisterTestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v2/test")) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v2/test")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_TestService_TestMethod_1(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_TestService_TestMethod_1(ctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -216,12 +218,13 @@ func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v1/test/{id}")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v1/test/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TestService_TestMethod_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TestService_TestMethod_0(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -236,12 +239,13 @@ func RegisterTestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v2/test")) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.options.v1.TestService/TestMethod", runtime.WithHTTPPathPattern("/v2/test")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_TestService_TestMethod_1(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_TestService_TestMethod_1(ctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) From e76db2cd139170b088291eaaa79065d6db2387da Mon Sep 17 00:00:00 2001 From: irenarindos Date: Thu, 17 Mar 2022 14:40:54 -0400 Subject: [PATCH 02/45] feat(proto): create custom option for attribute subtype --- internal/api/genapi/parse.go | 6 ++- .../custom_options/v1/options.proto | 5 +++ sdk/pbs/controller/protooptions/options.pb.go | 43 +++++++++++++------ 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/internal/api/genapi/parse.go b/internal/api/genapi/parse.go index 39610d8db..e60c703f7 100644 --- a/internal/api/genapi/parse.go +++ b/internal/api/genapi/parse.go @@ -42,6 +42,11 @@ func parsePBs() { in.generatedStructure.name = string(desc.Name()) for i := 0; i < desc.Fields().Len(); i++ { fd := desc.Fields().Get(i) + opts := fd.Options().(*descriptorpb.FieldOptions) + if subtype := proto.GetExtension(opts, protooptions.E_Subtype).(string); subtype != "" && subtype != "default" { + // Skip rendering any fields except the default subtype field. + continue + } if strutil.StrListContains(in.fieldFilter, string(fd.Name())) { continue } @@ -55,7 +60,6 @@ func parsePBs() { sliceText = "[]" } // Add generate option info - opts := fd.Options().(*descriptorpb.FieldOptions) if proto.GetExtension(opts, protooptions.E_GenerateSdkOption).(bool) { fi.GenerateSdkOption = true } diff --git a/internal/proto/controller/custom_options/v1/options.proto b/internal/proto/controller/custom_options/v1/options.proto index 13ca06691..0aad5f61d 100644 --- a/internal/proto/controller/custom_options/v1/options.proto +++ b/internal/proto/controller/custom_options/v1/options.proto @@ -15,6 +15,11 @@ extend google.protobuf.FieldOptions { // generate_sdk_option is a directive used when generating the SDK to // indicate that an option should be created for the field bool generate_sdk_option = 85412; + + // subtype is used for oneOf attribute subtypes, to identify that we only need to parse attributes + // of oneOf once and not for each option when generating the API + // This will serve as a JSON key, used to transform that into the key the protobuf expects + string subtype = 85555; } message MaskMapping { diff --git a/sdk/pbs/controller/protooptions/options.pb.go b/sdk/pbs/controller/protooptions/options.pb.go index eb76bc735..dba44c336 100644 --- a/sdk/pbs/controller/protooptions/options.pb.go +++ b/sdk/pbs/controller/protooptions/options.pb.go @@ -93,6 +93,14 @@ var file_controller_custom_options_v1_options_proto_extTypes = []protoimpl.Exten Tag: "varint,85412,opt,name=generate_sdk_option", Filename: "controller/custom_options/v1/options.proto", }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 85555, + Name: "controller.custom_options.v1.subtype", + Tag: "bytes,85555,opt,name=subtype", + Filename: "controller/custom_options/v1/options.proto", + }, } // Extension fields to descriptorpb.FieldOptions. @@ -109,6 +117,12 @@ var ( // // optional bool generate_sdk_option = 85412; E_GenerateSdkOption = &file_controller_custom_options_v1_options_proto_extTypes[1] + // subtype is used for oneOf attribute subtypes, to identify that we only need to parse attributes + // of oneOf once and not for each option when generating the API + // This will serve as a JSON key, used to transform that into the key the protobuf expects + // + // optional string subtype = 85555; + E_Subtype = &file_controller_custom_options_v1_options_proto_extTypes[2] ) var File_controller_custom_options_v1_options_proto protoreflect.FileDescriptor @@ -136,12 +150,16 @@ var file_controller_custom_options_v1_options_proto_rawDesc = []byte{ 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xa4, 0x9b, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x64, 0x6b, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x3a, 0x39, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb3, 0x9c, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -164,11 +182,12 @@ var file_controller_custom_options_v1_options_proto_goTypes = []interface{}{ var file_controller_custom_options_v1_options_proto_depIdxs = []int32{ 1, // 0: controller.custom_options.v1.mask_mapping:extendee -> google.protobuf.FieldOptions 1, // 1: controller.custom_options.v1.generate_sdk_option:extendee -> google.protobuf.FieldOptions - 0, // 2: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 2, // [2:3] is the sub-list for extension type_name - 0, // [0:2] is the sub-list for extension extendee + 1, // 2: controller.custom_options.v1.subtype:extendee -> google.protobuf.FieldOptions + 0, // 3: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 3, // [3:4] is the sub-list for extension type_name + 0, // [0:3] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -198,7 +217,7 @@ func file_controller_custom_options_v1_options_proto_init() { RawDescriptor: file_controller_custom_options_v1_options_proto_rawDesc, NumEnums: 0, NumMessages: 1, - NumExtensions: 2, + NumExtensions: 3, NumServices: 0, }, GoTypes: file_controller_custom_options_v1_options_proto_goTypes, From eb43941771722ea34f2712c4d4677fb3c947b1b4 Mon Sep 17 00:00:00 2001 From: irenarindos Date: Mon, 28 Mar 2022 11:12:02 -0400 Subject: [PATCH 03/45] refact(account): Use OneOf for Account attributes --- internal/gen/controller.swagger.json | 54 +++ .../api/resources/accounts/v1/account.proto | 8 +- .../handlers/accounts/account_service.go | 67 +-- .../handlers/accounts/account_service_test.go | 418 +++++++++++------- .../handlers/accounts/validate_test.go | 85 +--- .../api/resources/accounts/account.pb.go | 193 +++++--- 6 files changed, 476 insertions(+), 349 deletions(-) diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index 54c1efe60..a3b218709 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -3702,6 +3702,12 @@ "type": "object", "description": "The attributes that are applicable for the specific Account type." }, + "password_account_attributes": { + "$ref": "#/definitions/controller.api.resources.accounts.v1.PasswordAccountAttributes" + }, + "oidc_account_attributes": { + "$ref": "#/definitions/controller.api.resources.accounts.v1.OidcAccountAttributes" + }, "managed_group_ids": { "type": "array", "items": { @@ -3721,6 +3727,54 @@ }, "title": "Account contains all fields related to an Account resource" }, + "controller.api.resources.accounts.v1.OidcAccountAttributes": { + "type": "object", + "properties": { + "issuer": { + "type": "string", + "description": "issuer is a case sensitive URL that maps to the OIDC iss claim.\nThis value is immutable after creation time." + }, + "subject": { + "type": "string", + "description": "subject is a case sensitive string that maps to the OIDC sub claim.\nThis value is immutable after creation time." + }, + "full_name": { + "type": "string", + "description": "Output only. full_name is a string that maps to the OIDC name claim.", + "readOnly": true + }, + "email": { + "type": "string", + "description": "Output only. email is a string that maps to the OIDC email claim.", + "readOnly": true + }, + "token_claims": { + "type": "object", + "description": "Output only. token_claims are the marshaled claims from the token.", + "readOnly": true + }, + "userinfo_claims": { + "type": "object", + "description": "Output only. userinfo_claims are the marshaled claims from userinfo.", + "readOnly": true + } + }, + "description": "Attributes associated only with Accounts with type \"oidc\"." + }, + "controller.api.resources.accounts.v1.PasswordAccountAttributes": { + "type": "object", + "properties": { + "login_name": { + "type": "string", + "description": "The login name of this Account. This is unique per Auth Method." + }, + "password": { + "type": "string", + "description": "The password for this Account." + } + }, + "description": "Attributes associated only with Accounts with type \"password\"." + }, "controller.api.resources.authmethods.v1.AuthMethod": { "type": "object", "properties": { diff --git a/internal/proto/controller/api/resources/accounts/v1/account.proto b/internal/proto/controller/api/resources/accounts/v1/account.proto index 77b70708d..12a74f7a0 100644 --- a/internal/proto/controller/api/resources/accounts/v1/account.proto +++ b/internal/proto/controller/api/resources/accounts/v1/account.proto @@ -40,8 +40,12 @@ message Account { // The ID of the Auth Method that is associated with this Account. string auth_method_id = 90 [json_name="auth_method_id"]; - // The attributes that are applicable for the specific Account type. - google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific Account type. + google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "default"]; + PasswordAccountAttributes password_account_attributes = 101 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "password"]; + OidcAccountAttributes oidc_account_attributes = 102 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "oidc"]; + } // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account repeated string managed_group_ids = 110 [json_name="managed_group_ids"]; diff --git a/internal/servers/controller/handlers/accounts/account_service.go b/internal/servers/controller/handlers/accounts/account_service.go index fc3a3e984..8fc0510d2 100644 --- a/internal/servers/controller/handlers/accounts/account_service.go +++ b/internal/servers/controller/handlers/accounts/account_service.go @@ -437,11 +437,7 @@ func (s Service) createPwInRepo(ctx context.Context, am auth.AuthMethod, item *p if item == nil { return nil, errors.New(ctx, errors.InvalidParameter, op, "missing item") } - pwAttrs := &pb.PasswordAccountAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), pwAttrs); err != nil { - return nil, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{"attributes": "Attribute fields do not match the expected format."}) - } + pwAttrs := item.GetPasswordAccountAttributes() opts := []password.Option{password.WithLoginName(pwAttrs.GetLoginName())} if item.GetName() != nil { opts = append(opts, password.WithName(item.GetName().GetValue())) @@ -484,11 +480,7 @@ func (s Service) createOidcInRepo(ctx context.Context, am auth.AuthMethod, item if item.GetDescription() != nil { opts = append(opts, oidc.WithDescription(item.GetDescription().GetValue())) } - attrs := &pb.OidcAccountAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), attrs); err != nil { - return nil, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{"attributes": "Attribute fields do not match the expected format."}) - } + attrs := item.GetOidcAccountAttributes() if attrs.GetIssuer() != "" { u, err := url.Parse(attrs.GetIssuer()) if err != nil { @@ -867,11 +859,11 @@ func toProto(ctx context.Context, in auth.Account, opt ...handlers.Option) (*pb. if !outputFields.Has(globals.AttributesField) { break } - st, err := handlers.ProtoToStruct(&pb.PasswordAccountAttributes{LoginName: i.GetLoginName()}) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building password attribute struct: %v", err) + out.Attrs = &pb.Account_PasswordAccountAttributes{ + PasswordAccountAttributes: &pb.PasswordAccountAttributes{ + LoginName: i.GetLoginName(), + }, } - out.Attributes = st case *oidc.Account: if outputFields.Has(globals.TypeField) { out.Type = oidc.Subtype.String() @@ -879,11 +871,13 @@ func toProto(ctx context.Context, in auth.Account, opt ...handlers.Option) (*pb. if !outputFields.Has(globals.AttributesField) { break } - attrs := &pb.OidcAccountAttributes{ - Issuer: i.GetIssuer(), - Subject: i.GetSubject(), - FullName: i.GetFullName(), - Email: i.GetEmail(), + attrs := &pb.Account_OidcAccountAttributes{ + OidcAccountAttributes: &pb.OidcAccountAttributes{ + Issuer: i.GetIssuer(), + Subject: i.GetSubject(), + FullName: i.GetFullName(), + Email: i.GetEmail(), + }, } if s := i.GetTokenClaims(); s != "" { m := make(map[string]interface{}) @@ -891,7 +885,7 @@ func toProto(ctx context.Context, in auth.Account, opt ...handlers.Option) (*pb. if err = json.Unmarshal([]byte(s), &m); err != nil { return nil, errors.Wrap(ctx, err, op, errors.WithMsg("error unmarshaling stored token claims")) } - if attrs.TokenClaims, err = structpb.NewStruct(m); err != nil { + if attrs.OidcAccountAttributes.TokenClaims, err = structpb.NewStruct(m); err != nil { return nil, errors.Wrap(ctx, err, op, errors.WithMsg("error converting stored token claims to protobuf struct")) } } @@ -901,15 +895,11 @@ func toProto(ctx context.Context, in auth.Account, opt ...handlers.Option) (*pb. if err = json.Unmarshal([]byte(s), &m); err != nil { return nil, errors.Wrap(ctx, err, op, errors.WithMsg("error unmarshaling stored userinfo claims")) } - if attrs.UserinfoClaims, err = structpb.NewStruct(m); err != nil { + if attrs.OidcAccountAttributes.UserinfoClaims, err = structpb.NewStruct(m); err != nil { return nil, errors.Wrap(ctx, err, op, errors.WithMsg("error converting stored userinfo claims to protobuf struct")) } } - st, err := handlers.ProtoToStruct(attrs) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building oidc attribute struct: %v", err) - } - out.Attributes = st + out.Attrs = attrs } return &out, nil } @@ -931,12 +921,7 @@ func toStoragePwAccount(amId string, item *pb.Account) (*password.Account, error return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build account for creation: %v.", err) } - attrs := &pb.PasswordAccountAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), attrs); err != nil { - return nil, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{attributesField: "Attribute fields do not match the expected format."}) - } - + attrs := item.GetPasswordAccountAttributes() if attrs.GetLoginName() != "" { u.LoginName = attrs.GetLoginName() } @@ -971,10 +956,7 @@ func validateCreateRequest(req *pbs.CreateAccountRequest) error { if req.GetItem().GetType() != "" && req.GetItem().GetType() != password.Subtype.String() { badFields[typeField] = "Doesn't match the parent resource's type." } - attrs := &pb.PasswordAccountAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } + attrs := req.GetItem().GetPasswordAccountAttributes() if attrs.GetLoginName() == "" { badFields[loginNameKey] = "This is a required field for this type." } @@ -982,10 +964,7 @@ func validateCreateRequest(req *pbs.CreateAccountRequest) error { if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[typeField] = "Doesn't match the parent resource's type." } - attrs := &pb.OidcAccountAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } + attrs := req.GetItem().GetOidcAccountAttributes() if attrs.GetSubject() == "" { badFields[subjectField] = "This is a required field for this type." } @@ -1023,18 +1002,10 @@ func validateUpdateRequest(req *pbs.UpdateAccountRequest) error { if req.GetItem().GetType() != "" && req.GetItem().GetType() != password.Subtype.String() { badFields[typeField] = "Cannot modify the resource type." } - attrs := &pb.PasswordAccountAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } case oidc.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[typeField] = "Cannot modify the resource type." } - attrs := &pb.OidcAccountAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } if handlers.MaskContains(req.GetUpdateMask().GetPaths(), subjectField) { badFields[subjectField] = "Field cannot be updated." } diff --git a/internal/servers/controller/handlers/accounts/account_service_test.go b/internal/servers/controller/handlers/accounts/account_service_test.go index 056983ae3..7a3e04105 100644 --- a/internal/servers/controller/handlers/accounts/account_service_test.go +++ b/internal/servers/controller/handlers/accounts/account_service_test.go @@ -32,7 +32,6 @@ import ( "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/codes" "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" ) @@ -130,14 +129,16 @@ func TestGet(t *testing.T) { pwA := password.TestAccount(t, conn, am.GetPublicId(), "name1") pwWireAccount := pb.Account{ - Id: pwA.GetPublicId(), - AuthMethodId: pwA.GetAuthMethodId(), - CreatedTime: pwA.GetCreateTime().GetTimestamp(), - UpdatedTime: pwA.GetUpdateTime().GetTimestamp(), - Scope: &scopepb.ScopeInfo{Id: org.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: 1, - Type: password.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{"login_name": structpb.NewStringValue(pwA.GetLoginName())}}, + Id: pwA.GetPublicId(), + AuthMethodId: pwA.GetAuthMethodId(), + CreatedTime: pwA.GetCreateTime().GetTimestamp(), + UpdatedTime: pwA.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: org.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: password.Subtype.String(), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{LoginName: pwA.GetLoginName()}, + }, AuthorizedActions: pwAuthorizedActions, } @@ -162,10 +163,12 @@ func TestGet(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: org.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue(oidcAm.GetIssuer()), - "subject": structpb.NewStringValue("test-subject"), - }}, + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Issuer: oidcAm.GetIssuer(), + Subject: "test-subject", + }, + }, AuthorizedActions: oidcAuthorizedActions, ManagedGroupIds: []string{mg.GetPublicId()}, } @@ -267,14 +270,16 @@ func TestListPassword(t *testing.T) { var wantSomeAccounts []*pb.Account for _, aa := range password.TestMultipleAccounts(t, conn, amSomeAccounts.GetPublicId(), 3) { wantSomeAccounts = append(wantSomeAccounts, &pb.Account{ - Id: aa.GetPublicId(), - AuthMethodId: aa.GetAuthMethodId(), - CreatedTime: aa.GetCreateTime().GetTimestamp(), - UpdatedTime: aa.GetUpdateTime().GetTimestamp(), - Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: 1, - Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{"login_name": structpb.NewStringValue(aa.GetLoginName())}}, + Id: aa.GetPublicId(), + AuthMethodId: aa.GetAuthMethodId(), + CreatedTime: aa.GetCreateTime().GetTimestamp(), + UpdatedTime: aa.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: "password", + Attrs: &pb.Account_PasswordAccountAttributes{ + PasswordAccountAttributes: &pb.PasswordAccountAttributes{LoginName: aa.GetLoginName()}, + }, AuthorizedActions: pwAuthorizedActions, }) } @@ -282,14 +287,16 @@ func TestListPassword(t *testing.T) { var wantOtherAccounts []*pb.Account for _, aa := range password.TestMultipleAccounts(t, conn, amOtherAccounts.GetPublicId(), 3) { wantOtherAccounts = append(wantOtherAccounts, &pb.Account{ - Id: aa.GetPublicId(), - AuthMethodId: aa.GetAuthMethodId(), - CreatedTime: aa.GetCreateTime().GetTimestamp(), - UpdatedTime: aa.GetUpdateTime().GetTimestamp(), - Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: 1, - Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{"login_name": structpb.NewStringValue(aa.GetLoginName())}}, + Id: aa.GetPublicId(), + AuthMethodId: aa.GetAuthMethodId(), + CreatedTime: aa.GetCreateTime().GetTimestamp(), + UpdatedTime: aa.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: "password", + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{LoginName: aa.GetLoginName()}, + }, AuthorizedActions: pwAuthorizedActions, }) } @@ -325,7 +332,7 @@ func TestListPassword(t *testing.T) { name: "Filter Some Accounts", req: &pbs.ListAccountsRequest{ AuthMethodId: amSomeAccounts.GetPublicId(), - Filter: fmt.Sprintf(`"/item/attributes/login_name"==%q`, wantSomeAccounts[1].Attributes.AsMap()["login_name"]), + Filter: fmt.Sprintf(`"/item/attributes/login_name"==%q`, wantSomeAccounts[1].GetPasswordAccountAttributes().LoginName), }, res: &pbs.ListAccountsResponse{Items: wantSomeAccounts[1:2]}, skipAnon: true, @@ -369,7 +376,7 @@ func TestListPassword(t *testing.T) { require.NoError(gErr) assert.Len(got.Items, len(tc.res.Items)) for _, g := range got.GetItems() { - assert.Nil(g.Attributes) + assert.Nil(g.Attrs) assert.Nil(g.CreatedTime) assert.Nil(g.UpdatedTime) assert.Empty(g.Version) @@ -416,10 +423,12 @@ func TestListOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue(amSomeAccounts.GetIssuer()), - "subject": structpb.NewStringValue(subId), - }}, + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Issuer: amSomeAccounts.GetIssuer(), + Subject: subId, + }, + }, AuthorizedActions: oidcAuthorizedActions, }) } @@ -436,10 +445,12 @@ func TestListOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue(amOtherAccounts.GetIssuer()), - "subject": structpb.NewStringValue(subId), - }}, + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Issuer: amOtherAccounts.GetIssuer(), + Subject: subId, + }, + }, AuthorizedActions: oidcAuthorizedActions, }) } @@ -475,7 +486,7 @@ func TestListOidc(t *testing.T) { name: "Filter Some Accounts", req: &pbs.ListAccountsRequest{ AuthMethodId: amSomeAccounts.GetPublicId(), - Filter: fmt.Sprintf(`"/item/attributes/subject"==%q`, wantSomeAccounts[1].Attributes.AsMap()["subject"]), + Filter: fmt.Sprintf(`"/item/attributes/subject"==%q`, wantSomeAccounts[1].GetOidcAccountAttributes().Subject), }, res: &pbs.ListAccountsResponse{Items: wantSomeAccounts[1:2]}, skipAnon: true, @@ -509,8 +520,8 @@ func TestListOidc(t *testing.T) { require.NoError(gErr) } sort.Slice(got.Items, func(i, j int) bool { - return strings.Compare(got.Items[i].GetAttributes().GetFields()["subject"].GetStringValue(), - got.Items[j].GetAttributes().GetFields()["subject"].GetStringValue()) < 0 + return strings.Compare(got.Items[i].GetOidcAccountAttributes().Subject, + got.Items[j].GetOidcAccountAttributes().Subject) < 0 }) assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "ListAccounts() with scope %q got response %q, wanted %q", tc.req, got, tc.res) @@ -522,7 +533,7 @@ func TestListOidc(t *testing.T) { require.NoError(gErr) assert.Len(got.Items, len(tc.res.Items)) for _, g := range got.GetItems() { - assert.Nil(g.Attributes) + assert.Nil(g.Attrs) assert.Nil(g.CreatedTime) assert.Nil(g.UpdatedTime) assert.Empty(g.Version) @@ -684,16 +695,6 @@ func TestCreatePassword(t *testing.T) { defaultCreated := defaultAccount.GetCreateTime().GetTimestamp() require.NoError(t, err, "Error converting proto to timestamp.") - createAttr := func(un, pw string) *structpb.Struct { - attr := &pb.PasswordAccountAttributes{LoginName: un} - if pw != "" { - attr.Password = wrapperspb.String(pw) - } - ret, err := handlers.ProtoToStruct(attr) - require.NoError(t, err, "Error converting proto to struct.") - return ret - } - cases := []struct { name string req *pbs.CreateAccountRequest @@ -708,19 +709,29 @@ func TestCreatePassword(t *testing.T) { Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: "password", - Attributes: createAttr("validaccount", ""), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "validaccount", + Password: nil, + }, + }, }, }, res: &pbs.CreateAccountResponse{ Uri: fmt.Sprintf("accounts/%s_", intglobals.NewPasswordAccountPrefix), Item: &pb.Account{ - AuthMethodId: defaultAccount.GetAuthMethodId(), - Name: &wrapperspb.StringValue{Value: "name"}, - Description: &wrapperspb.StringValue{Value: "desc"}, - Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: 1, - Type: "password", - Attributes: createAttr("validaccount", ""), + AuthMethodId: defaultAccount.GetAuthMethodId(), + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: "password", + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "validaccount", + Password: nil, + }, + }, AuthorizedActions: pwAuthorizedActions, }, }, @@ -730,17 +741,27 @@ func TestCreatePassword(t *testing.T) { req: &pbs.CreateAccountRequest{ Item: &pb.Account{ AuthMethodId: defaultAccount.GetAuthMethodId(), - Attributes: createAttr("notypedefined", ""), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "notypedefined", + Password: nil, + }, + }, }, }, res: &pbs.CreateAccountResponse{ Uri: fmt.Sprintf("accounts/%s_", intglobals.NewPasswordAccountPrefix), Item: &pb.Account{ - AuthMethodId: defaultAccount.GetAuthMethodId(), - Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: 1, - Type: "password", - Attributes: createAttr("notypedefined", ""), + AuthMethodId: defaultAccount.GetAuthMethodId(), + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: "password", + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "notypedefined", + Password: nil, + }, + }, AuthorizedActions: pwAuthorizedActions, }, }, @@ -752,19 +773,29 @@ func TestCreatePassword(t *testing.T) { AuthMethodId: defaultAccount.GetAuthMethodId(), Name: &wrapperspb.StringValue{Value: "name_with_password"}, Description: &wrapperspb.StringValue{Value: "desc"}, - Attributes: createAttr("haspassword", "somepassword"), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "haspassword", + Password: &wrapperspb.StringValue{Value: "somepassword"}, + }, + }, }, }, res: &pbs.CreateAccountResponse{ Uri: fmt.Sprintf("accounts/%s_", intglobals.NewPasswordAccountPrefix), Item: &pb.Account{ - AuthMethodId: defaultAccount.GetAuthMethodId(), - Name: &wrapperspb.StringValue{Value: "name_with_password"}, - Description: &wrapperspb.StringValue{Value: "desc"}, - Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: 1, - Type: "password", - Attributes: createAttr("haspassword", ""), + AuthMethodId: defaultAccount.GetAuthMethodId(), + Name: &wrapperspb.StringValue{Value: "name_with_password"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: 1, + Type: "password", + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "haspassword", + Password: nil, + }, + }, AuthorizedActions: pwAuthorizedActions, }, }, @@ -775,7 +806,12 @@ func TestCreatePassword(t *testing.T) { Item: &pb.Account{ AuthMethodId: defaultAccount.GetAuthMethodId(), Type: "wrong", - Attributes: createAttr("nopwprovided", ""), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "nopwprovided", + Password: nil, + }, + }, }, }, res: nil, @@ -788,7 +824,12 @@ func TestCreatePassword(t *testing.T) { AuthMethodId: defaultAccount.GetAuthMethodId(), Id: intglobals.NewPasswordAccountPrefix + "_notallowed", Type: "password", - Attributes: createAttr("cantprovideid", ""), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "cantprovideid", + Password: nil, + }, + }, }, }, res: nil, @@ -801,7 +842,12 @@ func TestCreatePassword(t *testing.T) { AuthMethodId: defaultAccount.GetAuthMethodId(), CreatedTime: timestamppb.Now(), Type: "password", - Attributes: createAttr("nocreatedtime", ""), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "nocreatedtime", + Password: nil, + }, + }, }, }, res: nil, @@ -814,7 +860,12 @@ func TestCreatePassword(t *testing.T) { AuthMethodId: defaultAccount.GetAuthMethodId(), UpdatedTime: timestamppb.Now(), Type: "password", - Attributes: createAttr("noupdatetime", ""), + Attrs: &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "noupdatetime", + Password: nil, + }, + }, }, }, res: nil, @@ -839,6 +890,8 @@ func TestCreatePassword(t *testing.T) { if tc.err != nil { require.Error(gErr) assert.True(errors.Is(gErr, tc.err), "CreateAccount(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + } else { + require.NoError(gErr) } if got != nil { assert.Contains(got.GetUri(), tc.res.Uri) @@ -891,13 +944,6 @@ func TestCreateOidc(t *testing.T) { oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), ) - createAttr := func(sid string) *structpb.Struct { - attr := &pb.OidcAccountAttributes{Subject: sid} - ret, err := handlers.ProtoToStruct(attr) - require.NoError(t, err, "Error converting proto to struct.") - return ret - } - cases := []struct { name string req *pbs.CreateAccountRequest @@ -912,7 +958,11 @@ func TestCreateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: oidc.Subtype.String(), - Attributes: createAttr("valid-account"), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "valid-account", + }, + }, }, }, res: &pbs.CreateAccountResponse{ @@ -924,11 +974,12 @@ func TestCreateOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr("valid-account") - a.Fields["issuer"] = structpb.NewStringValue(am.GetIssuer()) - return a - }(), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "valid-account", + Issuer: am.GetIssuer(), + }, + }, AuthorizedActions: oidcAuthorizedActions, }, }, @@ -938,7 +989,11 @@ func TestCreateOidc(t *testing.T) { req: &pbs.CreateAccountRequest{ Item: &pb.Account{ AuthMethodId: am.GetPublicId(), - Attributes: createAttr("no type defined"), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "no type defined", + }, + }, }, }, res: &pbs.CreateAccountResponse{ @@ -948,11 +1003,12 @@ func TestCreateOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr("no type defined") - a.Fields["issuer"] = structpb.NewStringValue(am.GetIssuer()) - return a - }(), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "no type defined", + Issuer: am.GetIssuer(), + }, + }, AuthorizedActions: oidcAuthorizedActions, }, }, @@ -964,11 +1020,12 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), Name: &wrapperspb.StringValue{Value: "overwritten issuer"}, Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr("overwritten-issuer") - a.Fields["issuer"] = structpb.NewStringValue("https://overwrite.com") - return a - }(), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "overwritten-issuer", + Issuer: "https://overwrite.com", + }, + }, }, }, res: &pbs.CreateAccountResponse{ @@ -979,11 +1036,12 @@ func TestCreateOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr("overwritten-issuer") - a.Fields["issuer"] = structpb.NewStringValue("https://overwrite.com") - return a - }(), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "overwritten-issuer", + Issuer: "https://overwrite.com", + }, + }, AuthorizedActions: oidcAuthorizedActions, }, }, @@ -994,7 +1052,11 @@ func TestCreateOidc(t *testing.T) { Item: &pb.Account{ AuthMethodId: am.GetPublicId(), Type: password.Subtype.String(), - Attributes: createAttr("cant-specify-mismatching-type"), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "cant-specify-mismatching-type", + }, + }, }, }, res: nil, @@ -1007,7 +1069,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), Id: oidc.AccountPrefix + "_notallowed", Type: oidc.Subtype.String(), - Attributes: createAttr("cant-specify-id"), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "cant-specify-id", + }, + }, }, }, res: nil, @@ -1020,7 +1086,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), CreatedTime: timestamppb.Now(), Type: oidc.Subtype.String(), - Attributes: createAttr("cant-specify-created-time"), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "cant-specify-created-time", + }, + }, }, }, res: nil, @@ -1033,7 +1103,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), UpdatedTime: timestamppb.Now(), Type: oidc.Subtype.String(), - Attributes: createAttr("cant-specify-update-time"), + Attrs: &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Subject: "cant-specify-update-time", + }, + }, }, }, res: nil, @@ -1096,12 +1170,16 @@ func TestUpdatePassword(t *testing.T) { require.NoError(t, err, "Error when getting new accounts service.") defaultScopeInfo := &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()} - defaultAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "login_name": structpb.NewStringValue("default"), - }} - modifiedAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "login_name": structpb.NewStringValue("modified"), - }} + defaultAttributes := &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "default", + }, + } + modifiedAttributes := &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "modified", + }, + } freshAccount := func(t *testing.T) (*pb.Account, func()) { t.Helper() @@ -1112,7 +1190,7 @@ func TestUpdatePassword(t *testing.T) { Name: wrapperspb.String("default"), Description: wrapperspb.String("default"), Type: "password", - Attributes: defaultAttributes, + Attrs: defaultAttributes, }, }, ) @@ -1151,7 +1229,7 @@ func TestUpdatePassword(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: "password", - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, }, @@ -1175,7 +1253,7 @@ func TestUpdatePassword(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: "password", - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, }, @@ -1187,7 +1265,7 @@ func TestUpdatePassword(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1212,7 +1290,7 @@ func TestUpdatePassword(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1224,7 +1302,7 @@ func TestUpdatePassword(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1237,7 +1315,7 @@ func TestUpdatePassword(t *testing.T) { }, Item: &pb.Account{ Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1245,7 +1323,7 @@ func TestUpdatePassword(t *testing.T) { AuthMethodId: am.GetPublicId(), Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, }, @@ -1260,7 +1338,7 @@ func TestUpdatePassword(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1269,7 +1347,7 @@ func TestUpdatePassword(t *testing.T) { Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, }, @@ -1284,7 +1362,7 @@ func TestUpdatePassword(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "notignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1293,7 +1371,7 @@ func TestUpdatePassword(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "notignored"}, Type: "password", - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, }, @@ -1308,7 +1386,7 @@ func TestUpdatePassword(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1317,7 +1395,7 @@ func TestUpdatePassword(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, }, @@ -1427,6 +1505,8 @@ func TestUpdatePassword(t *testing.T) { if tc.err != nil { require.Error(gErr) assert.True(errors.Is(gErr, tc.err), "UpdateAccount(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + } else { + require.NoError(gErr) } if tc.res == nil { @@ -1486,14 +1566,18 @@ func TestUpdateOidc(t *testing.T) { require.NoError(t, err, "Error when getting new auth_method service.") defaultScopeInfo := &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()} - defaultAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://www.alice.com"), - "subject": structpb.NewStringValue("test-subject"), - }} - modifiedAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://www.changed.com"), - "subject": structpb.NewStringValue("changed"), - }} + defaultAttributes := &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Issuer: "https://www.alice.com", + Subject: "test-subject", + }, + } + modifiedAttributes := &pb.Account_OidcAccountAttributes{ + &pb.OidcAccountAttributes{ + Issuer: "https://www.changed.com", + Subject: "changed", + }, + } freshAccount := func(t *testing.T) (*oidc.Account, func()) { t.Helper() @@ -1532,7 +1616,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -1556,7 +1640,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -1568,7 +1652,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1593,7 +1677,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1605,7 +1689,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1618,7 +1702,7 @@ func TestUpdateOidc(t *testing.T) { }, Item: &pb.Account{ Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1626,7 +1710,7 @@ func TestUpdateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -1641,7 +1725,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1650,7 +1734,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -1665,7 +1749,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "notignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateAccountResponse{ @@ -1674,7 +1758,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "notignored"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -1689,7 +1773,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.Account{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1769,8 +1853,8 @@ func TestUpdateOidc(t *testing.T) { Paths: []string{"attributes.issuer"}, }, Item: &pb.Account{ - Name: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Name: &wrapperspb.StringValue{Value: "ignored"}, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1782,8 +1866,8 @@ func TestUpdateOidc(t *testing.T) { Paths: []string{"attributes.subject"}, }, Item: &pb.Account{ - Name: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Name: &wrapperspb.StringValue{Value: "ignored"}, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -1860,19 +1944,19 @@ func TestSetPassword(t *testing.T) { createAccount := func(t *testing.T, pw string) *pb.Account { am := password.TestAuthMethods(t, conn, o.GetPublicId(), 1)[0] - pwAttrs := &pb.PasswordAccountAttributes{ - LoginName: "testusername", + pwAttrs := &pb.Account_PasswordAccountAttributes{ + &pb.PasswordAccountAttributes{ + LoginName: "testusername", + }, } if pw != "" { - pwAttrs.Password = wrapperspb.String(pw) + pwAttrs.PasswordAccountAttributes.Password = wrapperspb.String(pw) } - attrs, err := handlers.ProtoToStruct(pwAttrs) - require.NoError(t, err) createResp, err := tested.CreateAccount(requestauth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), &pbs.CreateAccountRequest{ Item: &pb.Account{ AuthMethodId: am.GetPublicId(), Type: "password", - Attributes: attrs, + Attrs: pwAttrs, }, }) require.NoError(t, err) @@ -1999,19 +2083,17 @@ func TestChangePassword(t *testing.T) { createAccount := func(t *testing.T, pw string) *pb.Account { am := password.TestAuthMethods(t, conn, o.GetPublicId(), 1)[0] - pwAttrs := &pb.PasswordAccountAttributes{ + pwAttrs := &pb.Account_PasswordAccountAttributes{&pb.PasswordAccountAttributes{ LoginName: "testusername", - } + }} if pw != "" { - pwAttrs.Password = wrapperspb.String(pw) + pwAttrs.PasswordAccountAttributes.Password = wrapperspb.String(pw) } - attrs, err := handlers.ProtoToStruct(pwAttrs) - require.NoError(t, err) createResp, err := tested.CreateAccount(requestauth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), &pbs.CreateAccountRequest{ Item: &pb.Account{ AuthMethodId: am.GetPublicId(), Type: "password", - Attributes: attrs, + Attrs: pwAttrs, }, }) require.NoError(t, err) diff --git a/internal/servers/controller/handlers/accounts/validate_test.go b/internal/servers/controller/handlers/accounts/validate_test.go index aefcdfec7..cca7a580a 100644 --- a/internal/servers/controller/handlers/accounts/validate_test.go +++ b/internal/servers/controller/handlers/accounts/validate_test.go @@ -13,7 +13,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" - "google.golang.org/protobuf/types/known/structpb" ) func fieldError(field, details string) string { @@ -63,9 +62,9 @@ func TestValidateCreateRequest(t *testing.T) { item: &pb.Account{ Type: oidc.Subtype.String(), AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "full_name": structpb.NewStringValue("something"), - }}, + Attrs: &pb.Account_OidcAccountAttributes{ + OidcAccountAttributes: &pb.OidcAccountAttributes{FullName: "something"}, + }, }, errContains: fieldError(nameClaimField, "This is a read only field."), }, @@ -74,9 +73,9 @@ func TestValidateCreateRequest(t *testing.T) { item: &pb.Account{ Type: oidc.Subtype.String(), AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "email": structpb.NewStringValue("something"), - }}, + Attrs: &pb.Account_OidcAccountAttributes{ + OidcAccountAttributes: &pb.OidcAccountAttributes{Email: "something"}, + }, }, errContains: fieldError(emailClaimField, "This is a read only field."), }, @@ -88,36 +87,16 @@ func TestValidateCreateRequest(t *testing.T) { }, errContains: fieldError(loginNameKey, "This is a required field for this type."), }, - { - name: "bad pw attributes", - item: &pb.Account{ - Type: password.Subtype.String(), - AuthMethodId: password.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "test": structpb.NewStringValue("something"), - }}, - }, - errContains: fieldError(attributesField, "Attribute fields do not match the expected format."), - }, - { - name: "bad oidc attributes", - item: &pb.Account{ - Type: oidc.Subtype.String(), - AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "test": structpb.NewStringValue("something"), - }}, - }, - errContains: fieldError(attributesField, "Attribute fields do not match the expected format."), - }, { name: "no error", item: &pb.Account{ Type: password.Subtype.String(), AuthMethodId: password.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - loginNameKey: structpb.NewStringValue("something"), - }}, + Attrs: &pb.Account_PasswordAccountAttributes{ + PasswordAccountAttributes: &pb.PasswordAccountAttributes{ + LoginName: "something", + }, + }, }, }, { @@ -125,9 +104,9 @@ func TestValidateCreateRequest(t *testing.T) { item: &pb.Account{ Type: oidc.Subtype.String(), AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "subject": structpb.NewStringValue("no oidc errors"), - }}, + Attrs: &pb.Account_OidcAccountAttributes{ + OidcAccountAttributes: &pb.OidcAccountAttributes{Subject: "no oidc errors"}, + }, }, }, } @@ -183,42 +162,6 @@ func TestValidateUpdateRequest(t *testing.T) { }, errContains: fieldError(typeField, "Cannot modify the resource type."), }, - { - name: "password bad attributes old prefix", - req: &pbs.UpdateAccountRequest{ - Id: intglobals.OldPasswordAccountPrefix + "_1234567890", - Item: &pb.Account{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "test": structpb.NewStringValue("something"), - }}, - }, - }, - errContains: fieldError(attributesField, "Attribute fields do not match the expected format."), - }, - { - name: "password bad attributes new prefix", - req: &pbs.UpdateAccountRequest{ - Id: intglobals.NewPasswordAccountPrefix + "_1234567890", - Item: &pb.Account{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "test": structpb.NewStringValue("something"), - }}, - }, - }, - errContains: fieldError(attributesField, "Attribute fields do not match the expected format."), - }, - { - name: "oidc bad attributes", - req: &pbs.UpdateAccountRequest{ - Id: oidc.AccountPrefix + "_1234567890", - Item: &pb.Account{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "test": structpb.NewStringValue("something"), - }}, - }, - }, - errContains: fieldError(attributesField, "Attribute fields do not match the expected format."), - }, { name: "no error", req: &pbs.UpdateAccountRequest{ diff --git a/sdk/pbs/controller/api/resources/accounts/account.pb.go b/sdk/pbs/controller/api/resources/accounts/account.pb.go index 9313f43d0..436302a91 100644 --- a/sdk/pbs/controller/api/resources/accounts/account.pb.go +++ b/sdk/pbs/controller/api/resources/accounts/account.pb.go @@ -50,8 +50,11 @@ type Account struct { Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"` // The ID of the Auth Method that is associated with this Account. AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` - // The attributes that are applicable for the specific Account type. - Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *Account_Attributes + // *Account_PasswordAccountAttributes + // *Account_OidcAccountAttributes + Attrs isAccount_Attrs `protobuf_oneof:"attrs"` // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account ManagedGroupIds []string `protobuf:"bytes,110,rep,name=managed_group_ids,proto3" json:"managed_group_ids,omitempty"` // Output only. The available actions on this resource for this user. @@ -153,13 +156,34 @@ func (x *Account) GetAuthMethodId() string { return "" } +func (m *Account) GetAttrs() isAccount_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *Account) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*Account_Attributes); ok { return x.Attributes } return nil } +func (x *Account) GetPasswordAccountAttributes() *PasswordAccountAttributes { + if x, ok := x.GetAttrs().(*Account_PasswordAccountAttributes); ok { + return x.PasswordAccountAttributes + } + return nil +} + +func (x *Account) GetOidcAccountAttributes() *OidcAccountAttributes { + if x, ok := x.GetAttrs().(*Account_OidcAccountAttributes); ok { + return x.OidcAccountAttributes + } + return nil +} + func (x *Account) GetManagedGroupIds() []string { if x != nil { return x.ManagedGroupIds @@ -174,6 +198,29 @@ func (x *Account) GetAuthorizedActions() []string { return nil } +type isAccount_Attrs interface { + isAccount_Attrs() +} + +type Account_Attributes struct { + // The attributes that are applicable for the specific Account type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3,oneof"` +} + +type Account_PasswordAccountAttributes struct { + PasswordAccountAttributes *PasswordAccountAttributes `protobuf:"bytes,101,opt,name=password_account_attributes,json=passwordAccountAttributes,proto3,oneof"` +} + +type Account_OidcAccountAttributes struct { + OidcAccountAttributes *OidcAccountAttributes `protobuf:"bytes,102,opt,name=oidc_account_attributes,json=oidcAccountAttributes,proto3,oneof"` +} + +func (*Account_Attributes) isAccount_Attrs() {} + +func (*Account_PasswordAccountAttributes) isAccount_Attrs() {} + +func (*Account_OidcAccountAttributes) isAccount_Attrs() {} + // Attributes associated only with Accounts with type "password". type PasswordAccountAttributes struct { state protoimpl.MessageState @@ -348,7 +395,7 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x04, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x07, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, @@ -378,50 +425,69 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, - 0x29, 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6c, - 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, - 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, 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, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x22, 0x88, 0x02, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, 0x69, 0x73, - 0x73, 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, - 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, - 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x75, 0x6c, - 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, - 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3a, 0x0a, 0x0c, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x78, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, - 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x82, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0e, 0x75, 0x73, 0x65, - 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x52, 0x5a, 0x50, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, - 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, - 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x93, 0x01, 0x0a, 0x1b, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0xa0, 0xda, 0x29, + 0x01, 0x9a, 0xe3, 0x29, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, + 0x19, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x83, 0x01, 0x0a, 0x17, 0x6f, + 0x69, 0x64, 0x63, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x0c, 0xa0, 0xda, 0x29, 0x01, 0x9a, + 0xe3, 0x29, 0x04, 0x6f, 0x69, 0x64, 0x63, 0x48, 0x00, 0x52, 0x15, 0x6f, 0x69, 0x64, 0x63, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x2c, 0x0a, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, + 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, + 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, + 0xc2, 0xdd, 0x29, 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x2e, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, + 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, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x22, 0x88, 0x02, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, + 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, + 0x29, 0x01, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, + 0x01, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, + 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, + 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3a, + 0x0a, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x78, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x75, 0x73, + 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x82, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0e, 0x75, + 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x52, 0x5a, + 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, + 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, + 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -447,20 +513,22 @@ var file_controller_api_resources_accounts_v1_account_proto_goTypes = []interfac (*structpb.Struct)(nil), // 6: google.protobuf.Struct } var file_controller_api_resources_accounts_v1_account_proto_depIdxs = []int32{ - 3, // 0: controller.api.resources.accounts.v1.Account.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo - 4, // 1: controller.api.resources.accounts.v1.Account.name:type_name -> google.protobuf.StringValue - 4, // 2: controller.api.resources.accounts.v1.Account.description:type_name -> google.protobuf.StringValue - 5, // 3: controller.api.resources.accounts.v1.Account.created_time:type_name -> google.protobuf.Timestamp - 5, // 4: controller.api.resources.accounts.v1.Account.updated_time:type_name -> google.protobuf.Timestamp - 6, // 5: controller.api.resources.accounts.v1.Account.attributes:type_name -> google.protobuf.Struct - 4, // 6: controller.api.resources.accounts.v1.PasswordAccountAttributes.password:type_name -> google.protobuf.StringValue - 6, // 7: controller.api.resources.accounts.v1.OidcAccountAttributes.token_claims:type_name -> google.protobuf.Struct - 6, // 8: controller.api.resources.accounts.v1.OidcAccountAttributes.userinfo_claims:type_name -> google.protobuf.Struct - 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 + 3, // 0: controller.api.resources.accounts.v1.Account.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo + 4, // 1: controller.api.resources.accounts.v1.Account.name:type_name -> google.protobuf.StringValue + 4, // 2: controller.api.resources.accounts.v1.Account.description:type_name -> google.protobuf.StringValue + 5, // 3: controller.api.resources.accounts.v1.Account.created_time:type_name -> google.protobuf.Timestamp + 5, // 4: controller.api.resources.accounts.v1.Account.updated_time:type_name -> google.protobuf.Timestamp + 6, // 5: controller.api.resources.accounts.v1.Account.attributes:type_name -> google.protobuf.Struct + 1, // 6: controller.api.resources.accounts.v1.Account.password_account_attributes:type_name -> controller.api.resources.accounts.v1.PasswordAccountAttributes + 2, // 7: controller.api.resources.accounts.v1.Account.oidc_account_attributes:type_name -> controller.api.resources.accounts.v1.OidcAccountAttributes + 4, // 8: controller.api.resources.accounts.v1.PasswordAccountAttributes.password:type_name -> google.protobuf.StringValue + 6, // 9: controller.api.resources.accounts.v1.OidcAccountAttributes.token_claims:type_name -> google.protobuf.Struct + 6, // 10: controller.api.resources.accounts.v1.OidcAccountAttributes.userinfo_claims:type_name -> google.protobuf.Struct + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_controller_api_resources_accounts_v1_account_proto_init() } @@ -506,6 +574,11 @@ func file_controller_api_resources_accounts_v1_account_proto_init() { } } } + file_controller_api_resources_accounts_v1_account_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Account_Attributes)(nil), + (*Account_PasswordAccountAttributes)(nil), + (*Account_OidcAccountAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ From ac5a1acca8446015035cc8048bbae3eac9e20f85 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Mon, 28 Mar 2022 15:54:52 -0400 Subject: [PATCH 04/45] feat(account): Hide internal attribute fields These fields are not intended for use by API consumers, so we hide them from the generated API documentation by marking them as INTERNAL. --- internal/gen/controller.swagger.json | 54 ----- .../api/resources/accounts/v1/account.proto | 13 +- .../api/resources/accounts/account.pb.go | 203 +++++++++--------- 3 files changed, 115 insertions(+), 155 deletions(-) diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index a3b218709..54c1efe60 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -3702,12 +3702,6 @@ "type": "object", "description": "The attributes that are applicable for the specific Account type." }, - "password_account_attributes": { - "$ref": "#/definitions/controller.api.resources.accounts.v1.PasswordAccountAttributes" - }, - "oidc_account_attributes": { - "$ref": "#/definitions/controller.api.resources.accounts.v1.OidcAccountAttributes" - }, "managed_group_ids": { "type": "array", "items": { @@ -3727,54 +3721,6 @@ }, "title": "Account contains all fields related to an Account resource" }, - "controller.api.resources.accounts.v1.OidcAccountAttributes": { - "type": "object", - "properties": { - "issuer": { - "type": "string", - "description": "issuer is a case sensitive URL that maps to the OIDC iss claim.\nThis value is immutable after creation time." - }, - "subject": { - "type": "string", - "description": "subject is a case sensitive string that maps to the OIDC sub claim.\nThis value is immutable after creation time." - }, - "full_name": { - "type": "string", - "description": "Output only. full_name is a string that maps to the OIDC name claim.", - "readOnly": true - }, - "email": { - "type": "string", - "description": "Output only. email is a string that maps to the OIDC email claim.", - "readOnly": true - }, - "token_claims": { - "type": "object", - "description": "Output only. token_claims are the marshaled claims from the token.", - "readOnly": true - }, - "userinfo_claims": { - "type": "object", - "description": "Output only. userinfo_claims are the marshaled claims from userinfo.", - "readOnly": true - } - }, - "description": "Attributes associated only with Accounts with type \"oidc\"." - }, - "controller.api.resources.accounts.v1.PasswordAccountAttributes": { - "type": "object", - "properties": { - "login_name": { - "type": "string", - "description": "The login name of this Account. This is unique per Auth Method." - }, - "password": { - "type": "string", - "description": "The password for this Account." - } - }, - "description": "Attributes associated only with Accounts with type \"password\"." - }, "controller.api.resources.authmethods.v1.AuthMethod": { "type": "object", "properties": { diff --git a/internal/proto/controller/api/resources/accounts/v1/account.proto b/internal/proto/controller/api/resources/accounts/v1/account.proto index 12a74f7a0..96848446f 100644 --- a/internal/proto/controller/api/resources/accounts/v1/account.proto +++ b/internal/proto/controller/api/resources/accounts/v1/account.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; @@ -43,8 +44,16 @@ message Account { oneof attrs { // The attributes that are applicable for the specific Account type. google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "default"]; - PasswordAccountAttributes password_account_attributes = 101 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "password"]; - OidcAccountAttributes oidc_account_attributes = 102 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "oidc"]; + PasswordAccountAttributes password_account_attributes = 101 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "password" + ]; + OidcAccountAttributes oidc_account_attributes = 102 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "oidc" + ]; } // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account diff --git a/sdk/pbs/controller/api/resources/accounts/account.pb.go b/sdk/pbs/controller/api/resources/accounts/account.pb.go index 436302a91..1befafe0a 100644 --- a/sdk/pbs/controller/api/resources/accounts/account.pb.go +++ b/sdk/pbs/controller/api/resources/accounts/account.pb.go @@ -9,6 +9,7 @@ package accounts import ( 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" @@ -389,105 +390,109 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 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, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x07, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1e, - 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, 0x4e, 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, 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, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x44, 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, 0x32, 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, 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, - 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x46, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, - 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0x93, 0x01, 0x0a, 0x1b, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0xa0, 0xda, 0x29, - 0x01, 0x9a, 0xe3, 0x29, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x00, 0x52, - 0x19, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x83, 0x01, 0x0a, 0x17, 0x6f, - 0x69, 0x64, 0x63, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x0c, 0xa0, 0xda, 0x29, 0x01, 0x9a, - 0xe3, 0x29, 0x04, 0x6f, 0x69, 0x64, 0x63, 0x48, 0x00, 0x52, 0x15, 0x6f, 0x69, 0x64, 0x63, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x12, 0x2c, 0x0a, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, - 0x70, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, - 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, - 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, - 0xc2, 0xdd, 0x29, 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x2e, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, - 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, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x22, 0x88, 0x02, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, - 0x29, 0x01, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, - 0x01, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, - 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, - 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, - 0x6c, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3a, - 0x0a, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x78, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x75, 0x73, - 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x82, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0e, 0x75, - 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x52, 0x5a, - 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, - 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, - 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 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, 0xd0, 0x07, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1e, 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, 0x4e, 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, 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, 0x22, + 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x44, 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, + 0x32, 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, + 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, + 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, + 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x42, 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, 0xa3, 0x01, 0x0a, 0x1b, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x20, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, + 0x29, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, + 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x19, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x93, 0x01, 0x0a, 0x17, 0x6f, 0x69, 0x64, 0x63, + 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1c, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x04, + 0x6f, 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, + 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x15, 0x6f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, + 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, + 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, + 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6c, 0x6f, + 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, 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, + 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, + 0x88, 0x02, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, 0x69, 0x73, 0x73, + 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, + 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x75, 0x6c, 0x6c, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x6e, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3a, 0x0a, 0x0c, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x69, + 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, + 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, + 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 6e6efeee7165513faa6fbc0f0fb7183cb26a0be0 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Tue, 29 Mar 2022 17:42:23 -0400 Subject: [PATCH 05/45] feat(account): Add gotags classification Add gotag classification to all account proto and service definitions. --- Makefile | 2 ++ .../api/services/account_service.pb.go | 26 +++++++-------- .../api/resources/accounts/v1/account.proto | 32 +++++++++---------- .../api/services/v1/account_service.proto | 26 +++++++-------- .../api/resources/accounts/account.pb.go | 32 +++++++++---------- 5 files changed, 60 insertions(+), 58 deletions(-) diff --git a/Makefile b/Makefile index 609a3cc81..1ff1294d5 100644 --- a/Makefile +++ b/Makefile @@ -156,6 +156,8 @@ protobuild: @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/scopes/scope.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/servers/services/session_service.pb.go @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 # 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/account_service.pb.go b/internal/gen/controller/api/services/account_service.pb.go index 585c34440..87ec7ec05 100644 --- a/internal/gen/controller/api/services/account_service.pb.go +++ b/internal/gen/controller/api/services/account_service.pb.go @@ -29,7 +29,7 @@ type GetAccountRequest 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 *GetAccountRequest) Reset() { @@ -123,8 +123,8 @@ type ListAccountsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AuthMethodId string `protobuf:"bytes,1,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + AuthMethodId string `protobuf:"bytes,1,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty" class:"public"` // @gotags: `class:"public"` + Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` } func (x *ListAccountsRequest) Reset() { @@ -272,7 +272,7 @@ type CreateAccountResponse 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 *accounts.Account `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -327,7 +327,7 @@ type UpdateAccountRequest 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 *accounts.Account `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 +437,7 @@ type DeleteAccountRequest 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 *DeleteAccountRequest) Reset() { @@ -522,11 +522,11 @@ type SetPasswordRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *SetPasswordRequest) Reset() { @@ -634,12 +634,12 @@ type ChangePasswordRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - CurrentPassword string `protobuf:"bytes,3,opt,name=current_password,proto3" json:"current_password,omitempty"` - NewPassword string `protobuf:"bytes,4,opt,name=new_password,proto3" json:"new_password,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + CurrentPassword string `protobuf:"bytes,3,opt,name=current_password,proto3" json:"current_password,omitempty" class:"secret"` // @gotags: `class:"secret"` + NewPassword string `protobuf:"bytes,4,opt,name=new_password,proto3" json:"new_password,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *ChangePasswordRequest) Reset() { diff --git a/internal/proto/controller/api/resources/accounts/v1/account.proto b/internal/proto/controller/api/resources/accounts/v1/account.proto index 96848446f..19110244e 100644 --- a/internal/proto/controller/api/resources/accounts/v1/account.proto +++ b/internal/proto/controller/api/resources/accounts/v1/account.proto @@ -14,32 +14,32 @@ import "controller/custom_options/v1/options.proto"; // Account contains all fields related to an Account resource message Account { // Output only. The ID of the Account. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. Scope information for the Account. resources.scopes.v1.ScopeInfo scope = 20; // Optional name for identification purposes. - google.protobuf.StringValue name = 30 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "Name"}]; + google.protobuf.StringValue name = 30 [(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 = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "Description"}]; + google.protobuf.StringValue description = 40 [(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 = 50 [json_name="created_time"]; + google.protobuf.Timestamp created_time = 50 [json_name="created_time"]; // @gotags: `class:"public"` // Output only. The time this resource was last updated. - google.protobuf.Timestamp updated_time = 60 [json_name="updated_time"]; + google.protobuf.Timestamp updated_time = 60 [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 = 70; + uint32 version = 70; // @gotags: `class:"public"` // The type of this Account. - string type = 80; + string type = 80; // @gotags: `class:"public"` // The ID of the Auth Method that is associated with this Account. - string auth_method_id = 90 [json_name="auth_method_id"]; + string auth_method_id = 90 [json_name="auth_method_id"]; // @gotags: `class:"public"` oneof attrs { // The attributes that are applicable for the specific Account type. @@ -57,36 +57,36 @@ message Account { } // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account - repeated string managed_group_ids = 110 [json_name="managed_group_ids"]; + repeated string managed_group_ids = 110 [json_name="managed_group_ids"]; // @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"` } // Attributes associated only with Accounts with type "password". message PasswordAccountAttributes { // The login name of this Account. This is unique per Auth Method. - string login_name = 10 [json_name="login_name", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.login_name" that: "LoginName"}]; + string login_name = 10 [json_name="login_name", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.login_name" that: "LoginName"}]; // @gotags: `class:"sensitive"` // The password for this Account. - google.protobuf.StringValue password = 20 [(custom_options.v1.generate_sdk_option) = true]; + google.protobuf.StringValue password = 20 [(custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"secret"` } // Attributes associated only with Accounts with type "oidc". message OidcAccountAttributes { // issuer is a case sensitive URL that maps to the OIDC iss claim. // This value is immutable after creation time. - string issuer = 80 [json_name="issuer", (custom_options.v1.generate_sdk_option) = true]; + string issuer = 80 [json_name="issuer", (custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"` // subject is a case sensitive string that maps to the OIDC sub claim. // This value is immutable after creation time. - string subject = 90 [json_name="subject", (custom_options.v1.generate_sdk_option) = true]; + string subject = 90 [json_name="subject", (custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"` // Output only. full_name is a string that maps to the OIDC name claim. - string full_name = 100 [json_name="full_name"]; + string full_name = 100 [json_name="full_name"]; // @gotags: `class:"public"` // Output only. email is a string that maps to the OIDC email claim. - string email = 110; + string email = 110; // @gotags: `class:"public"` // Output only. token_claims are the marshaled claims from the token. google.protobuf.Struct token_claims = 120; diff --git a/internal/proto/controller/api/services/v1/account_service.proto b/internal/proto/controller/api/services/v1/account_service.proto index 0f73aebb5..56adfb1ab 100644 --- a/internal/proto/controller/api/services/v1/account_service.proto +++ b/internal/proto/controller/api/services/v1/account_service.proto @@ -114,7 +114,7 @@ service AccountService { } message GetAccountRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetAccountResponse { @@ -122,8 +122,8 @@ message GetAccountResponse { } message ListAccountsRequest { - string auth_method_id = 1 [json_name="auth_method_id"]; - string filter = 30 [json_name="filter"]; + string auth_method_id = 1 [json_name="auth_method_id"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"sensitive"` } message ListAccountsResponse { @@ -135,12 +135,12 @@ message CreateAccountRequest { } message CreateAccountResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.accounts.v1.Account item = 2; } message UpdateAccountRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.accounts.v1.Account item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -150,17 +150,17 @@ message UpdateAccountResponse { } message DeleteAccountRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteAccountResponse {} message SetPasswordRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - string password = 3; + uint32 version = 2; // @gotags: `class:"public"` + string password = 3; // @gotags: `class:"secret"` } message SetPasswordResponse { @@ -168,12 +168,12 @@ message SetPasswordResponse { } message ChangePasswordRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - string current_password = 3 [json_name="current_password"]; - string new_password = 4 [json_name="new_password"]; + uint32 version = 2; // @gotags: `class:"public"` + string current_password = 3 [json_name="current_password"]; // @gotags: `class:"secret"` + string new_password = 4 [json_name="new_password"]; // @gotags: `class:"secret"` } message ChangePasswordResponse { diff --git a/sdk/pbs/controller/api/resources/accounts/account.pb.go b/sdk/pbs/controller/api/resources/accounts/account.pb.go index 1befafe0a..eb675fa68 100644 --- a/sdk/pbs/controller/api/resources/accounts/account.pb.go +++ b/sdk/pbs/controller/api/resources/accounts/account.pb.go @@ -33,33 +33,33 @@ type Account struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Account. - 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"` // Output only. Scope information for the Account. Scope *scopes.ScopeInfo `protobuf:"bytes,20,opt,name=scope,proto3" json:"scope,omitempty"` // Optional name for identification purposes. - Name *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty"` + Name *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // Optional user-set description for identification purposes. - Description *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=description,proto3" json:"description,omitempty"` + Description *wrapperspb.StringValue `protobuf:"bytes,40,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,50,opt,name=created_time,proto3" json:"created_time,omitempty"` + CreatedTime *timestamppb.Timestamp `protobuf:"bytes,50,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,60,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,60,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,70,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // The type of this Account. - Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // The ID of the Auth Method that is associated with this Account. - AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` + AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: // *Account_Attributes // *Account_PasswordAccountAttributes // *Account_OidcAccountAttributes Attrs isAccount_Attrs `protobuf_oneof:"attrs"` // Output only. managed_group_ids indicates IDs of the managed groups that currently contain this account - ManagedGroupIds []string `protobuf:"bytes,110,rep,name=managed_group_ids,proto3" json:"managed_group_ids,omitempty"` + ManagedGroupIds []string `protobuf:"bytes,110,rep,name=managed_group_ids,proto3" json:"managed_group_ids,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 *Account) Reset() { @@ -229,9 +229,9 @@ type PasswordAccountAttributes struct { unknownFields protoimpl.UnknownFields // The login name of this Account. This is unique per Auth Method. - LoginName string `protobuf:"bytes,10,opt,name=login_name,proto3" json:"login_name,omitempty"` + LoginName string `protobuf:"bytes,10,opt,name=login_name,proto3" json:"login_name,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` // The password for this Account. - Password *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=password,proto3" json:"password,omitempty"` + Password *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=password,proto3" json:"password,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *PasswordAccountAttributes) Reset() { @@ -288,14 +288,14 @@ type OidcAccountAttributes struct { // issuer is a case sensitive URL that maps to the OIDC iss claim. // This value is immutable after creation time. - Issuer string `protobuf:"bytes,80,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,80,opt,name=issuer,proto3" json:"issuer,omitempty" class:"public"` // @gotags: `class:"public"` // subject is a case sensitive string that maps to the OIDC sub claim. // This value is immutable after creation time. - Subject string `protobuf:"bytes,90,opt,name=subject,proto3" json:"subject,omitempty"` + Subject string `protobuf:"bytes,90,opt,name=subject,proto3" json:"subject,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. full_name is a string that maps to the OIDC name claim. - FullName string `protobuf:"bytes,100,opt,name=full_name,proto3" json:"full_name,omitempty"` + FullName string `protobuf:"bytes,100,opt,name=full_name,proto3" json:"full_name,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. email is a string that maps to the OIDC email claim. - Email string `protobuf:"bytes,110,opt,name=email,proto3" json:"email,omitempty"` + Email string `protobuf:"bytes,110,opt,name=email,proto3" json:"email,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. token_claims are the marshaled claims from the token. TokenClaims *structpb.Struct `protobuf:"bytes,120,opt,name=token_claims,json=tokenClaims,proto3" json:"token_claims,omitempty"` // Output only. userinfo_claims are the marshaled claims from userinfo. From 760b0905674fb2cfa4ac089bf8d6db5869fb6b6c Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 31 Mar 2022 08:56:53 -0400 Subject: [PATCH 06/45] feat(proto): Add new option for proto files to set domain This allows for associating all of the messages in a file with a domain. This will be used by the global subtype registry to group subtypes within a domain. When registering a subtype, it must be unique within a domain. This allows for cases where two domains have the same subtypes, such as two domains both having a "plugin" subtype. --- .../custom_options/v1/options.proto | 7 ++- sdk/pbs/controller/protooptions/options.pb.go | 47 ++++++++++++++----- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/internal/proto/controller/custom_options/v1/options.proto b/internal/proto/controller/custom_options/v1/options.proto index 0aad5f61d..90d3fa040 100644 --- a/internal/proto/controller/custom_options/v1/options.proto +++ b/internal/proto/controller/custom_options/v1/options.proto @@ -22,7 +22,12 @@ extend google.protobuf.FieldOptions { string subtype = 85555; } +extend google.protobuf.FileOptions { + // domain is used to associate the messages in a file with a domain package. + string domain = 85556; +} + message MaskMapping { string this = 1; string that = 2; -} \ No newline at end of file +} diff --git a/sdk/pbs/controller/protooptions/options.pb.go b/sdk/pbs/controller/protooptions/options.pb.go index dba44c336..f0e563f9d 100644 --- a/sdk/pbs/controller/protooptions/options.pb.go +++ b/sdk/pbs/controller/protooptions/options.pb.go @@ -101,6 +101,14 @@ var file_controller_custom_options_v1_options_proto_extTypes = []protoimpl.Exten Tag: "bytes,85555,opt,name=subtype", Filename: "controller/custom_options/v1/options.proto", }, + { + ExtendedType: (*descriptorpb.FileOptions)(nil), + ExtensionType: (*string)(nil), + Field: 85556, + Name: "controller.custom_options.v1.domain", + Tag: "bytes,85556,opt,name=domain", + Filename: "controller/custom_options/v1/options.proto", + }, } // Extension fields to descriptorpb.FieldOptions. @@ -125,6 +133,14 @@ var ( E_Subtype = &file_controller_custom_options_v1_options_proto_extTypes[2] ) +// Extension fields to descriptorpb.FileOptions. +var ( + // domain is used to associate the messages in a file with a domain package. + // + // optional string domain = 85556; + E_Domain = &file_controller_custom_options_v1_options_proto_extTypes[3] +) + var File_controller_custom_options_v1_options_proto protoreflect.FileDescriptor var file_controller_custom_options_v1_options_proto_rawDesc = []byte{ @@ -153,13 +169,16 @@ var file_controller_custom_options_v1_options_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x3a, 0x39, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb3, 0x9c, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x36, + 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -178,16 +197,18 @@ var file_controller_custom_options_v1_options_proto_msgTypes = make([]protoimpl. var file_controller_custom_options_v1_options_proto_goTypes = []interface{}{ (*MaskMapping)(nil), // 0: controller.custom_options.v1.MaskMapping (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions + (*descriptorpb.FileOptions)(nil), // 2: google.protobuf.FileOptions } var file_controller_custom_options_v1_options_proto_depIdxs = []int32{ 1, // 0: controller.custom_options.v1.mask_mapping:extendee -> google.protobuf.FieldOptions 1, // 1: controller.custom_options.v1.generate_sdk_option:extendee -> google.protobuf.FieldOptions 1, // 2: controller.custom_options.v1.subtype:extendee -> google.protobuf.FieldOptions - 0, // 3: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 3, // [3:4] is the sub-list for extension type_name - 0, // [0:3] is the sub-list for extension extendee + 2, // 3: controller.custom_options.v1.domain:extendee -> google.protobuf.FileOptions + 0, // 4: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 4, // [4:5] is the sub-list for extension type_name + 0, // [0:4] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -217,7 +238,7 @@ func file_controller_custom_options_v1_options_proto_init() { RawDescriptor: file_controller_custom_options_v1_options_proto_rawDesc, NumEnums: 0, NumMessages: 1, - NumExtensions: 3, + NumExtensions: 4, NumServices: 0, }, GoTypes: file_controller_custom_options_v1_options_proto_goTypes, From 8cbbfbe3a0caf7b689b681be920d866f52c8dd51 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 1 Apr 2022 08:36:09 -0400 Subject: [PATCH 07/45] feat(proto): Add new field option to indicate a in id for subtypes This allows for marking a field in a message as an id that can be used to determine the message's subtype. When creating some resources, an id from a related resource is used to indicate the resource's subtype, since the resource must have the same subtype as the related resource. --- .../custom_options/v1/options.proto | 4 ++ sdk/pbs/controller/protooptions/options.pb.go | 55 +++++++++++++------ 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/internal/proto/controller/custom_options/v1/options.proto b/internal/proto/controller/custom_options/v1/options.proto index 90d3fa040..ca488ecc1 100644 --- a/internal/proto/controller/custom_options/v1/options.proto +++ b/internal/proto/controller/custom_options/v1/options.proto @@ -20,6 +20,10 @@ extend google.protobuf.FieldOptions { // of oneOf once and not for each option when generating the API // This will serve as a JSON key, used to transform that into the key the protobuf expects string subtype = 85555; + + // subtype_source_id is used to indicate that a field provided an id that can be used + // to determine the subtype of a message. + bool subtype_source_id = 85556; } extend google.protobuf.FileOptions { diff --git a/sdk/pbs/controller/protooptions/options.pb.go b/sdk/pbs/controller/protooptions/options.pb.go index f0e563f9d..bbccf1840 100644 --- a/sdk/pbs/controller/protooptions/options.pb.go +++ b/sdk/pbs/controller/protooptions/options.pb.go @@ -101,6 +101,14 @@ var file_controller_custom_options_v1_options_proto_extTypes = []protoimpl.Exten Tag: "bytes,85555,opt,name=subtype", Filename: "controller/custom_options/v1/options.proto", }, + { + ExtendedType: (*descriptorpb.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 85556, + Name: "controller.custom_options.v1.subtype_source_id", + Tag: "varint,85556,opt,name=subtype_source_id", + Filename: "controller/custom_options/v1/options.proto", + }, { ExtendedType: (*descriptorpb.FileOptions)(nil), ExtensionType: (*string)(nil), @@ -131,6 +139,11 @@ var ( // // optional string subtype = 85555; E_Subtype = &file_controller_custom_options_v1_options_proto_extTypes[2] + // subtype_source_id is used to indicate that a field provided an id that can be used + // to determine the subtype of a message. + // + // optional bool subtype_source_id = 85556; + E_SubtypeSourceId = &file_controller_custom_options_v1_options_proto_extTypes[3] ) // Extension fields to descriptorpb.FileOptions. @@ -138,7 +151,7 @@ var ( // domain is used to associate the messages in a file with a domain package. // // optional string domain = 85556; - E_Domain = &file_controller_custom_options_v1_options_proto_extTypes[3] + E_Domain = &file_controller_custom_options_v1_options_proto_extTypes[4] ) var File_controller_custom_options_v1_options_proto protoreflect.FileDescriptor @@ -169,16 +182,21 @@ var file_controller_custom_options_v1_options_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x3a, 0x39, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb3, 0x9c, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x36, - 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x4b, + 0x0a, 0x11, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x74, + 0x79, 0x70, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x3a, 0x36, 0x0a, 0x06, 0x64, + 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0xb4, 0x9c, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, + 0x61, 0x69, 0x6e, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -203,12 +221,13 @@ var file_controller_custom_options_v1_options_proto_depIdxs = []int32{ 1, // 0: controller.custom_options.v1.mask_mapping:extendee -> google.protobuf.FieldOptions 1, // 1: controller.custom_options.v1.generate_sdk_option:extendee -> google.protobuf.FieldOptions 1, // 2: controller.custom_options.v1.subtype:extendee -> google.protobuf.FieldOptions - 2, // 3: controller.custom_options.v1.domain:extendee -> google.protobuf.FileOptions - 0, // 4: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 4, // [4:5] is the sub-list for extension type_name - 0, // [0:4] is the sub-list for extension extendee + 1, // 3: controller.custom_options.v1.subtype_source_id:extendee -> google.protobuf.FieldOptions + 2, // 4: controller.custom_options.v1.domain:extendee -> google.protobuf.FileOptions + 0, // 5: controller.custom_options.v1.mask_mapping:type_name -> controller.custom_options.v1.MaskMapping + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 5, // [5:6] is the sub-list for extension type_name + 0, // [0:5] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -238,7 +257,7 @@ func file_controller_custom_options_v1_options_proto_init() { RawDescriptor: file_controller_custom_options_v1_options_proto_rawDesc, NumEnums: 0, NumMessages: 1, - NumExtensions: 4, + NumExtensions: 5, NumServices: 0, }, GoTypes: file_controller_custom_options_v1_options_proto_goTypes, From 31ef40ec5aed8756c74312cc1351b9f79cf686fb Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 18 Mar 2022 15:11:45 -0400 Subject: [PATCH 08/45] feat(subtype): Add global registry --- internal/types/subtypes/registry_global.go | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 internal/types/subtypes/registry_global.go diff --git a/internal/types/subtypes/registry_global.go b/internal/types/subtypes/registry_global.go new file mode 100644 index 000000000..85bdfc9a7 --- /dev/null +++ b/internal/types/subtypes/registry_global.go @@ -0,0 +1,132 @@ +package subtypes + +import ( + "context" + "fmt" + "strings" + "sync" + + "github.com/hashicorp/boundary/internal/errors" +) + +var globalRegistry = newRegistry() + +// newGlobalRegistry creates a new boundary resource subtype registry. +func newRegistry() *registry { + return ®istry{ + subtypesPrefixes: make(map[string]map[string]Subtype), + knownSubtypes: make(map[string]map[Subtype]interface{}), + } +} + +// registry stores a collection of boundary resource subtypes along with their +// prefixes and allows for translating prefixes back to registered subtypes. +type registry struct { + subtypesPrefixes map[string]map[string]Subtype + knownSubtypes map[string]map[Subtype]interface{} + + sync.RWMutex +} + +// SubtypeFromType returns the Subtype from the provided string or if +// no Subtype was registered with that string Unknown is returned. +func (r *registry) subtypeFromType(domain, t string) Subtype { + r.RLock() + defer r.RUnlock() + + knownSubtypes, ok := r.knownSubtypes[domain] + if !ok { + return UnknownSubtype + } + + st := Subtype(t) + if _, ok := knownSubtypes[st]; !ok { + return UnknownSubtype + } + return st +} + +// SubtypeFromId returns the Subtype from the provided id if the id's prefix +// was registered with a Subtype. Otherwise Unknown is returned. +func (r *registry) subtypeFromId(domain, id string) Subtype { + r.RLock() + defer r.RUnlock() + + i := strings.Index(id, "_") + if i == -1 { + return UnknownSubtype + } + prefix := id[:i] + + subtypePrefixes, ok := r.subtypesPrefixes[domain] + if !ok { + return UnknownSubtype + } + + subtype, ok := subtypePrefixes[prefix] + if !ok { + return UnknownSubtype + } + return subtype +} + +// 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 (r *registry) register(ctx context.Context, domain string, subtype Subtype, prefixes ...string) error { + r.Lock() + defer r.Unlock() + + const op = "subtypes.(registry).register" + + knownSubtypes, present := r.knownSubtypes[domain] + if !present { + knownSubtypes = make(map[Subtype]interface{}) + r.knownSubtypes[domain] = knownSubtypes + r.subtypesPrefixes[domain] = make(map[string]Subtype) + } + + if _, present := knownSubtypes[subtype]; present { + return errors.New( + ctx, + errors.SubtypeAlreadyRegistered, + op, + fmt.Sprintf("subtype %q already registered in domain %s", subtype, domain), + ) + } + knownSubtypes[subtype] = nil + + for _, prefix := range prefixes { + prefix = strings.TrimSpace(prefix) + if st, ok := r.subtypesPrefixes[domain][prefix]; ok { + return errors.New( + ctx, + errors.SubtypeAlreadyRegistered, + op, + fmt.Sprintf("prefix %q is already registered to subtype %q in domain %s", prefix, st, domain), + ) + } + r.subtypesPrefixes[domain][prefix] = subtype + } + return nil +} + +// SubtypeFromType returns the Subtype from the provided string or if +// no Subtype was registered with that string Unknown is returned. +func SubtypeFromType(domain, t string) Subtype { + return globalRegistry.subtypeFromType(domain, 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(domain, id string) Subtype { + return globalRegistry.subtypeFromId(domain, 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(domain string, subtype Subtype, prefixes ...string) error { + ctx := context.TODO() + return globalRegistry.register(ctx, domain, subtype, prefixes...) +} From 185d8b392d65f35062b150123c0df30983758003 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 18 Mar 2022 15:13:53 -0400 Subject: [PATCH 09/45] refact(auth): Move subtype registration into global registry --- internal/auth/oidc/ids.go | 3 +- internal/auth/password/public_ids.go | 3 +- internal/auth/subtype.go | 22 ----------- .../handlers/accounts/account_service.go | 32 ++++++++-------- .../handlers/accounts/account_service_test.go | 6 ++- .../authmethods/authmethod_service.go | 38 +++++++++---------- .../managed_groups/managed_group_service.go | 26 ++++++------- 7 files changed, 55 insertions(+), 75 deletions(-) diff --git a/internal/auth/oidc/ids.go b/internal/auth/oidc/ids.go index 8edf0e9c0..2e0cf18e1 100644 --- a/internal/auth/oidc/ids.go +++ b/internal/auth/oidc/ids.go @@ -3,7 +3,6 @@ package oidc import ( "context" - "github.com/hashicorp/boundary/internal/auth" "github.com/hashicorp/boundary/internal/db" "github.com/hashicorp/boundary/internal/errors" "github.com/hashicorp/boundary/internal/intglobals" @@ -11,7 +10,7 @@ import ( ) func init() { - if err := auth.Register(Subtype, AuthMethodPrefix, AccountPrefix, intglobals.OidcManagedGroupPrefix); err != nil { + if err := subtypes.Register("auth", Subtype, AuthMethodPrefix, AccountPrefix, intglobals.OidcManagedGroupPrefix); err != nil { panic(err) } } diff --git a/internal/auth/password/public_ids.go b/internal/auth/password/public_ids.go index 5a70dc890..70e176df0 100644 --- a/internal/auth/password/public_ids.go +++ b/internal/auth/password/public_ids.go @@ -1,7 +1,6 @@ package password import ( - "github.com/hashicorp/boundary/internal/auth" "github.com/hashicorp/boundary/internal/db" "github.com/hashicorp/boundary/internal/errors" "github.com/hashicorp/boundary/internal/intglobals" @@ -9,7 +8,7 @@ import ( ) func init() { - if err := auth.Register(Subtype, AuthMethodPrefix, intglobals.OldPasswordAccountPrefix, intglobals.NewPasswordAccountPrefix); err != nil { + if err := subtypes.Register("auth", Subtype, AuthMethodPrefix, intglobals.OldPasswordAccountPrefix, intglobals.NewPasswordAccountPrefix); err != nil { panic(err) } } diff --git a/internal/auth/subtype.go b/internal/auth/subtype.go index 43c19cefc..4ecd1e246 100644 --- a/internal/auth/subtype.go +++ b/internal/auth/subtype.go @@ -2,30 +2,8 @@ package auth import ( "github.com/hashicorp/boundary/internal/boundary" - "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...) -} - // AuthMethod contains the common methods across all the different types of auth methods. type AuthMethod interface { boundary.Resource diff --git a/internal/servers/controller/handlers/accounts/account_service.go b/internal/servers/controller/handlers/accounts/account_service.go index 8fc0510d2..b842aeba3 100644 --- a/internal/servers/controller/handlers/accounts/account_service.go +++ b/internal/servers/controller/handlers/accounts/account_service.go @@ -49,6 +49,8 @@ const ( subjectField = "attributes.subject" nameClaimField = "attributes.full_name" emailClaimField = "attributes.email" + + domain = "auth" ) var ( @@ -144,7 +146,7 @@ func (s Service) ListAccounts(ctx context.Context, req *pbs.ListAccountsRequest) } for _, acct := range ul { res.Id = acct.GetPublicId() - authorizedActions := authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())], requestauth.WithResource(&res)).Strings() + authorizedActions := authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, acct.GetPublicId())], requestauth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue } @@ -201,7 +203,7 @@ func (s Service) GetAccount(ctx context.Context, req *pbs.GetAccountRequest) (*p outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, acct.GetPublicId())]).Strings())) } if outputFields.Has(globals.ManagedGroupIdsField) { outputOpts = append(outputOpts, handlers.WithManagedGroupIds(mgIds)) @@ -243,7 +245,7 @@ func (s Service) CreateAccount(ctx context.Context, req *pbs.CreateAccountReques outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, acct.GetPublicId())]).Strings())) } item, err := toProto(ctx, acct, outputOpts...) @@ -282,7 +284,7 @@ func (s Service) UpdateAccount(ctx context.Context, req *pbs.UpdateAccountReques outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, acct.GetPublicId())]).Strings())) } item, err := toProto(ctx, acct, outputOpts...) @@ -337,7 +339,7 @@ func (s Service) ChangePassword(ctx context.Context, req *pbs.ChangePasswordRequ outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, acct.GetPublicId())]).Strings())) } item, err := toProto(ctx, acct, outputOpts...) @@ -376,7 +378,7 @@ func (s Service) SetPassword(ctx context.Context, req *pbs.SetPasswordRequest) ( outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[auth.SubtypeFromId(acct.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, acct.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, acct.GetPublicId())]).Strings())) } item, err := toProto(ctx, acct, outputOpts...) @@ -392,7 +394,7 @@ func (s Service) SetPassword(ctx context.Context, req *pbs.SetPasswordRequest) ( func (s Service) getFromRepo(ctx context.Context, id string) (auth.Account, []string, error) { var acct auth.Account var mgIds []string - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -513,7 +515,7 @@ func (s Service) createInRepo(ctx context.Context, am auth.AuthMethod, item *pb. return nil, errors.New(ctx, errors.InvalidParameter, op, "missing item") } var out auth.Account - switch auth.SubtypeFromId(am.GetPublicId()) { + switch subtypes.SubtypeFromId(domain, am.GetPublicId()) { case password.Subtype: am, err := s.createPwInRepo(ctx, am, item) if err != nil { @@ -606,7 +608,7 @@ func (s Service) updateOidcInRepo(ctx context.Context, scopeId, amId, id string, func (s Service) updateInRepo(ctx context.Context, scopeId, authMethodId string, req *pbs.UpdateAccountRequest) (auth.Account, error) { const op = "accounts.(Service).updateInRepo" var out auth.Account - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case password.Subtype: a, err := s.updatePwInRepo(ctx, scopeId, authMethodId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) if err != nil { @@ -633,7 +635,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, const op = "accounts.(Service).deleteFromRepo" var rows int var err error - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case password.Subtype: repo, iErr := s.pwRepoFn() if iErr != nil { @@ -660,7 +662,7 @@ func (s Service) listFromRepo(ctx context.Context, authMethodId string) ([]auth. const op = "accounts.(Service).listFromRepo" var outUl []auth.Account - switch auth.SubtypeFromId(authMethodId) { + switch subtypes.SubtypeFromId(domain, authMethodId) { case password.Subtype: pwRepo, err := s.pwRepoFn() if err != nil { @@ -755,7 +757,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty case action.List, action.Create: parentId = id default: - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case password.Subtype: acct, err := pwRepo.LookupAccount(ctx, id) if err != nil { @@ -783,7 +785,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } var authMeth auth.AuthMethod - switch auth.SubtypeFromId(parentId) { + switch subtypes.SubtypeFromId(domain, parentId) { case password.Subtype: am, err := pwRepo.LookupAuthMethod(ctx, parentId) if err != nil { @@ -951,7 +953,7 @@ func validateCreateRequest(req *pbs.CreateAccountRequest) error { if req.GetItem().GetAuthMethodId() == "" { badFields[authMethodIdField] = "This field is required." } - switch auth.SubtypeFromId(req.GetItem().GetAuthMethodId()) { + switch subtypes.SubtypeFromId(domain, req.GetItem().GetAuthMethodId()) { case password.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != password.Subtype.String() { badFields[typeField] = "Doesn't match the parent resource's type." @@ -997,7 +999,7 @@ func validateUpdateRequest(req *pbs.UpdateAccountRequest) error { } return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case password.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != password.Subtype.String() { badFields[typeField] = "Cannot modify the resource type." diff --git a/internal/servers/controller/handlers/accounts/account_service_test.go b/internal/servers/controller/handlers/accounts/account_service_test.go index 7a3e04105..36ed27078 100644 --- a/internal/servers/controller/handlers/accounts/account_service_test.go +++ b/internal/servers/controller/handlers/accounts/account_service_test.go @@ -10,7 +10,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/hashicorp/boundary/globals" - "github.com/hashicorp/boundary/internal/auth" "github.com/hashicorp/boundary/internal/auth/oidc" "github.com/hashicorp/boundary/internal/auth/password" "github.com/hashicorp/boundary/internal/authtoken" @@ -25,6 +24,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers/accounts" "github.com/hashicorp/boundary/internal/types/action" "github.com/hashicorp/boundary/internal/types/scope" + "github.com/hashicorp/boundary/internal/types/subtypes" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/accounts" scopepb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" "github.com/stretchr/testify/assert" @@ -36,6 +36,8 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) +const domain = "auth" + var ( pwAuthorizedActions = []string{ action.NoOp.String(), @@ -224,7 +226,7 @@ func TestGet(t *testing.T) { t.Run(tc.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) - if auth.SubtypeFromId(tc.req.Id) == oidc.Subtype { + if subtypes.SubtypeFromId(domain, tc.req.Id) == oidc.Subtype { // Set up managed groups before getting. First get the current // managed group to make sure we have the right version. oidcRepo, err := oidcRepoFn() diff --git a/internal/servers/controller/handlers/authmethods/authmethod_service.go b/internal/servers/controller/handlers/authmethods/authmethod_service.go index b9e408b57..d1173eb48 100644 --- a/internal/servers/controller/handlers/authmethods/authmethod_service.go +++ b/internal/servers/controller/handlers/authmethods/authmethod_service.go @@ -150,7 +150,7 @@ func (s Service) ListAuthMethods(ctx context.Context, req *pbs.ListAuthMethodsRe for _, am := range ul { res.Id = am.GetPublicId() res.ScopeId = am.GetScopeId() - authorizedActions := authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[auth.SubtypeFromId(am.GetPublicId())], requestauth.WithResource(&res)).Strings() + authorizedActions := authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())], requestauth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue } @@ -211,7 +211,7 @@ func (s Service) GetAuthMethod(ctx context.Context, req *pbs.GetAuthMethodReques outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[auth.SubtypeFromId(am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -256,7 +256,7 @@ func (s Service) CreateAuthMethod(ctx context.Context, req *pbs.CreateAuthMethod outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[auth.SubtypeFromId(am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -306,7 +306,7 @@ func (s Service) UpdateAuthMethod(ctx context.Context, req *pbs.UpdateAuthMethod outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[auth.SubtypeFromId(am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -360,7 +360,7 @@ func (s Service) ChangeState(ctx context.Context, req *pbs.ChangeStateRequest) ( outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[auth.SubtypeFromId(am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -401,7 +401,7 @@ func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) return nil, err } - switch auth.SubtypeFromId(req.GetAuthMethodId()) { + switch subtypes.SubtypeFromId("auth", req.GetAuthMethodId()) { case password.Subtype: if err := validateAuthenticatePasswordRequest(req); err != nil { return nil, err @@ -417,7 +417,7 @@ func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) return nil, authResults.Error } - switch auth.SubtypeFromId(req.GetAuthMethodId()) { + switch subtypes.SubtypeFromId("auth", req.GetAuthMethodId()) { case password.Subtype: return s.authenticatePassword(ctx, req, &authResults) @@ -430,7 +430,7 @@ func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) func (s Service) getFromRepo(ctx context.Context, id string) (auth.AuthMethod, error) { var lookupErr error var am auth.AuthMethod - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("auth", id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -500,7 +500,7 @@ func (s Service) listFromRepo(ctx context.Context, scopeIds []string, authResult func (s Service) createInRepo(ctx context.Context, scopeId string, item *pb.AuthMethod) (auth.AuthMethod, error) { const op = "authmethods.(Service).createInRepo" var out auth.AuthMethod - switch auth.SubtypeFromType(item.GetType()) { + switch subtypes.SubtypeFromType("auth", item.GetType()) { case password.Subtype: am, err := s.createPwInRepo(ctx, scopeId, item) if err != nil { @@ -529,7 +529,7 @@ func (s Service) updateInRepo(ctx context.Context, scopeId string, req *pbs.Upda var am auth.AuthMethod var dryRun bool - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("auth", req.GetId()) { case password.Subtype: pam, err := s.updatePwInRepo(ctx, scopeId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) if err != nil { @@ -559,7 +559,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, const op = "authmethods.(Service).deleteFromRepo" var rows int var dErr error - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("auth", id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -588,7 +588,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, func (s Service) changeStateInRepo(ctx context.Context, req *pbs.ChangeStateRequest) (auth.AuthMethod, error) { const op = "authmethod_service.(Service).changeStateInRepo" - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("auth", req.GetId()) { case oidc.Subtype: repo, err := s.oidcRepoFn() if err != nil { @@ -651,7 +651,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) reque } default: var authMeth auth.AuthMethod - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("auth", id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -837,7 +837,7 @@ func validateCreateRequest(ctx context.Context, req *pbs.CreateAuthMethodRequest if req.GetItem().GetIsPrimary() { badFields[isPrimaryField] = "This field is read only." } - switch auth.SubtypeFromType(req.GetItem().GetType()) { + switch subtypes.SubtypeFromType("auth", req.GetItem().GetType()) { case password.Subtype: attrs := &pb.PasswordAuthMethodAttributes{} if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { @@ -935,9 +935,9 @@ func validateUpdateRequest(ctx context.Context, req *pbs.UpdateAuthMethodRequest if handlers.MaskContains(req.GetUpdateMask().GetPaths(), isPrimaryField) { badFields[isPrimaryField] = "This field is read only." } - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("auth", req.GetId()) { case password.Subtype: - if req.GetItem().GetType() != "" && auth.SubtypeFromType(req.GetItem().GetType()) != password.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("auth", req.GetItem().GetType()) != password.Subtype { badFields[typeField] = "Cannot modify the resource type." } attrs := &pb.PasswordAuthMethodAttributes{} @@ -945,7 +945,7 @@ func validateUpdateRequest(ctx context.Context, req *pbs.UpdateAuthMethodRequest badFields[attributesField] = "Attribute fields do not match the expected format." } case oidc.Subtype: - if req.GetItem().GetType() != "" && auth.SubtypeFromType(req.GetItem().GetType()) != oidc.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("auth", req.GetItem().GetType()) != oidc.Subtype { badFields[typeField] = "Cannot modify the resource type." } attrs := &pb.OidcAuthMethodAttributes{} @@ -1088,7 +1088,7 @@ func validateChangeStateRequest(req *pbs.ChangeStateRequest) error { if req == nil { return errors.NewDeprecated(errors.InvalidParameter, op, "Missing request") } - if st := auth.SubtypeFromId(req.GetId()); st != oidc.Subtype { + if st := subtypes.SubtypeFromId("auth", req.GetId()); st != oidc.Subtype { return handlers.NotFoundErrorf("This endpoint is only available for the %q Auth Method type.", oidc.Subtype.String()) } badFields := make(map[string]string) @@ -1122,7 +1122,7 @@ func validateAuthenticateRequest(req *pbs.AuthenticateRequest) error { if strings.TrimSpace(req.GetAuthMethodId()) == "" { badFields[authMethodIdField] = "This is a required field." } else { - st := auth.SubtypeFromId(req.GetAuthMethodId()) + st := subtypes.SubtypeFromId("auth", req.GetAuthMethodId()) switch st { case password.Subtype, oidc.Subtype: default: diff --git a/internal/servers/controller/handlers/managed_groups/managed_group_service.go b/internal/servers/controller/handlers/managed_groups/managed_group_service.go index 9cb65ea19..c8abe8a8c 100644 --- a/internal/servers/controller/handlers/managed_groups/managed_group_service.go +++ b/internal/servers/controller/handlers/managed_groups/managed_group_service.go @@ -107,7 +107,7 @@ func (s Service) ListManagedGroups(ctx context.Context, req *pbs.ListManagedGrou } for _, mg := range ul { res.Id = mg.GetPublicId() - authorizedActions := authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())], requestauth.WithResource(&res)).Strings() + authorizedActions := authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())], requestauth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue } @@ -164,7 +164,7 @@ func (s Service) GetManagedGroup(ctx context.Context, req *pbs.GetManagedGroupRe outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())]).Strings())) } if outputFields.Has(globals.MemberIdsField) { outputOpts = append(outputOpts, handlers.WithMemberIds(memberIds)) @@ -206,7 +206,7 @@ func (s Service) CreateManagedGroup(ctx context.Context, req *pbs.CreateManagedG outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())]).Strings())) } item, err := toProto(ctx, mg, outputOpts...) @@ -245,7 +245,7 @@ func (s Service) UpdateManagedGroup(ctx context.Context, req *pbs.UpdateManagedG outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[auth.SubtypeFromId(mg.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())]).Strings())) } item, err := toProto(ctx, mg, outputOpts...) @@ -275,7 +275,7 @@ func (s Service) DeleteManagedGroup(ctx context.Context, req *pbs.DeleteManagedG func (s Service) getFromRepo(ctx context.Context, id string) (auth.ManagedGroup, []string, error) { var out auth.ManagedGroup var memberIds []string - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("auth", id) { case oidc.Subtype: repo, err := s.oidcRepoFn() if err != nil { @@ -347,7 +347,7 @@ func (s Service) createInRepo(ctx context.Context, am auth.AuthMethod, item *pb. return nil, errors.New(ctx, errors.InvalidParameter, op, "missing item") } var out auth.ManagedGroup - switch auth.SubtypeFromId(am.GetPublicId()) { + switch subtypes.SubtypeFromId("auth", am.GetPublicId()) { case oidc.Subtype: am, err := s.createOidcInRepo(ctx, am, item) if err != nil { @@ -407,7 +407,7 @@ func (s Service) updateOidcInRepo(ctx context.Context, scopeId, amId, id string, func (s Service) updateInRepo(ctx context.Context, scopeId, authMethodId string, req *pbs.UpdateManagedGroupRequest) (auth.ManagedGroup, error) { const op = "managed_groups.(Service).updateInRepo" var out auth.ManagedGroup - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("auth", req.GetId()) { case oidc.Subtype: mg, err := s.updateOidcInRepo(ctx, scopeId, authMethodId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) if err != nil { @@ -425,7 +425,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, const op = "managed_groups.(Service).deleteFromRepo" var rows int var err error - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("auth", id) { case oidc.Subtype: repo, iErr := s.oidcRepoFn() if iErr != nil { @@ -446,7 +446,7 @@ func (s Service) listFromRepo(ctx context.Context, authMethodId string) ([]auth. const op = "managed_groups.(Service).listFromRepo" var outUl []auth.ManagedGroup - switch auth.SubtypeFromId(authMethodId) { + switch subtypes.SubtypeFromId("auth", authMethodId) { case oidc.Subtype: oidcRepo, err := s.oidcRepoFn() if err != nil { @@ -478,7 +478,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty case action.List, action.Create: parentId = id default: - switch auth.SubtypeFromId(id) { + switch subtypes.SubtypeFromId("auth", id) { case oidc.Subtype: acct, err := oidcRepo.LookupManagedGroup(ctx, id) if err != nil { @@ -498,7 +498,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } var authMeth auth.AuthMethod - switch auth.SubtypeFromId(parentId) { + switch subtypes.SubtypeFromId("auth", parentId) { case oidc.Subtype: am, err := oidcRepo.LookupAuthMethod(ctx, parentId) if err != nil { @@ -600,7 +600,7 @@ func validateCreateRequest(req *pbs.CreateManagedGroupRequest) error { if req.GetItem().GetAuthMethodId() == "" { badFields[globals.AuthMethodIdField] = "This field is required." } - switch auth.SubtypeFromId(req.GetItem().GetAuthMethodId()) { + switch subtypes.SubtypeFromId("auth", req.GetItem().GetAuthMethodId()) { case oidc.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[globals.TypeField] = "Doesn't match the parent resource's type." @@ -630,7 +630,7 @@ func validateUpdateRequest(req *pbs.UpdateManagedGroupRequest) error { } return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch auth.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId("auth", req.GetId()) { case oidc.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[globals.TypeField] = "Cannot modify the resource type." From af93f7fccb15b3cf1359eb753c50de52ea993886 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 29 Mar 2022 10:39:22 -0400 Subject: [PATCH 10/45] feat(subtypes): Attribute field registration and lookup --- .../gen/testing/attribute/attribute.pb.go | 340 ++++++++++++++++++ .../testing/attribute/v1/attribute.proto | 25 ++ internal/types/subtypes/attributes.go | 124 +++++++ internal/types/subtypes/attributes_test.go | 119 ++++++ 4 files changed, 608 insertions(+) create mode 100644 internal/gen/testing/attribute/attribute.pb.go create mode 100644 internal/proto/local/testing/attribute/v1/attribute.proto create mode 100644 internal/types/subtypes/attributes.go create mode 100644 internal/types/subtypes/attributes_test.go diff --git a/internal/gen/testing/attribute/attribute.pb.go b/internal/gen/testing/attribute/attribute.pb.go new file mode 100644 index 000000000..e63f01a09 --- /dev/null +++ b/internal/gen/testing/attribute/attribute.pb.go @@ -0,0 +1,340 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: testing/attribute/v1/attribute.proto + +package attribute + +import ( + _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TestResource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Types that are assignable to Attrs: + // *TestResource_Attributes + // *TestResource_SubResourceAttributes + Attrs isTestResource_Attrs `protobuf_oneof:"attrs"` +} + +func (x *TestResource) Reset() { + *x = TestResource{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestResource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestResource) ProtoMessage() {} + +func (x *TestResource) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestResource.ProtoReflect.Descriptor instead. +func (*TestResource) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{0} +} + +func (x *TestResource) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (m *TestResource) GetAttrs() isTestResource_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + +func (x *TestResource) GetAttributes() *structpb.Struct { + if x, ok := x.GetAttrs().(*TestResource_Attributes); ok { + return x.Attributes + } + return nil +} + +func (x *TestResource) GetSubResourceAttributes() *TestSubResourceAttributes { + if x, ok := x.GetAttrs().(*TestResource_SubResourceAttributes); ok { + return x.SubResourceAttributes + } + return nil +} + +type isTestResource_Attrs interface { + isTestResource_Attrs() +} + +type TestResource_Attributes struct { + Attributes *structpb.Struct `protobuf:"bytes,10,opt,name=attributes,proto3,oneof"` +} + +type TestResource_SubResourceAttributes struct { + SubResourceAttributes *TestSubResourceAttributes `protobuf:"bytes,20,opt,name=sub_resource_attributes,json=subResourceAttributes,proto3,oneof"` +} + +func (*TestResource_Attributes) isTestResource_Attrs() {} + +func (*TestResource_SubResourceAttributes) isTestResource_Attrs() {} + +type TestSubResourceAttributes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *TestSubResourceAttributes) Reset() { + *x = TestSubResourceAttributes{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestSubResourceAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestSubResourceAttributes) ProtoMessage() {} + +func (x *TestSubResourceAttributes) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestSubResourceAttributes.ProtoReflect.Descriptor instead. +func (*TestSubResourceAttributes) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{1} +} + +func (x *TestSubResourceAttributes) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TestNoAttributes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *TestNoAttributes) Reset() { + *x = TestNoAttributes{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestNoAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestNoAttributes) ProtoMessage() {} + +func (x *TestNoAttributes) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestNoAttributes.ProtoReflect.Descriptor instead. +func (*TestNoAttributes) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{2} +} + +func (x *TestNoAttributes) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_testing_attribute_v1_attribute_proto protoreflect.FileDescriptor + +var file_testing_attribute_v1_attribute_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, + 0x72, 0x75, 0x63, 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, 0xec, 0x01, 0x0a, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x0b, 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, + 0x7b, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x42, 0x10, 0x9a, 0xe3, 0x29, 0x0c, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, + 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x2f, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x10, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x48, 0x5a, 0x46, 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, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x3b, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_testing_attribute_v1_attribute_proto_rawDescOnce sync.Once + file_testing_attribute_v1_attribute_proto_rawDescData = file_testing_attribute_v1_attribute_proto_rawDesc +) + +func file_testing_attribute_v1_attribute_proto_rawDescGZIP() []byte { + file_testing_attribute_v1_attribute_proto_rawDescOnce.Do(func() { + file_testing_attribute_v1_attribute_proto_rawDescData = protoimpl.X.CompressGZIP(file_testing_attribute_v1_attribute_proto_rawDescData) + }) + return file_testing_attribute_v1_attribute_proto_rawDescData +} + +var file_testing_attribute_v1_attribute_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_testing_attribute_v1_attribute_proto_goTypes = []interface{}{ + (*TestResource)(nil), // 0: testing.attribute.v1.TestResource + (*TestSubResourceAttributes)(nil), // 1: testing.attribute.v1.TestSubResourceAttributes + (*TestNoAttributes)(nil), // 2: testing.attribute.v1.TestNoAttributes + (*structpb.Struct)(nil), // 3: google.protobuf.Struct +} +var file_testing_attribute_v1_attribute_proto_depIdxs = []int32{ + 3, // 0: testing.attribute.v1.TestResource.attributes:type_name -> google.protobuf.Struct + 1, // 1: testing.attribute.v1.TestResource.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_testing_attribute_v1_attribute_proto_init() } +func file_testing_attribute_v1_attribute_proto_init() { + if File_testing_attribute_v1_attribute_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_testing_attribute_v1_attribute_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestResource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestSubResourceAttributes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestNoAttributes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*TestResource_Attributes)(nil), + (*TestResource_SubResourceAttributes)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_testing_attribute_v1_attribute_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_testing_attribute_v1_attribute_proto_goTypes, + DependencyIndexes: file_testing_attribute_v1_attribute_proto_depIdxs, + MessageInfos: file_testing_attribute_v1_attribute_proto_msgTypes, + }.Build() + File_testing_attribute_v1_attribute_proto = out.File + file_testing_attribute_v1_attribute_proto_rawDesc = nil + file_testing_attribute_v1_attribute_proto_goTypes = nil + file_testing_attribute_v1_attribute_proto_depIdxs = nil +} diff --git a/internal/proto/local/testing/attribute/v1/attribute.proto b/internal/proto/local/testing/attribute/v1/attribute.proto new file mode 100644 index 000000000..6b3d95b04 --- /dev/null +++ b/internal/proto/local/testing/attribute/v1/attribute.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package testing.attribute.v1; + +option go_package = "github.com/hashicorp/boundary/internal/gen/testing/attribute;attribute"; + +import "google/protobuf/struct.proto"; +import "controller/custom_options/v1/options.proto"; + +message TestResource { + string id = 1; + + oneof attrs { + google.protobuf.Struct attributes = 10 [(controller.custom_options.v1.subtype) = "default"]; + TestSubResourceAttributes sub_resource_attributes = 20 [(controller.custom_options.v1.subtype) = "sub_resource"]; + } +} + +message TestSubResourceAttributes { + string name = 1; +} + +message TestNoAttributes { + string id = 1; +} diff --git a/internal/types/subtypes/attributes.go b/internal/types/subtypes/attributes.go new file mode 100644 index 000000000..95ab53c69 --- /dev/null +++ b/internal/types/subtypes/attributes.go @@ -0,0 +1,124 @@ +package subtypes + +import ( + "fmt" + "sync" + + "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/descriptorpb" +) + +const ( + defaultSubtype = "default" +) + +func init() { + globalAttributeKeys = attributeKeys{ + m: make(map[protoreflect.FullName]fieldMap), + } + + protoregistry.GlobalTypes.RangeMessages(func(m protoreflect.MessageType) bool { + d := m.Descriptor() + if err := globalAttributeKeys.register(d); err != nil { + panic(err) + } + return true + }) +} + +type fieldMap map[Subtype]protoreflect.FieldDescriptor + +type attributeKeys struct { + sync.RWMutex + m map[protoreflect.FullName]fieldMap +} + +var globalAttributeKeys attributeKeys + +// register examines the given protobuf MessageDescriptor for fields that have +// the Subtype protobuf extension. It uses these to build a fieldMap of subtype +// strings to the protobuf FieldDescriptors. If the message does not have any +// subtypes it will not be registered, but no error is returned, allowing this +// to be called on any protobuf message. However, if a message has subtypes but +// does not provide a field with a subtype of "default" an error is returned. +func (ak attributeKeys) register(d protoreflect.MessageDescriptor) error { + ak.Lock() + defer ak.Unlock() + + if ak.m == nil { + ak.m = make(map[protoreflect.FullName]fieldMap) + } + + fn := d.FullName() + + if _, ok := ak.m[fn]; ok { + return fmt.Errorf("proto message %s already registered", fn) + } + + km := make(fieldMap, 0) + + fields := d.Fields() + for i := 0; i < fields.Len(); i++ { + f := fields.Get(i) + + opts := f.Options().(*descriptorpb.FieldOptions) + st := proto.GetExtension(opts, protooptions.E_Subtype).(string) + if st != "" { + km[Subtype(st)] = f + } + } + + // no subtypes were found, so nothing needs to be registered + if len(km) <= 0 { + return nil + } + + // If a message has subtypes, it must provide a "default" to support plugins. + if _, ok := km[defaultSubtype]; !ok { + return fmt.Errorf("proto message %s with subtype attributes but no 'default'", fn) + } + + ak.m[fn] = km + + return nil +} + +// protoAttributeField retrieves the FieldDescriptor for a given subtype's +// attribute fields. If the corresponding protobuf message has not been +// registered it will return an error. +func (ak attributeKeys) protoAttributeField(d protoreflect.MessageDescriptor, t Subtype) (protoreflect.FieldDescriptor, error) { + ak.RLock() + defer ak.RUnlock() + + fn := d.FullName() + + km, ok := ak.m[fn] + if !ok { + return nil, fmt.Errorf("proto message %s not registered", fn) + } + + tt, ok := km[t] + if ok { + return tt, nil + } + + tt, ok = km[defaultSubtype] + if !ok { + return nil, fmt.Errorf("missing default for %s", fn) + } + return tt, nil +} + +// TODO: fix doc +// protoAttributeField is used by the attrMarshaler to translate between JSON +// formats for the API and for the protobuf messages. It expects a +// proto.Message with a OneOf field for the subtype attributes and the subtype +// string. It returns the string for the JSON key that that should be used for +// the subtype's attributes fields. +func protoAttributeField(msg proto.Message, t Subtype) (protoreflect.FieldDescriptor, error) { + d := msg.ProtoReflect().Descriptor() + return globalAttributeKeys.protoAttributeField(d, t) +} diff --git a/internal/types/subtypes/attributes_test.go b/internal/types/subtypes/attributes_test.go new file mode 100644 index 000000000..cd39577ad --- /dev/null +++ b/internal/types/subtypes/attributes_test.go @@ -0,0 +1,119 @@ +package subtypes + +import ( + "testing" + + "github.com/hashicorp/boundary/internal/gen/testing/attribute" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func TestProtoAttributeKey(t *testing.T) { + cases := []struct { + name string + msg proto.Message + subtype Subtype + expected protoreflect.FullName + }{ + { + "TestResource/sub_resource", + &attribute.TestResource{}, + "sub_resource", + "testing.attribute.v1.TestResource.sub_resource_attributes", + }, + { + "TestResource/default", + &attribute.TestResource{}, + defaultSubtype, + "testing.attribute.v1.TestResource.attributes", + }, + { + "TestResource/unknown", + &attribute.TestResource{}, + UnknownSubtype, + "testing.attribute.v1.TestResource.attributes", + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + k, err := protoAttributeField(tc.msg, tc.subtype) + require.NoError(t, err) + assert.Equal(t, tc.expected, k.FullName()) + }) + } +} + +func TestProtoAttributeKeyErrors(t *testing.T) { + type notproto struct{} + cases := []struct { + name string + msg proto.Message + subtype Subtype + expectedErr string + }{ + { + "TestNoAttributes/sub_resource", + &attribute.TestNoAttributes{}, + "sub_resource", + "proto message testing.attribute.v1.TestNoAttributes not registered", + }, + { + "TestNoAttributes/default", + &attribute.TestNoAttributes{}, + defaultSubtype, + "proto message testing.attribute.v1.TestNoAttributes not registered", + }, + { + "TestNoAttributes/unknown", + &attribute.TestNoAttributes{}, + UnknownSubtype, + "proto message testing.attribute.v1.TestNoAttributes not registered", + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + _, err := protoAttributeField(tc.msg, tc.subtype) + require.EqualError(t, err, tc.expectedErr) + }) + } +} + +func TestRegisterErrors(t *testing.T) { + cases := []struct { + name string + msg proto.Message + expectedErr string + }{ + { + "AlreadyRegistered", + &attribute.TestResource{}, + "proto message testing.attribute.v1.TestResource already registered", + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + err := globalAttributeKeys.register(tc.msg.ProtoReflect().Descriptor()) + require.EqualError(t, err, tc.expectedErr) + }) + } +} + +func TestRegisterNoSubtypes(t *testing.T) { + ak := attributeKeys{ + m: make(map[protoreflect.FullName]fieldMap), + } + + msg := &attribute.TestNoAttributes{} + d := msg.ProtoReflect().Descriptor() + + err := ak.register(d) + require.NoError(t, err) + + _, ok := ak.m[d.FullName()] + require.False(t, ok) +} From 198a39ef1eea2b6851a111dfb10847286aa7cb2c Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 1 Apr 2022 13:38:58 -0400 Subject: [PATCH 11/45] feat(subtypes): Add grpc interceptor for transforming attributes This interceptor is responsible for maintaining compatability with the JSON API with the change to the protobuf messages. The messages are changing from a single attribue field to a oneof to explicitly associate subtype attribute messages with the resource message. The interceptor transforms the request prior to the auditReqeust interceptor, and transforms the response after the auditResponse interceptor. This allows the audit interceptors to use all the necessary classification information when creating the audit events. --- .../gen/testing/attribute/attribute.pb.go | 1630 ++++++++++++++++- .../gen/testing/attribute/attribute.pb.gw.go | 513 ++++++ .../testing/attribute/attribute_grpc.pb.go | 209 +++ .../testing/attribute/v1/attribute.proto | 145 ++ internal/servers/controller/gateway.go | 12 +- .../types/subtypes/attribute_transform.go | 132 ++ internal/types/subtypes/attributes.go | 38 +- internal/types/subtypes/attributes_test.go | 8 +- internal/types/subtypes/interceptor.go | 308 ++++ .../types/subtypes/interceptor_ext_test.go | 355 ++++ internal/types/subtypes/interceptor_test.go | 590 ++++++ internal/types/subtypes/source_registry.go | 73 + 12 files changed, 3948 insertions(+), 65 deletions(-) create mode 100644 internal/gen/testing/attribute/attribute.pb.gw.go create mode 100644 internal/gen/testing/attribute/attribute_grpc.pb.go create mode 100644 internal/types/subtypes/attribute_transform.go create mode 100644 internal/types/subtypes/interceptor.go create mode 100644 internal/types/subtypes/interceptor_ext_test.go create mode 100644 internal/types/subtypes/interceptor_test.go create mode 100644 internal/types/subtypes/source_registry.go diff --git a/internal/gen/testing/attribute/attribute.pb.go b/internal/gen/testing/attribute/attribute.pb.go index e63f01a09..21562e13c 100644 --- a/internal/gen/testing/attribute/attribute.pb.go +++ b/internal/gen/testing/attribute/attribute.pb.go @@ -7,9 +7,12 @@ package attribute import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "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" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" @@ -27,7 +30,9 @@ type TestResource 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"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + OtherId string `protobuf:"bytes,3,opt,name=other_id,json=otherId,proto3" json:"other_id,omitempty"` // Types that are assignable to Attrs: // *TestResource_Attributes // *TestResource_SubResourceAttributes @@ -73,6 +78,20 @@ func (x *TestResource) GetId() string { return "" } +func (x *TestResource) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *TestResource) GetOtherId() string { + if x != nil { + return x.OtherId + } + return "" +} + func (m *TestResource) GetAttrs() isTestResource_Attrs { if m != nil { return m.Attrs @@ -162,7 +181,8 @@ type TestNoAttributes 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"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` } func (x *TestNoAttributes) Reset() { @@ -204,43 +224,1275 @@ func (x *TestNoAttributes) GetId() string { return "" } +func (x *TestNoAttributes) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type TestNoOneOf struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Attributes *structpb.Struct `protobuf:"bytes,10,opt,name=attributes,proto3" json:"attributes,omitempty"` +} + +func (x *TestNoOneOf) Reset() { + *x = TestNoOneOf{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestNoOneOf) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestNoOneOf) ProtoMessage() {} + +func (x *TestNoOneOf) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestNoOneOf.ProtoReflect.Descriptor instead. +func (*TestNoOneOf) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{3} +} + +func (x *TestNoOneOf) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TestNoOneOf) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *TestNoOneOf) GetAttributes() *structpb.Struct { + if x != nil { + return x.Attributes + } + return nil +} + +type TestListResourceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *TestListResourceRequest) Reset() { + *x = TestListResourceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestListResourceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestListResourceRequest) ProtoMessage() {} + +func (x *TestListResourceRequest) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestListResourceRequest.ProtoReflect.Descriptor instead. +func (*TestListResourceRequest) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{4} +} + +type TestListResourceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*TestResource `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *TestListResourceResponse) Reset() { + *x = TestListResourceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestListResourceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestListResourceResponse) ProtoMessage() {} + +func (x *TestListResourceResponse) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestListResourceResponse.ProtoReflect.Descriptor instead. +func (*TestListResourceResponse) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{5} +} + +func (x *TestListResourceResponse) GetItems() []*TestResource { + if x != nil { + return x.Items + } + return nil +} + +type TestGetResourceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *TestGetResourceRequest) Reset() { + *x = TestGetResourceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestGetResourceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestGetResourceRequest) ProtoMessage() {} + +func (x *TestGetResourceRequest) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestGetResourceRequest.ProtoReflect.Descriptor instead. +func (*TestGetResourceRequest) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{6} +} + +func (x *TestGetResourceRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type TestGetResourceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestResource `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestGetResourceResponse) Reset() { + *x = TestGetResourceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestGetResourceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestGetResourceResponse) ProtoMessage() {} + +func (x *TestGetResourceResponse) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestGetResourceResponse.ProtoReflect.Descriptor instead. +func (*TestGetResourceResponse) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{7} +} + +func (x *TestGetResourceResponse) GetItem() *TestResource { + if x != nil { + return x.Item + } + return nil +} + +type TestCreateResourceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestResource `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestCreateResourceRequest) Reset() { + *x = TestCreateResourceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestCreateResourceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestCreateResourceRequest) ProtoMessage() {} + +func (x *TestCreateResourceRequest) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestCreateResourceRequest.ProtoReflect.Descriptor instead. +func (*TestCreateResourceRequest) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{8} +} + +func (x *TestCreateResourceRequest) GetItem() *TestResource { + if x != nil { + return x.Item + } + return nil +} + +type TestCreateResourceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestResource `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestCreateResourceResponse) Reset() { + *x = TestCreateResourceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestCreateResourceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestCreateResourceResponse) ProtoMessage() {} + +func (x *TestCreateResourceResponse) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestCreateResourceResponse.ProtoReflect.Descriptor instead. +func (*TestCreateResourceResponse) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{9} +} + +func (x *TestCreateResourceResponse) GetItem() *TestResource { + if x != nil { + return x.Item + } + return nil +} + +type TestUpdateResourceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Item *TestResource `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"` +} + +func (x *TestUpdateResourceRequest) Reset() { + *x = TestUpdateResourceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestUpdateResourceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestUpdateResourceRequest) ProtoMessage() {} + +func (x *TestUpdateResourceRequest) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestUpdateResourceRequest.ProtoReflect.Descriptor instead. +func (*TestUpdateResourceRequest) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{10} +} + +func (x *TestUpdateResourceRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TestUpdateResourceRequest) GetItem() *TestResource { + if x != nil { + return x.Item + } + return nil +} + +func (x *TestUpdateResourceRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type TestUpdateResourceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestResource `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestUpdateResourceResponse) Reset() { + *x = TestUpdateResourceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestUpdateResourceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestUpdateResourceResponse) ProtoMessage() {} + +func (x *TestUpdateResourceResponse) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestUpdateResourceResponse.ProtoReflect.Descriptor instead. +func (*TestUpdateResourceResponse) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{11} +} + +func (x *TestUpdateResourceResponse) GetItem() *TestResource { + if x != nil { + return x.Item + } + return nil +} + +type TestRequestNoItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *TestRequestNoItem) Reset() { + *x = TestRequestNoItem{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestRequestNoItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestRequestNoItem) ProtoMessage() {} + +func (x *TestRequestNoItem) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestRequestNoItem.ProtoReflect.Descriptor instead. +func (*TestRequestNoItem) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{12} +} + +func (x *TestRequestNoItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TestRequestItemNotMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item string `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestRequestItemNotMessage) Reset() { + *x = TestRequestItemNotMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestRequestItemNotMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestRequestItemNotMessage) ProtoMessage() {} + +func (x *TestRequestItemNotMessage) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestRequestItemNotMessage.ProtoReflect.Descriptor instead. +func (*TestRequestItemNotMessage) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{13} +} + +func (x *TestRequestItemNotMessage) GetItem() string { + if x != nil { + return x.Item + } + return "" +} + +type TestItemNoType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *TestItemNoType) Reset() { + *x = TestItemNoType{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestItemNoType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestItemNoType) ProtoMessage() {} + +func (x *TestItemNoType) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestItemNoType.ProtoReflect.Descriptor instead. +func (*TestItemNoType) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{14} +} + +func (x *TestItemNoType) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type TestRequestItemNoType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestItemNoType `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestRequestItemNoType) Reset() { + *x = TestRequestItemNoType{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestRequestItemNoType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestRequestItemNoType) ProtoMessage() {} + +func (x *TestRequestItemNoType) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestRequestItemNoType.ProtoReflect.Descriptor instead. +func (*TestRequestItemNoType) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{15} +} + +func (x *TestRequestItemNoType) GetItem() *TestItemNoType { + if x != nil { + return x.Item + } + return nil +} + +type TestNoItemAttributes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Types that are assignable to Attrs: + // *TestNoItemAttributes_Attributes + // *TestNoItemAttributes_SubResourceAttributes + Attrs isTestNoItemAttributes_Attrs `protobuf_oneof:"attrs"` +} + +func (x *TestNoItemAttributes) Reset() { + *x = TestNoItemAttributes{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestNoItemAttributes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestNoItemAttributes) ProtoMessage() {} + +func (x *TestNoItemAttributes) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestNoItemAttributes.ProtoReflect.Descriptor instead. +func (*TestNoItemAttributes) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{16} +} + +func (x *TestNoItemAttributes) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (m *TestNoItemAttributes) GetAttrs() isTestNoItemAttributes_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + +func (x *TestNoItemAttributes) GetAttributes() *structpb.Struct { + if x, ok := x.GetAttrs().(*TestNoItemAttributes_Attributes); ok { + return x.Attributes + } + return nil +} + +func (x *TestNoItemAttributes) GetSubResourceAttributes() *TestSubResourceAttributes { + if x, ok := x.GetAttrs().(*TestNoItemAttributes_SubResourceAttributes); ok { + return x.SubResourceAttributes + } + return nil +} + +type isTestNoItemAttributes_Attrs interface { + isTestNoItemAttributes_Attrs() +} + +type TestNoItemAttributes_Attributes struct { + Attributes *structpb.Struct `protobuf:"bytes,10,opt,name=attributes,proto3,oneof"` +} + +type TestNoItemAttributes_SubResourceAttributes struct { + SubResourceAttributes *TestSubResourceAttributes `protobuf:"bytes,20,opt,name=sub_resource_attributes,json=subResourceAttributes,proto3,oneof"` +} + +func (*TestNoItemAttributes_Attributes) isTestNoItemAttributes_Attrs() {} + +func (*TestNoItemAttributes_SubResourceAttributes) isTestNoItemAttributes_Attrs() {} + +type TestCreateNoOneOfRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestNoOneOf `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestCreateNoOneOfRequest) Reset() { + *x = TestCreateNoOneOfRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestCreateNoOneOfRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestCreateNoOneOfRequest) ProtoMessage() {} + +func (x *TestCreateNoOneOfRequest) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestCreateNoOneOfRequest.ProtoReflect.Descriptor instead. +func (*TestCreateNoOneOfRequest) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{17} +} + +func (x *TestCreateNoOneOfRequest) GetItem() *TestNoOneOf { + if x != nil { + return x.Item + } + return nil +} + +type TestUpdateNoOneOfRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Item *TestNoOneOf `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestUpdateNoOneOfRequest) Reset() { + *x = TestUpdateNoOneOfRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestUpdateNoOneOfRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestUpdateNoOneOfRequest) ProtoMessage() {} + +func (x *TestUpdateNoOneOfRequest) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestUpdateNoOneOfRequest.ProtoReflect.Descriptor instead. +func (*TestUpdateNoOneOfRequest) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{18} +} + +func (x *TestUpdateNoOneOfRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *TestUpdateNoOneOfRequest) GetItem() *TestNoOneOf { + if x != nil { + return x.Item + } + return nil +} + +type TestResponseNoItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *TestResponseNoItem) Reset() { + *x = TestResponseNoItem{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestResponseNoItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestResponseNoItem) ProtoMessage() {} + +func (x *TestResponseNoItem) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestResponseNoItem.ProtoReflect.Descriptor instead. +func (*TestResponseNoItem) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{19} +} + +func (x *TestResponseNoItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TestResponseItemNotMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item string `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestResponseItemNotMessage) Reset() { + *x = TestResponseItemNotMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestResponseItemNotMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestResponseItemNotMessage) ProtoMessage() {} + +func (x *TestResponseItemNotMessage) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestResponseItemNotMessage.ProtoReflect.Descriptor instead. +func (*TestResponseItemNotMessage) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{20} +} + +func (x *TestResponseItemNotMessage) GetItem() string { + if x != nil { + return x.Item + } + return "" +} + +type TestResponseItemNoType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestItemNoType `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestResponseItemNoType) Reset() { + *x = TestResponseItemNoType{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestResponseItemNoType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestResponseItemNoType) ProtoMessage() {} + +func (x *TestResponseItemNoType) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestResponseItemNoType.ProtoReflect.Descriptor instead. +func (*TestResponseItemNoType) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{21} +} + +func (x *TestResponseItemNoType) GetItem() *TestItemNoType { + if x != nil { + return x.Item + } + return nil +} + +type TestCreateNoOneOfResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestNoOneOf `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestCreateNoOneOfResponse) Reset() { + *x = TestCreateNoOneOfResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestCreateNoOneOfResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestCreateNoOneOfResponse) ProtoMessage() {} + +func (x *TestCreateNoOneOfResponse) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestCreateNoOneOfResponse.ProtoReflect.Descriptor instead. +func (*TestCreateNoOneOfResponse) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{22} +} + +func (x *TestCreateNoOneOfResponse) GetItem() *TestNoOneOf { + if x != nil { + return x.Item + } + return nil +} + +type TestUpdateNoOneOfResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *TestNoOneOf `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *TestUpdateNoOneOfResponse) Reset() { + *x = TestUpdateNoOneOfResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestUpdateNoOneOfResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestUpdateNoOneOfResponse) ProtoMessage() {} + +func (x *TestUpdateNoOneOfResponse) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestUpdateNoOneOfResponse.ProtoReflect.Descriptor instead. +func (*TestUpdateNoOneOfResponse) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{23} +} + +func (x *TestUpdateNoOneOfResponse) GetItem() *TestNoOneOf { + if x != nil { + return x.Item + } + return nil +} + var File_testing_attribute_v1_attribute_proto protoreflect.FileDescriptor var file_testing_attribute_v1_attribute_proto_rawDesc = []byte{ 0x0a, 0x24, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, + 0x6d, 0x61, 0x73, 0x6b, 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, 0xec, 0x01, 0x0a, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa1, 0x02, 0x0a, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x0b, 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, - 0x7b, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, 0x52, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x08, 0x6f, + 0x74, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, + 0xe3, 0x29, 0x01, 0x52, 0x07, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x0a, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x0b, 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, 0x7b, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x53, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0x9a, 0xe3, 0x29, 0x0c, 0x73, 0x75, 0x62, 0x5f, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x42, 0x10, 0x9a, 0xe3, 0x29, 0x0c, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, - 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x2f, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x10, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, + 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x2f, 0x0a, 0x19, 0x54, 0x65, + 0x73, 0x74, 0x53, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x36, 0x0a, 0x10, 0x54, + 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x22, 0x6a, 0x0a, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, + 0x4f, 0x66, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, + 0x19, 0x0a, 0x17, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x54, 0x0a, 0x18, 0x54, 0x65, + 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x22, 0x28, 0x0a, 0x16, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x17, 0x54, 0x65, + 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x53, 0x0a, + 0x19, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x22, 0x54, 0x0a, 0x1a, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa1, 0x01, 0x0a, 0x19, 0x54, 0x65, 0x73, + 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x54, 0x0a, 0x1a, + 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x22, 0x27, 0x0a, 0x11, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x19, 0x54, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, + 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x20, 0x0a, 0x0e, + 0x54, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, + 0x0a, 0x15, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, + 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x22, 0xf4, 0x01, 0x0a, 0x14, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x0b, 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, 0x7b, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, + 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0x9a, 0xe3, 0x29, 0x0c, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, + 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x51, 0x0a, 0x18, 0x54, 0x65, 0x73, 0x74, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, + 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x61, 0x0a, 0x18, 0x54, + 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x28, + 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4e, 0x6f, + 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x1a, 0x54, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x74, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x52, 0x0a, 0x16, 0x54, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x49, 0x74, + 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x52, + 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, + 0x65, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x22, 0x52, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xc1, 0x05, 0x0a, 0x13, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9b, + 0x01, 0x0a, 0x10, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, + 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x92, 0x41, + 0x0b, 0x12, 0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xaf, 0x01, 0x0a, + 0x12, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x12, + 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, + 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0xb4, + 0x01, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, + 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, + 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, + 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, + 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0xa2, 0x01, 0x0a, 0x0f, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2c, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, + 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x17, + 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x0a, + 0x12, 0x08, 0x54, 0x65, 0x73, 0x74, 0x20, 0x67, 0x65, 0x74, 0x42, 0x50, 0x5a, 0x46, 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, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x3b, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x75, 0x74, 0x65, 0xa2, 0xe3, 0x29, 0x04, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -255,21 +1507,67 @@ func file_testing_attribute_v1_attribute_proto_rawDescGZIP() []byte { return file_testing_attribute_v1_attribute_proto_rawDescData } -var file_testing_attribute_v1_attribute_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_testing_attribute_v1_attribute_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_testing_attribute_v1_attribute_proto_goTypes = []interface{}{ - (*TestResource)(nil), // 0: testing.attribute.v1.TestResource - (*TestSubResourceAttributes)(nil), // 1: testing.attribute.v1.TestSubResourceAttributes - (*TestNoAttributes)(nil), // 2: testing.attribute.v1.TestNoAttributes - (*structpb.Struct)(nil), // 3: google.protobuf.Struct + (*TestResource)(nil), // 0: testing.attribute.v1.TestResource + (*TestSubResourceAttributes)(nil), // 1: testing.attribute.v1.TestSubResourceAttributes + (*TestNoAttributes)(nil), // 2: testing.attribute.v1.TestNoAttributes + (*TestNoOneOf)(nil), // 3: testing.attribute.v1.TestNoOneOf + (*TestListResourceRequest)(nil), // 4: testing.attribute.v1.TestListResourceRequest + (*TestListResourceResponse)(nil), // 5: testing.attribute.v1.TestListResourceResponse + (*TestGetResourceRequest)(nil), // 6: testing.attribute.v1.TestGetResourceRequest + (*TestGetResourceResponse)(nil), // 7: testing.attribute.v1.TestGetResourceResponse + (*TestCreateResourceRequest)(nil), // 8: testing.attribute.v1.TestCreateResourceRequest + (*TestCreateResourceResponse)(nil), // 9: testing.attribute.v1.TestCreateResourceResponse + (*TestUpdateResourceRequest)(nil), // 10: testing.attribute.v1.TestUpdateResourceRequest + (*TestUpdateResourceResponse)(nil), // 11: testing.attribute.v1.TestUpdateResourceResponse + (*TestRequestNoItem)(nil), // 12: testing.attribute.v1.TestRequestNoItem + (*TestRequestItemNotMessage)(nil), // 13: testing.attribute.v1.TestRequestItemNotMessage + (*TestItemNoType)(nil), // 14: testing.attribute.v1.TestItemNoType + (*TestRequestItemNoType)(nil), // 15: testing.attribute.v1.TestRequestItemNoType + (*TestNoItemAttributes)(nil), // 16: testing.attribute.v1.TestNoItemAttributes + (*TestCreateNoOneOfRequest)(nil), // 17: testing.attribute.v1.TestCreateNoOneOfRequest + (*TestUpdateNoOneOfRequest)(nil), // 18: testing.attribute.v1.TestUpdateNoOneOfRequest + (*TestResponseNoItem)(nil), // 19: testing.attribute.v1.TestResponseNoItem + (*TestResponseItemNotMessage)(nil), // 20: testing.attribute.v1.TestResponseItemNotMessage + (*TestResponseItemNoType)(nil), // 21: testing.attribute.v1.TestResponseItemNoType + (*TestCreateNoOneOfResponse)(nil), // 22: testing.attribute.v1.TestCreateNoOneOfResponse + (*TestUpdateNoOneOfResponse)(nil), // 23: testing.attribute.v1.TestUpdateNoOneOfResponse + (*structpb.Struct)(nil), // 24: google.protobuf.Struct + (*fieldmaskpb.FieldMask)(nil), // 25: google.protobuf.FieldMask } var file_testing_attribute_v1_attribute_proto_depIdxs = []int32{ - 3, // 0: testing.attribute.v1.TestResource.attributes:type_name -> google.protobuf.Struct - 1, // 1: testing.attribute.v1.TestResource.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 24, // 0: testing.attribute.v1.TestResource.attributes:type_name -> google.protobuf.Struct + 1, // 1: testing.attribute.v1.TestResource.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes + 24, // 2: testing.attribute.v1.TestNoOneOf.attributes:type_name -> google.protobuf.Struct + 0, // 3: testing.attribute.v1.TestListResourceResponse.items:type_name -> testing.attribute.v1.TestResource + 0, // 4: testing.attribute.v1.TestGetResourceResponse.item:type_name -> testing.attribute.v1.TestResource + 0, // 5: testing.attribute.v1.TestCreateResourceRequest.item:type_name -> testing.attribute.v1.TestResource + 0, // 6: testing.attribute.v1.TestCreateResourceResponse.item:type_name -> testing.attribute.v1.TestResource + 0, // 7: testing.attribute.v1.TestUpdateResourceRequest.item:type_name -> testing.attribute.v1.TestResource + 25, // 8: testing.attribute.v1.TestUpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 9: testing.attribute.v1.TestUpdateResourceResponse.item:type_name -> testing.attribute.v1.TestResource + 14, // 10: testing.attribute.v1.TestRequestItemNoType.item:type_name -> testing.attribute.v1.TestItemNoType + 24, // 11: testing.attribute.v1.TestNoItemAttributes.attributes:type_name -> google.protobuf.Struct + 1, // 12: testing.attribute.v1.TestNoItemAttributes.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes + 3, // 13: testing.attribute.v1.TestCreateNoOneOfRequest.item:type_name -> testing.attribute.v1.TestNoOneOf + 3, // 14: testing.attribute.v1.TestUpdateNoOneOfRequest.item:type_name -> testing.attribute.v1.TestNoOneOf + 14, // 15: testing.attribute.v1.TestResponseItemNoType.item:type_name -> testing.attribute.v1.TestItemNoType + 3, // 16: testing.attribute.v1.TestCreateNoOneOfResponse.item:type_name -> testing.attribute.v1.TestNoOneOf + 3, // 17: testing.attribute.v1.TestUpdateNoOneOfResponse.item:type_name -> testing.attribute.v1.TestNoOneOf + 4, // 18: testing.attribute.v1.TestResourceService.TestListResource:input_type -> testing.attribute.v1.TestListResourceRequest + 8, // 19: testing.attribute.v1.TestResourceService.TestCreateResource:input_type -> testing.attribute.v1.TestCreateResourceRequest + 10, // 20: testing.attribute.v1.TestResourceService.TestUpdateResource:input_type -> testing.attribute.v1.TestUpdateResourceRequest + 6, // 21: testing.attribute.v1.TestResourceService.TestGetResource:input_type -> testing.attribute.v1.TestGetResourceRequest + 5, // 22: testing.attribute.v1.TestResourceService.TestListResource:output_type -> testing.attribute.v1.TestListResourceResponse + 9, // 23: testing.attribute.v1.TestResourceService.TestCreateResource:output_type -> testing.attribute.v1.TestCreateResourceResponse + 11, // 24: testing.attribute.v1.TestResourceService.TestUpdateResource:output_type -> testing.attribute.v1.TestUpdateResourceResponse + 7, // 25: testing.attribute.v1.TestResourceService.TestGetResource:output_type -> testing.attribute.v1.TestGetResourceResponse + 22, // [22:26] is the sub-list for method output_type + 18, // [18:22] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_testing_attribute_v1_attribute_proto_init() } @@ -314,20 +1612,276 @@ func file_testing_attribute_v1_attribute_proto_init() { return nil } } + file_testing_attribute_v1_attribute_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestNoOneOf); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestListResourceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestListResourceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestGetResourceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestGetResourceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestCreateResourceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestCreateResourceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestUpdateResourceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestUpdateResourceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestRequestNoItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestRequestItemNotMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestItemNoType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestRequestItemNoType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestNoItemAttributes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestCreateNoOneOfRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestUpdateNoOneOfRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestResponseNoItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestResponseItemNotMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestResponseItemNoType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestCreateNoOneOfResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestUpdateNoOneOfResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_testing_attribute_v1_attribute_proto_msgTypes[0].OneofWrappers = []interface{}{ (*TestResource_Attributes)(nil), (*TestResource_SubResourceAttributes)(nil), } + file_testing_attribute_v1_attribute_proto_msgTypes[16].OneofWrappers = []interface{}{ + (*TestNoItemAttributes_Attributes)(nil), + (*TestNoItemAttributes_SubResourceAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_testing_attribute_v1_attribute_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 24, NumExtensions: 0, - NumServices: 0, + NumServices: 1, }, GoTypes: file_testing_attribute_v1_attribute_proto_goTypes, DependencyIndexes: file_testing_attribute_v1_attribute_proto_depIdxs, diff --git a/internal/gen/testing/attribute/attribute.pb.gw.go b/internal/gen/testing/attribute/attribute.pb.gw.go new file mode 100644 index 000000000..f0122eb25 --- /dev/null +++ b/internal/gen/testing/attribute/attribute.pb.gw.go @@ -0,0 +1,513 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: testing/attribute/v1/attribute.proto + +/* +Package attribute is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package attribute + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TestResourceService_TestListResource_0(ctx context.Context, marshaler runtime.Marshaler, client TestResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestListResourceRequest + var metadata runtime.ServerMetadata + + msg, err := client.TestListResource(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TestResourceService_TestListResource_0(ctx context.Context, marshaler runtime.Marshaler, server TestResourceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestListResourceRequest + var metadata runtime.ServerMetadata + + msg, err := server.TestListResource(ctx, &protoReq) + return msg, metadata, err + +} + +func request_TestResourceService_TestCreateResource_0(ctx context.Context, marshaler runtime.Marshaler, client TestResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestCreateResourceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TestCreateResource(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TestResourceService_TestCreateResource_0(ctx context.Context, marshaler runtime.Marshaler, server TestResourceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestCreateResourceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TestCreateResource(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_TestResourceService_TestUpdateResource_0 = &utilities.DoubleArray{Encoding: map[string]int{"item": 0, "id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_TestResourceService_TestUpdateResource_0(ctx context.Context, marshaler runtime.Marshaler, client TestResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestUpdateResourceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Item); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_TestResourceService_TestUpdateResource_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TestUpdateResource(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TestResourceService_TestUpdateResource_0(ctx context.Context, marshaler runtime.Marshaler, server TestResourceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestUpdateResourceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Item); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Item); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_TestResourceService_TestUpdateResource_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TestUpdateResource(ctx, &protoReq) + return msg, metadata, err + +} + +func request_TestResourceService_TestGetResource_0(ctx context.Context, marshaler runtime.Marshaler, client TestResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestGetResourceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.TestGetResource(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TestResourceService_TestGetResource_0(ctx context.Context, marshaler runtime.Marshaler, server TestResourceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TestGetResourceRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.TestGetResource(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTestResourceServiceHandlerServer registers the http handlers for service TestResourceService to "mux". +// UnaryRPC :call TestResourceServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTestResourceServiceHandlerFromEndpoint instead. +func RegisterTestResourceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestResourceServiceServer) error { + + mux.Handle("GET", pattern_TestResourceService_TestListResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestListResource", runtime.WithHTTPPathPattern("/v1/test-resources")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TestResourceService_TestListResource_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestListResource_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_TestResourceService_TestCreateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestCreateResource", runtime.WithHTTPPathPattern("/v1/test-resources")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TestResourceService_TestCreateResource_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestCreateResource_0(ctx, mux, outboundMarshaler, w, req, response_TestResourceService_TestCreateResource_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_TestResourceService_TestUpdateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestUpdateResource", runtime.WithHTTPPathPattern("/v1/test-resources/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TestResourceService_TestUpdateResource_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestUpdateResource_0(ctx, mux, outboundMarshaler, w, req, response_TestResourceService_TestUpdateResource_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_TestResourceService_TestGetResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestGetResource", runtime.WithHTTPPathPattern("/v1/test-resources/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TestResourceService_TestGetResource_0(ctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestGetResource_0(ctx, mux, outboundMarshaler, w, req, response_TestResourceService_TestGetResource_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTestResourceServiceHandlerFromEndpoint is same as RegisterTestResourceServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTestResourceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTestResourceServiceHandler(ctx, mux, conn) +} + +// RegisterTestResourceServiceHandler registers the http handlers for service TestResourceService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTestResourceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTestResourceServiceHandlerClient(ctx, mux, NewTestResourceServiceClient(conn)) +} + +// RegisterTestResourceServiceHandlerClient registers the http handlers for service TestResourceService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TestResourceServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TestResourceServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TestResourceServiceClient" to call the correct interceptors. +func RegisterTestResourceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestResourceServiceClient) error { + + mux.Handle("GET", pattern_TestResourceService_TestListResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestListResource", runtime.WithHTTPPathPattern("/v1/test-resources")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TestResourceService_TestListResource_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestListResource_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_TestResourceService_TestCreateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestCreateResource", runtime.WithHTTPPathPattern("/v1/test-resources")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TestResourceService_TestCreateResource_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestCreateResource_0(ctx, mux, outboundMarshaler, w, req, response_TestResourceService_TestCreateResource_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_TestResourceService_TestUpdateResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestUpdateResource", runtime.WithHTTPPathPattern("/v1/test-resources/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TestResourceService_TestUpdateResource_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestUpdateResource_0(ctx, mux, outboundMarshaler, w, req, response_TestResourceService_TestUpdateResource_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_TestResourceService_TestGetResource_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + ctx, err = runtime.AnnotateContext(ctx, mux, req, "/testing.attribute.v1.TestResourceService/TestGetResource", runtime.WithHTTPPathPattern("/v1/test-resources/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TestResourceService_TestGetResource_0(ctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TestResourceService_TestGetResource_0(ctx, mux, outboundMarshaler, w, req, response_TestResourceService_TestGetResource_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +type response_TestResourceService_TestCreateResource_0 struct { + proto.Message +} + +func (m response_TestResourceService_TestCreateResource_0) XXX_ResponseBody() interface{} { + response := m.Message.(*TestCreateResourceResponse) + return response.Item +} + +type response_TestResourceService_TestUpdateResource_0 struct { + proto.Message +} + +func (m response_TestResourceService_TestUpdateResource_0) XXX_ResponseBody() interface{} { + response := m.Message.(*TestUpdateResourceResponse) + return response.Item +} + +type response_TestResourceService_TestGetResource_0 struct { + proto.Message +} + +func (m response_TestResourceService_TestGetResource_0) XXX_ResponseBody() interface{} { + response := m.Message.(*TestGetResourceResponse) + return response.Item +} + +var ( + pattern_TestResourceService_TestListResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "test-resources"}, "")) + + pattern_TestResourceService_TestCreateResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "test-resources"}, "")) + + pattern_TestResourceService_TestUpdateResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "test-resources", "id"}, "")) + + pattern_TestResourceService_TestGetResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "test-resources", "id"}, "")) +) + +var ( + forward_TestResourceService_TestListResource_0 = runtime.ForwardResponseMessage + + forward_TestResourceService_TestCreateResource_0 = runtime.ForwardResponseMessage + + forward_TestResourceService_TestUpdateResource_0 = runtime.ForwardResponseMessage + + forward_TestResourceService_TestGetResource_0 = runtime.ForwardResponseMessage +) diff --git a/internal/gen/testing/attribute/attribute_grpc.pb.go b/internal/gen/testing/attribute/attribute_grpc.pb.go new file mode 100644 index 000000000..120013605 --- /dev/null +++ b/internal/gen/testing/attribute/attribute_grpc.pb.go @@ -0,0 +1,209 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package attribute + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// TestResourceServiceClient is the client API for TestResourceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TestResourceServiceClient interface { + TestListResource(ctx context.Context, in *TestListResourceRequest, opts ...grpc.CallOption) (*TestListResourceResponse, error) + TestCreateResource(ctx context.Context, in *TestCreateResourceRequest, opts ...grpc.CallOption) (*TestCreateResourceResponse, error) + TestUpdateResource(ctx context.Context, in *TestUpdateResourceRequest, opts ...grpc.CallOption) (*TestUpdateResourceResponse, error) + TestGetResource(ctx context.Context, in *TestGetResourceRequest, opts ...grpc.CallOption) (*TestGetResourceResponse, error) +} + +type testResourceServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTestResourceServiceClient(cc grpc.ClientConnInterface) TestResourceServiceClient { + return &testResourceServiceClient{cc} +} + +func (c *testResourceServiceClient) TestListResource(ctx context.Context, in *TestListResourceRequest, opts ...grpc.CallOption) (*TestListResourceResponse, error) { + out := new(TestListResourceResponse) + err := c.cc.Invoke(ctx, "/testing.attribute.v1.TestResourceService/TestListResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testResourceServiceClient) TestCreateResource(ctx context.Context, in *TestCreateResourceRequest, opts ...grpc.CallOption) (*TestCreateResourceResponse, error) { + out := new(TestCreateResourceResponse) + err := c.cc.Invoke(ctx, "/testing.attribute.v1.TestResourceService/TestCreateResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testResourceServiceClient) TestUpdateResource(ctx context.Context, in *TestUpdateResourceRequest, opts ...grpc.CallOption) (*TestUpdateResourceResponse, error) { + out := new(TestUpdateResourceResponse) + err := c.cc.Invoke(ctx, "/testing.attribute.v1.TestResourceService/TestUpdateResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testResourceServiceClient) TestGetResource(ctx context.Context, in *TestGetResourceRequest, opts ...grpc.CallOption) (*TestGetResourceResponse, error) { + out := new(TestGetResourceResponse) + err := c.cc.Invoke(ctx, "/testing.attribute.v1.TestResourceService/TestGetResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TestResourceServiceServer is the server API for TestResourceService service. +// All implementations must embed UnimplementedTestResourceServiceServer +// for forward compatibility +type TestResourceServiceServer interface { + TestListResource(context.Context, *TestListResourceRequest) (*TestListResourceResponse, error) + TestCreateResource(context.Context, *TestCreateResourceRequest) (*TestCreateResourceResponse, error) + TestUpdateResource(context.Context, *TestUpdateResourceRequest) (*TestUpdateResourceResponse, error) + TestGetResource(context.Context, *TestGetResourceRequest) (*TestGetResourceResponse, error) + mustEmbedUnimplementedTestResourceServiceServer() +} + +// UnimplementedTestResourceServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTestResourceServiceServer struct { +} + +func (UnimplementedTestResourceServiceServer) TestListResource(context.Context, *TestListResourceRequest) (*TestListResourceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestListResource not implemented") +} +func (UnimplementedTestResourceServiceServer) TestCreateResource(context.Context, *TestCreateResourceRequest) (*TestCreateResourceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestCreateResource not implemented") +} +func (UnimplementedTestResourceServiceServer) TestUpdateResource(context.Context, *TestUpdateResourceRequest) (*TestUpdateResourceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestUpdateResource not implemented") +} +func (UnimplementedTestResourceServiceServer) TestGetResource(context.Context, *TestGetResourceRequest) (*TestGetResourceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestGetResource not implemented") +} +func (UnimplementedTestResourceServiceServer) mustEmbedUnimplementedTestResourceServiceServer() {} + +// UnsafeTestResourceServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TestResourceServiceServer will +// result in compilation errors. +type UnsafeTestResourceServiceServer interface { + mustEmbedUnimplementedTestResourceServiceServer() +} + +func RegisterTestResourceServiceServer(s grpc.ServiceRegistrar, srv TestResourceServiceServer) { + s.RegisterService(&TestResourceService_ServiceDesc, srv) +} + +func _TestResourceService_TestListResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestListResourceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestResourceServiceServer).TestListResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/testing.attribute.v1.TestResourceService/TestListResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestResourceServiceServer).TestListResource(ctx, req.(*TestListResourceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TestResourceService_TestCreateResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestCreateResourceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestResourceServiceServer).TestCreateResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/testing.attribute.v1.TestResourceService/TestCreateResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestResourceServiceServer).TestCreateResource(ctx, req.(*TestCreateResourceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TestResourceService_TestUpdateResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestUpdateResourceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestResourceServiceServer).TestUpdateResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/testing.attribute.v1.TestResourceService/TestUpdateResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestResourceServiceServer).TestUpdateResource(ctx, req.(*TestUpdateResourceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TestResourceService_TestGetResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TestGetResourceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestResourceServiceServer).TestGetResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/testing.attribute.v1.TestResourceService/TestGetResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestResourceServiceServer).TestGetResource(ctx, req.(*TestGetResourceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TestResourceService_ServiceDesc is the grpc.ServiceDesc for TestResourceService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TestResourceService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "testing.attribute.v1.TestResourceService", + HandlerType: (*TestResourceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "TestListResource", + Handler: _TestResourceService_TestListResource_Handler, + }, + { + MethodName: "TestCreateResource", + Handler: _TestResourceService_TestCreateResource_Handler, + }, + { + MethodName: "TestUpdateResource", + Handler: _TestResourceService_TestUpdateResource_Handler, + }, + { + MethodName: "TestGetResource", + Handler: _TestResourceService_TestGetResource_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "testing/attribute/v1/attribute.proto", +} diff --git a/internal/proto/local/testing/attribute/v1/attribute.proto b/internal/proto/local/testing/attribute/v1/attribute.proto index 6b3d95b04..0d921d785 100644 --- a/internal/proto/local/testing/attribute/v1/attribute.proto +++ b/internal/proto/local/testing/attribute/v1/attribute.proto @@ -4,11 +4,19 @@ package testing.attribute.v1; option go_package = "github.com/hashicorp/boundary/internal/gen/testing/attribute;attribute"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "google/api/annotations.proto"; import "google/protobuf/struct.proto"; +import "google/protobuf/field_mask.proto"; import "controller/custom_options/v1/options.proto"; +option (controller.custom_options.v1.domain) = "test"; + message TestResource { string id = 1; + string type = 2; + + string other_id = 3 [(controller.custom_options.v1.subtype_source_id) = true]; oneof attrs { google.protobuf.Struct attributes = 10 [(controller.custom_options.v1.subtype) = "default"]; @@ -22,4 +30,141 @@ message TestSubResourceAttributes { message TestNoAttributes { string id = 1; + string type = 2; +} + +message TestNoOneOf { + string id = 1; + string type = 2; + + google.protobuf.Struct attributes = 10; +} + +service TestResourceService { + rpc TestListResource(TestListResourceRequest) returns (TestListResourceResponse) { + option (google.api.http) = { + get: "/v1/test-resources" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Test list" + }; + } + + rpc TestCreateResource(TestCreateResourceRequest) returns (TestCreateResourceResponse) { + option (google.api.http) = { + post: "/v1/test-resources" + body: "item" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Test create" + }; + } + + rpc TestUpdateResource(TestUpdateResourceRequest) returns (TestUpdateResourceResponse) { + option (google.api.http) = { + patch: "/v1/test-resources/{id}" + body: "item" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Test update" + }; + } + + rpc TestGetResource(TestGetResourceRequest) returns (TestGetResourceResponse) { + option (google.api.http) = { + get: "/v1/test-resources/{id}" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + summary: "Test get" + }; + } +} + +message TestListResourceRequest {} + +message TestListResourceResponse { + repeated TestResource items = 1; +} + +message TestGetResourceRequest { + string id = 1; +} + +message TestGetResourceResponse { + TestResource item = 1; +} + +message TestCreateResourceRequest { + TestResource item = 2; +} + +message TestCreateResourceResponse { + TestResource item = 1; +} + +message TestUpdateResourceRequest { + string id = 1; + TestResource item = 2; + google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; +} + +message TestUpdateResourceResponse { + TestResource item = 1; +} + +message TestRequestNoItem { + string name = 1; +} + +message TestRequestItemNotMessage { + string item = 1; +} + +message TestItemNoType { + string id = 1; +} + +message TestRequestItemNoType { + TestItemNoType item = 1; +} + +message TestNoItemAttributes { + string id = 1; + + oneof attrs { + google.protobuf.Struct attributes = 10 [(controller.custom_options.v1.subtype) = "default"]; + TestSubResourceAttributes sub_resource_attributes = 20 [(controller.custom_options.v1.subtype) = "sub_resource"]; + } +} + +message TestCreateNoOneOfRequest { + TestNoOneOf item = 1; +} + +message TestUpdateNoOneOfRequest { + string id = 1; + TestNoOneOf item = 2; +} + +message TestResponseNoItem { + string name = 1; +} + +message TestResponseItemNotMessage { + string item = 1; +} + +message TestResponseItemNoType { + TestItemNoType item = 1; +} + +message TestCreateNoOneOfResponse { + TestNoOneOf item = 1; +} + +message TestUpdateNoOneOfResponse { + TestNoOneOf item = 1; } diff --git a/internal/servers/controller/gateway.go b/internal/servers/controller/gateway.go index 005e18803..397486684 100644 --- a/internal/servers/controller/gateway.go +++ b/internal/servers/controller/gateway.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/boundary/internal/observability/event" "github.com/hashicorp/boundary/internal/servers/controller/common" "github.com/hashicorp/boundary/internal/servers/controller/handlers" + "github.com/hashicorp/boundary/internal/types/subtypes" "google.golang.org/grpc" "google.golang.org/grpc/test/bufconn" ) @@ -73,11 +74,12 @@ func newGrpcServer( grpc.MaxSendMsgSize(math.MaxInt32), grpc.UnaryInterceptor( grpc_middleware.ChainUnaryServer( - requestCtxInterceptor, // populated requestInfo from headers into the request ctx - auditRequestInterceptor(ctx), // before we get started, audit the request - errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy - statusCodeInterceptor(ctx), // convert grpc codes into http status codes for the http proxy (can modify the resp) - auditResponseInterceptor(ctx), // as we finish, audit the response + requestCtxInterceptor, // populated requestInfo from headers into the request ctx + subtypes.AttributeTransformerInterceptor(ctx), // convert to/from generic attributes from/to subtype specific attributes + auditRequestInterceptor(ctx), // before we get started, audit the request + errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy + statusCodeInterceptor(ctx), // convert grpc codes into http status codes for the http proxy (can modify the resp) + auditResponseInterceptor(ctx), // as we finish, audit the response grpc_recovery.UnaryServerInterceptor( // recover from panics with a grpc internal error grpc_recovery.WithRecoveryHandlerContext(recoveryHandler()), ), diff --git a/internal/types/subtypes/attribute_transform.go b/internal/types/subtypes/attribute_transform.go new file mode 100644 index 000000000..9c59509dd --- /dev/null +++ b/internal/types/subtypes/attribute_transform.go @@ -0,0 +1,132 @@ +package subtypes + +import ( + "fmt" + + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/known/structpb" +) + +func convertAttributesToSubtype(msg proto.Message, st Subtype) error { + r := msg.ProtoReflect() + d := r.Descriptor() + + defaultAttrField, err := attributeField(d, defaultSubtype) + if err != nil { + // If unable to get a default attribute field, the message is either + // not registered or not in the format needed for conversion, so no + // conversion should be performed. The most likely case here is that + // the message has not been changed to use a oneof for attributes yet. + return nil + } + + stAttrField, err := attributeField(d, st) + if err != nil { + // This error should not be possible, since any registration issue + // would trigger the previous call, and if this particular subtype + // is unknown, the default should be returned. + return nil + } + + if defaultAttrField == stAttrField { + // no need to convert + return nil + } + + defaultAttrs, ok := r.Get(defaultAttrField).Message().Interface().(*structpb.Struct) + if !ok { + // This should not be possible since this is checked in + // (attributeRegistry).register at initialization time and would panic + // if this was the case. + return fmt.Errorf("found default attribute field that is not structpb.Struct: %s %s", d.FullName(), defaultAttrField.FullName()) + } + stAttrs := r.Get(stAttrField).Message().New().Interface() + if err := structToProto(defaultAttrs, stAttrs); err != nil { + return err + } + + // implicitly clears any previously set oneof value + r.Set(stAttrField, protoreflect.ValueOfMessage(stAttrs.ProtoReflect())) + return nil +} + +func convertAttributesToDefault(msg proto.Message, st Subtype) error { + r := msg.ProtoReflect() + d := r.Descriptor() + + defaultAttrField, err := attributeField(d, defaultSubtype) + if err != nil { + // If unable to get a default attribute field, the message is either + // not registered or not in the format needed for conversion, so no + // conversion should be performed. The most likely case here is that + // the message has not been changed to use a oneof for attributes yet. + return nil + } + + stAttrField, err := attributeField(d, st) + if err != nil { + // This error should not be possible, since any registration issue + // would trigger the previous call, and if this particular subtype + // is unknown, the default should be returned. + return nil + } + + if defaultAttrField == stAttrField { + // no need to convert + return nil + } + + stAttrs, ok := r.Get(stAttrField).Message().Interface().(proto.Message) + if !ok { + return fmt.Errorf("found subtype attribute field that is not proto.Message: %s %s", d.FullName(), stAttrField.FullName()) + } + defaultAttrs, err := protoToStruct(stAttrs) + if err != nil { + return err + } + // implicitly clears any previously set oneof value + r.Set(defaultAttrField, protoreflect.ValueOfMessage(defaultAttrs.ProtoReflect())) + return nil +} + +func structToProto(fields *structpb.Struct, p proto.Message) error { + if fields == nil { + // If there is no struct, don't update the default proto message. + return nil + } + js, err := fields.MarshalJSON() + if err != nil { + return err + } + + // TODO: replicate this logic but with a proto extension set on the Field + // descriptor There are some attributes where we want to discard unknown + // fields, while others that should error if there are unknown fields + // + // opts := GetOpts(opt...) + // if opts.withDiscardUnknownFields { + // err = (protojson.UnmarshalOptions{DiscardUnknown: true}.Unmarshal(js, p)) + // } else { + // err = protojson.Unmarshal(js, p) + // } + + err = protojson.Unmarshal(js, p) + if err != nil { + return err + } + return nil +} + +func protoToStruct(p proto.Message) (*structpb.Struct, error) { + js, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(p) + if err != nil { + return nil, err + } + st := &structpb.Struct{} + if err := protojson.Unmarshal(js, st); err != nil { + return nil, err + } + return st, nil +} diff --git a/internal/types/subtypes/attributes.go b/internal/types/subtypes/attributes.go index 95ab53c69..7b3ad12d0 100644 --- a/internal/types/subtypes/attributes.go +++ b/internal/types/subtypes/attributes.go @@ -9,6 +9,7 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/known/structpb" ) const ( @@ -16,13 +17,13 @@ const ( ) func init() { - globalAttributeKeys = attributeKeys{ + globalAttributeRegistry = attributeRegistry{ m: make(map[protoreflect.FullName]fieldMap), } protoregistry.GlobalTypes.RangeMessages(func(m protoreflect.MessageType) bool { d := m.Descriptor() - if err := globalAttributeKeys.register(d); err != nil { + if err := globalAttributeRegistry.register(d); err != nil { panic(err) } return true @@ -31,20 +32,21 @@ func init() { type fieldMap map[Subtype]protoreflect.FieldDescriptor -type attributeKeys struct { +type attributeRegistry struct { sync.RWMutex m map[protoreflect.FullName]fieldMap } -var globalAttributeKeys attributeKeys +var globalAttributeRegistry attributeRegistry // register examines the given protobuf MessageDescriptor for fields that have // the Subtype protobuf extension. It uses these to build a fieldMap of subtype // strings to the protobuf FieldDescriptors. If the message does not have any // subtypes it will not be registered, but no error is returned, allowing this // to be called on any protobuf message. However, if a message has subtypes but -// does not provide a field with a subtype of "default" an error is returned. -func (ak attributeKeys) register(d protoreflect.MessageDescriptor) error { +// does not provide a field with a subtype of "default", or if the default +// field is not a *structpb.Struct type, an error is returned. +func (ak attributeRegistry) register(d protoreflect.MessageDescriptor) error { ak.Lock() defer ak.Unlock() @@ -77,19 +79,24 @@ func (ak attributeKeys) register(d protoreflect.MessageDescriptor) error { } // If a message has subtypes, it must provide a "default" to support plugins. - if _, ok := km[defaultSubtype]; !ok { + defSubtype, ok := km[defaultSubtype] + if !ok { return fmt.Errorf("proto message %s with subtype attributes but no 'default'", fn) } + if defSubtype.Message().FullName() != (&structpb.Struct{}).ProtoReflect().Descriptor().FullName() { + return fmt.Errorf("proto message %s with 'default' subtype attributes that is not structpb.Struct", fn) + } + ak.m[fn] = km return nil } -// protoAttributeField retrieves the FieldDescriptor for a given subtype's +// attributeField retrieves the FieldDescriptor for a given subtype's // attribute fields. If the corresponding protobuf message has not been // registered it will return an error. -func (ak attributeKeys) protoAttributeField(d protoreflect.MessageDescriptor, t Subtype) (protoreflect.FieldDescriptor, error) { +func (ak attributeRegistry) attributeField(d protoreflect.MessageDescriptor, t Subtype) (protoreflect.FieldDescriptor, error) { ak.RLock() defer ak.RUnlock() @@ -112,13 +119,8 @@ func (ak attributeKeys) protoAttributeField(d protoreflect.MessageDescriptor, t return tt, nil } -// TODO: fix doc -// protoAttributeField is used by the attrMarshaler to translate between JSON -// formats for the API and for the protobuf messages. It expects a -// proto.Message with a OneOf field for the subtype attributes and the subtype -// string. It returns the string for the JSON key that that should be used for -// the subtype's attributes fields. -func protoAttributeField(msg proto.Message, t Subtype) (protoreflect.FieldDescriptor, error) { - d := msg.ProtoReflect().Descriptor() - return globalAttributeKeys.protoAttributeField(d, t) +// attributeField is used by the AttributeTransformInterceptor to retrieve +// the proto FieldDescriptor for a given subtype. +func attributeField(d protoreflect.MessageDescriptor, t Subtype) (protoreflect.FieldDescriptor, error) { + return globalAttributeRegistry.attributeField(d, t) } diff --git a/internal/types/subtypes/attributes_test.go b/internal/types/subtypes/attributes_test.go index cd39577ad..842a7c584 100644 --- a/internal/types/subtypes/attributes_test.go +++ b/internal/types/subtypes/attributes_test.go @@ -39,7 +39,7 @@ func TestProtoAttributeKey(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - k, err := protoAttributeField(tc.msg, tc.subtype) + k, err := attributeField(tc.msg.ProtoReflect().Descriptor(), tc.subtype) require.NoError(t, err) assert.Equal(t, tc.expected, k.FullName()) }) @@ -76,7 +76,7 @@ func TestProtoAttributeKeyErrors(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - _, err := protoAttributeField(tc.msg, tc.subtype) + _, err := attributeField(tc.msg.ProtoReflect().Descriptor(), tc.subtype) require.EqualError(t, err, tc.expectedErr) }) } @@ -97,14 +97,14 @@ func TestRegisterErrors(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - err := globalAttributeKeys.register(tc.msg.ProtoReflect().Descriptor()) + err := globalAttributeRegistry.register(tc.msg.ProtoReflect().Descriptor()) require.EqualError(t, err, tc.expectedErr) }) } } func TestRegisterNoSubtypes(t *testing.T) { - ak := attributeKeys{ + ak := attributeRegistry{ m: make(map[protoreflect.FullName]fieldMap), } diff --git a/internal/types/subtypes/interceptor.go b/internal/types/subtypes/interceptor.go new file mode 100644 index 000000000..ea4b1aad8 --- /dev/null +++ b/internal/types/subtypes/interceptor.go @@ -0,0 +1,308 @@ +package subtypes + +import ( + "context" + + "github.com/hashicorp/boundary/internal/servers/controller/handlers" + "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" +) + +func messageDomain(m proto.Message) string { + r := m.ProtoReflect() + fd := r.Descriptor().ParentFile() + if fd == nil { + return "" + } + + opts, ok := fd.Options().(*descriptorpb.FileOptions) + if !ok { + return "" + } + + domain := proto.GetExtension(opts, protooptions.E_Domain).(string) + return domain +} + +// transformRequestAttributes will modify the request proto.Message, setting +// any subtype attribute fields into the corresponding strongly-typed struct +// for the subtype. It looks for some specific structure in the proto.Message +// to identify the correct subtype and apply the transformation. +// +// The first structure is a message that contains a single "item" that is a +// message that has a "type" and an "attrs" oneof for attributes: +// +// message CreateFooRequest { +// item Foo = 1; +// } +// message Foo { +// string type = 1; +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } +// +// The second structure is similar to the first, but rather then the type field +// being provided, an id field is set. Note this is a different id from the +// third structure. In this case it is an id for a related resource and the id +// is marked with the "subtype_source_id" custom option: +// +// message CreateFooRequest { +// item Foo = 1; +// } +// message Foo { +// string bar_id = 1 [(custom_options.v1.subtype_source_id) = true]; +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } +// +// The third structure is a message that contains an id string and an "item" +// that is a message that has an "attrs" oneof for attributes: +// +// message UpdateFooRequest { +// string id = 1; +// item Foo = 2; +// } +// message Foo { +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } +// +// The forth structure is a message that contains an id string and an "attrs" oneof for +// attributes: +// +// message FooActionRequest { +// string id = 1; +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } +// +// Also note that for any of the id based lookups to function, the file that contains +// the proto.Message definition must set the "domain" custom option. +func transformRequestAttributes(req proto.Message) (proto.Message, error) { + domain := messageDomain(req) + + r := req.ProtoReflect() + fields := r.Descriptor().Fields() + + itemField := fields.ByName("item") + idField := fields.ByName("id") + attributesField := fields.ByName("attributes") + + fieldValue := func(m protoreflect.Message, fd protoreflect.FieldDescriptor) string { + if fd == nil { + return "" + } + return m.Get(fd).String() + } + + var st Subtype + switch { + case itemField != nil: + itemR := itemField.Message() + if itemR == nil { + return req, nil + } + id := fieldValue(r, idField) + + item := r.Get(itemField).Message().Interface() + itemFields := itemR.Fields() + + typeField := itemFields.ByName("type") + t := fieldValue(item.ProtoReflect(), typeField) + + sourceIdField := sourceIdFieldDescriptor(item.ProtoReflect().Descriptor()) + sourceId := fieldValue(item.ProtoReflect(), sourceIdField) + + switch { + case idField != nil && id != "": + st = SubtypeFromId(domain, id) + case sourceIdField != nil && sourceId != "": + st = SubtypeFromId(domain, sourceId) + case typeField != nil && t != "": + st = Subtype(t) + default: // need either type or id + return req, nil + } + if err := convertAttributesToSubtype(item, st); err != nil { + return req, err + } + case idField != nil && attributesField != nil: + id := r.Get(idField).String() + st = SubtypeFromId(domain, id) + if err := convertAttributesToSubtype(req, st); err != nil { + return req, err + } + } + return req, nil +} + +func transformResponseItemAttributes(item proto.Message) error { + r := item.ProtoReflect() + desc := r.Descriptor() + + typeField := desc.Fields().ByName("type") + if typeField == nil { + // not an item with subtypes + return nil + } + + attrsField := desc.Oneofs().ByName("attrs") + if attrsField == nil { + // not an item with attrs oneof + return nil + } + + if r.WhichOneof(attrsField) == nil { + // attrs field is not set, nothing to do + return nil + } + + st := Subtype(item.ProtoReflect().Get(typeField).String()) + return convertAttributesToDefault(item, st) +} + +// transformResponseAttributes will modify the response proto.Message, setting +// any subtype attribute fields into the default structpb.Struct field. It looks +// for some specific structure in the proto.Message to identify that it is a +// message that needs transformation. +// +// The first structure is a message that contains a single "item" that is a +// message that has an "attrs" oneof for attributes: +// +// message CreateFooResponse { +// item Foo = 1; +// } +// message Foo { +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } +// +// The second structure is a message that contains a single "items" that is a +// slice of item messages that have an "attrs" oneof for attributes: +// +// message ListFooResponse { +// items []Foo = 1; +// } +// message Foo { +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(custom_options.v1.subtype) = "default"]; +// // other subtype attributes types +// } +// } +func transformResponseAttributes(res proto.Message) (proto.Message, error) { + r := res.ProtoReflect() + fields := r.Descriptor().Fields() + + itemField := fields.ByName("item") + itemsField := fields.ByName("items") + switch { + case itemField != nil: + if itemR := itemField.Message(); itemR == nil { + return res, nil + } + + item := r.Get(itemField).Message().Interface() + if err := transformResponseItemAttributes(item); err != nil { + return res, err + } + case itemsField != nil: + if !itemsField.IsList() { + return res, nil + } + items := r.Get(itemsField).List() + + for i := 0; i < items.Len(); i++ { + item := items.Get(i).Message().Interface() + if err := transformResponseItemAttributes(item); err != nil { + return res, err + } + } + } + return res, nil +} + +// AttributeTransformerInterceptor is a grpc server interceptor that will +// transform subtype attributes for requests and responses. This will only +// modify requests and responses that adhere to a specific structure and is done +// to support the use of a oneof for attributes to strongly type the attributes +// while allowing the JSON API to provide attributes via a single key. +// +// For example with a protobuf message definition like: +// +// message Account { +// string id = 1; +// string type = 2; +// oneof attrs { +// google.protobuf.Struct attributes = 10 [(controller.custom_options.v1.subtype) = "default"]; +// PasswordAttributes password_attributes = 20 [(controller.custom_options.v1.subtype) = "password"]; +// } +// } +// +// message PasswordAttributes { +// string login_name = 1; +// } +// +// message AccountCreateRequest { +// Account item = 1; +// } +// +// message AccountCreateResponse { +// Account item = 1; +// } +// +// And a create request with JSON request body like: +// { +// "type": "password", +// "attributes": { +// "login_name": "tim" +// } +// } +// +// Will result in a proto request like: +// +// type:"password" attributes:{fields:{key:"login_name" value:{string_value:"tim"}}} +// +// This request will be transformed into: +// +// type:"password" password_attributes:{login_name:"tim"} +func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerInterceptor { + const op = "subtypes.AttributeTransformInterceptor" + return func(interceptorCtx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { + var err error + if reqMsg, ok := req.(proto.Message); ok { + req, err = transformRequestAttributes(reqMsg) + if err != nil { + return nil, handlers.InvalidArgumentErrorf("Error in provided request.", + map[string]string{"attributes": "Attribute fields do not match the expected format."}) + } + } + + res, handlerErr := handler(interceptorCtx, req) + newRes := res + + if res, ok := res.(proto.Message); ok { + newRes, err = transformResponseAttributes(res) + if err != nil { + return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building attribute struct: %v", err) + } + } + return newRes, handlerErr + } +} diff --git a/internal/types/subtypes/interceptor_ext_test.go b/internal/types/subtypes/interceptor_ext_test.go new file mode 100644 index 000000000..4d1d18dab --- /dev/null +++ b/internal/types/subtypes/interceptor_ext_test.go @@ -0,0 +1,355 @@ +package subtypes_test + +import ( + "context" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/boundary/internal/gen/testing/attribute" + "github.com/hashicorp/boundary/internal/servers/controller/handlers" + "github.com/hashicorp/boundary/internal/types/subtypes" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/structpb" +) + +func TestAttributeTransformerInterceptor(t *testing.T) { + cases := []struct { + name string + req interface{} + handlerResp interface{} + expectHandlerReq interface{} + excpetResp interface{} + }{ + { + "TestCreateResource/SubResourceRequest", + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestCreateResource/SubResourceRequest/OtherId", + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + OtherId: "trsr_parent", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + OtherId: "trsr_parent", + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + OtherId: "trsr_parent", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + OtherId: "trsr_parent", + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestUpdateResource/SubResourceRequest", + &attribute.TestUpdateResourceRequest{ + Id: "trsr_one", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestUpdateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestUpdateResourceRequest{ + Id: "trsr_one", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestUpdateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestNoItemAttributes/SubResourceRequest", + &attribute.TestNoItemAttributes{ + Id: "trsr_one", + Attrs: &attribute.TestNoItemAttributes_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestNoItemAttributes{ + Id: "trsr_one", + Attrs: &attribute.TestNoItemAttributes_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestNoItemAttributes{ + Id: "trsr_one", + Attrs: &attribute.TestNoItemAttributes_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + &attribute.TestNoItemAttributes{ + Id: "trsr_one", + Attrs: &attribute.TestNoItemAttributes_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + { + "TestListResourceResponse", + nil, + &attribute.TestListResourceResponse{ + Items: []*attribute.TestResource{ + { + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + { + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + { + Type: "unknown", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + nil, + &attribute.TestListResourceResponse{ + Items: []*attribute.TestResource{ + { + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + { + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + { + Type: "unknown", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + ctx := context.Background() + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + require.Empty(t, cmp.Diff(req, tc.expectHandlerReq, protocmp.Transform())) + return tc.handlerResp, nil + } + + got, err := subtypes.AttributeTransformerInterceptor(ctx)(ctx, tc.req, nil, handler) + require.NoError(t, err) + require.Empty(t, cmp.Diff(got, tc.excpetResp, protocmp.Transform())) + }) + } +} + +func TestAttributeTransformerInterceptorRequestErrors(t *testing.T) { + cases := []struct { + name string + req interface{} + want error + }{ + { + "InvalidAttributes", + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "foo": "test", + }) + return attrs + }(), + }, + }, + }, + handlers.InvalidArgumentErrorf("Error in provided request.", + map[string]string{"attributes": "Attribute fields do not match the expected format."}), + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + ctx := context.Background() + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + t.Fatalf("handler should not be called") + return nil, nil + } + + _, err := subtypes.AttributeTransformerInterceptor(ctx)(ctx, tc.req, nil, handler) + require.Error(t, err) + require.ErrorIs(t, err, tc.want) + }) + } +} diff --git a/internal/types/subtypes/interceptor_test.go b/internal/types/subtypes/interceptor_test.go new file mode 100644 index 000000000..3a1585321 --- /dev/null +++ b/internal/types/subtypes/interceptor_test.go @@ -0,0 +1,590 @@ +package subtypes + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/boundary/internal/gen/testing/attribute" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/structpb" +) + +func init() { + Register("test", Subtype("sub_resource"), "trsr") + Register("test", Subtype("resource_plugin"), "trrp") +} + +func TestTransformRequestAttributes(t *testing.T) { + cases := []struct { + name string + req proto.Message + expected proto.Message + }{ + { + "TestCreateResource/SubResourceRequest", + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + }, + { + "TestCreateResource/DefaultResourceRequest", + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestCreateResource/UnknownResourceRequest", + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "unknown", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestCreateResourceRequest{ + Item: &attribute.TestResource{ + Type: "unknown", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestUpdateResource/SubResourceRequest", + &attribute.TestUpdateResourceRequest{ + Id: "trsr_one", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestUpdateResourceRequest{ + Id: "trsr_one", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + }, + { + "TestUpdateResource/PluginResourceRequest", + &attribute.TestUpdateResourceRequest{ + Id: "trdp_one", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestUpdateResourceRequest{ + Id: "trdp_one", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestUpdateResource/UnknownResourceRequest", + &attribute.TestUpdateResourceRequest{ + Id: "unknown", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestUpdateResourceRequest{ + Id: "unknown", + Item: &attribute.TestResource{ + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestRequestNoItem", + &attribute.TestRequestNoItem{ + Name: "test", + }, + &attribute.TestRequestNoItem{ + Name: "test", + }, + }, + { + "TestRequestItemNotMessage", + &attribute.TestRequestItemNotMessage{ + Item: "test", + }, + &attribute.TestRequestItemNotMessage{ + Item: "test", + }, + }, + { + "TestRequestItemNoType", + &attribute.TestRequestItemNoType{ + Item: &attribute.TestItemNoType{ + Id: "test", + }, + }, + &attribute.TestRequestItemNoType{ + Item: &attribute.TestItemNoType{ + Id: "test", + }, + }, + }, + { + "TestNoItemAttributes/SubResourceRequest", + &attribute.TestNoItemAttributes{ + Id: "trsr_one", + Attrs: &attribute.TestNoItemAttributes_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestNoItemAttributes{ + Id: "trsr_one", + Attrs: &attribute.TestNoItemAttributes_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + { + "TestCreateNoOneOfRequest", + &attribute.TestCreateNoOneOfRequest{ + Item: &attribute.TestNoOneOf{ + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestCreateNoOneOfRequest{ + Item: &attribute.TestNoOneOf{ + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + { + "TestUpdateNoOneOfRequest", + &attribute.TestUpdateNoOneOfRequest{ + Id: "trsr_one", + Item: &attribute.TestNoOneOf{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestUpdateNoOneOfRequest{ + Id: "trsr_one", + Item: &attribute.TestNoOneOf{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + got, err := transformRequestAttributes(tc.req) + require.NoError(t, err) + assert.Empty(t, cmp.Diff(got, tc.expected, protocmp.Transform())) + }) + } +} + +func TestTransformResponseAttributes(t *testing.T) { + cases := []struct { + name string + resp proto.Message + expected proto.Message + }{ + { + "TestListResourceResponse", + &attribute.TestListResourceResponse{ + Items: []*attribute.TestResource{ + { + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + { + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + &attribute.TestListResourceResponse{ + Items: []*attribute.TestResource{ + { + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + { + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + }, + { + "TestGetResourceResponse/SubResourceAttributes", + &attribute.TestGetResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestGetResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestGetResourceResponse/PluginAttributes", + &attribute.TestGetResourceResponse{ + Item: &attribute.TestResource{ + Id: "trrp_one", + Type: "plugin", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + &attribute.TestGetResourceResponse{ + Item: &attribute.TestResource{ + Id: "trrp_one", + Type: "plugin", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestCreateResourceResponse", + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestUpdateResourceResponse", + &attribute.TestUpdateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + }, + &attribute.TestUpdateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + }, + { + "TestResponseNoItem", + &attribute.TestResponseNoItem{ + Name: "test", + }, + &attribute.TestResponseNoItem{ + Name: "test", + }, + }, + { + "TestResponseItemNotMessage", + &attribute.TestResponseItemNotMessage{ + Item: "test", + }, + &attribute.TestResponseItemNotMessage{ + Item: "test", + }, + }, + { + "TestResponseItemNoType", + &attribute.TestResponseItemNoType{ + Item: &attribute.TestItemNoType{ + Id: "test", + }, + }, + &attribute.TestResponseItemNoType{ + Item: &attribute.TestItemNoType{ + Id: "test", + }, + }, + }, + { + "TestCreateNoOneOfResponse", + &attribute.TestCreateNoOneOfResponse{ + Item: &attribute.TestNoOneOf{ + Id: "trsr_one", + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestCreateNoOneOfResponse{ + Item: &attribute.TestNoOneOf{ + Id: "trsr_one", + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + { + "TestUpdateNoOneOfResponse", + &attribute.TestUpdateNoOneOfResponse{ + Item: &attribute.TestNoOneOf{ + Id: "trsr_one", + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + &attribute.TestUpdateNoOneOfResponse{ + Item: &attribute.TestNoOneOf{ + Id: "trsr_one", + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + }, + { + "TestCreateResourceOneofUnset", + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + }, + }, + &attribute.TestCreateResourceResponse{ + Item: &attribute.TestResource{ + Id: "trsr_one", + Type: "sub_resource", + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + got, err := transformResponseAttributes(tc.resp) + require.NoError(t, err) + assert.Empty(t, cmp.Diff(got, tc.expected, protocmp.Transform())) + }) + } +} diff --git a/internal/types/subtypes/source_registry.go b/internal/types/subtypes/source_registry.go new file mode 100644 index 000000000..d0bfb5f1e --- /dev/null +++ b/internal/types/subtypes/source_registry.go @@ -0,0 +1,73 @@ +package subtypes + +import ( + "fmt" + "sync" + + "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/descriptorpb" +) + +func init() { + globalSourceRegistry = sourceRegistry{ + m: make(map[protoreflect.FullName]protoreflect.FieldDescriptor), + } + + protoregistry.GlobalTypes.RangeMessages(func(m protoreflect.MessageType) bool { + d := m.Descriptor() + if err := globalSourceRegistry.register(d); err != nil { + panic(err) + } + return true + }) +} + +var globalSourceRegistry sourceRegistry + +// sourceRegistry is collection of proto messages with a corresponding +// field descriptor that can be used to determine the Subtype for the message. +type sourceRegistry struct { + sync.RWMutex + + m map[protoreflect.FullName]protoreflect.FieldDescriptor +} + +func (s sourceRegistry) register(d protoreflect.MessageDescriptor) error { + s.Lock() + defer s.Unlock() + + fn := d.FullName() + + if _, present := s.m[fn]; present { + return fmt.Errorf("proto message %s already registered", fn) + } + + fields := d.Fields() + for i := 0; i < fields.Len(); i++ { + f := fields.Get(i) + + opts := f.Options().(*descriptorpb.FieldOptions) + isSourceId := proto.GetExtension(opts, protooptions.E_SubtypeSourceId).(bool) + if isSourceId { + s.m[fn] = f + } + } + return nil +} + +func (s sourceRegistry) get(d protoreflect.MessageDescriptor) protoreflect.FieldDescriptor { + s.RLock() + defer s.RUnlock() + + return s.m[d.FullName()] +} + +// sourceIdFieldDescriptor is used by the AttributeTransformInterceptor to retrieve +// a proto FieldDescriptor of an id field that can be used to determine +// the given Message's subtype. +func sourceIdFieldDescriptor(d protoreflect.MessageDescriptor) protoreflect.FieldDescriptor { + return globalSourceRegistry.get(d) +} From 3d58ce5f5c2458c030495279e452c98ece8cf672 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Mon, 4 Apr 2022 11:50:43 -0400 Subject: [PATCH 12/45] feat(subtypes): Add function to convert protobuf for filtering This will transform a protobuf message with a oneof for attributes into the API format to support filtering for list endpoints. --- .../types/subtypes/attribute_transform.go | 56 ++++++++++ .../subtypes/attribute_transform_test.go | 104 ++++++++++++++++++ internal/types/subtypes/attributes.go | 4 +- internal/types/subtypes/source_registry.go | 4 +- 4 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 internal/types/subtypes/attribute_transform_test.go diff --git a/internal/types/subtypes/attribute_transform.go b/internal/types/subtypes/attribute_transform.go index 9c59509dd..ab4793047 100644 --- a/internal/types/subtypes/attribute_transform.go +++ b/internal/types/subtypes/attribute_transform.go @@ -130,3 +130,59 @@ func protoToStruct(p proto.Message) (*structpb.Struct, error) { } return st, nil } + +// Filterable converts a proto.Message so any subtype attributes fields are +// structed like the API so filter strings will be correctly applied. If the +// given proto.Message does not have any subtype attributes, the original +// proto.Message is returned. To determine if the message needs +// transformation, it looks for a oneof field named "attrs". It also expects +// that there is a structpb.Struct field named "attributes" as part of the +// oneof. Thus the message must be like: +// +// message Foo { +// // other fields +// oneof attrs { +// google.protobuf.Struct attributes = 100; +// // other attribute fields +// } +// } +// +// If the message does not conform to this structure, +// the original message is returned. +func Filterable(item proto.Message) (proto.Message, error) { + clone := proto.Clone(item) + r := clone.ProtoReflect() + + attrsField := r.Descriptor().Oneofs().ByName("attrs") + if attrsField == nil { + return item, nil + } + + defaultAttrField := attrsField.Fields().ByName("attributes") + if defaultAttrField == nil { + return item, nil + } + + var attr proto.Message + var pbAttrs proto.Message + var err error + + oneofField := r.WhichOneof(attrsField) + if oneofField == nil { + // attrs field is not set, nothing to do + return item, nil + } + + attr = r.Get(oneofField).Message().Interface() + pbAttrs, err = protoToStruct(attr) + if err != nil { + return nil, err + } + + r.Set(defaultAttrField, protoreflect.ValueOfMessage(pbAttrs.ProtoReflect())) + f, err := protoToStruct(r.Interface()) + if err != nil { + return nil, err + } + return f, nil +} diff --git a/internal/types/subtypes/attribute_transform_test.go b/internal/types/subtypes/attribute_transform_test.go new file mode 100644 index 000000000..b9aa5dafa --- /dev/null +++ b/internal/types/subtypes/attribute_transform_test.go @@ -0,0 +1,104 @@ +package subtypes + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/boundary/internal/gen/testing/attribute" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/structpb" +) + +func TestFilterable(t *testing.T) { + cases := []struct { + name string + item proto.Message + want proto.Message + }{ + { + "TestResource/sub_resource", + &attribute.TestResource{ + Type: "sub_resource", + Attrs: &attribute.TestResource_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + }, + func() *structpb.Struct { + w, _ := structpb.NewStruct(map[string]interface{}{ + "type": "sub_resource", + "attributes": map[string]interface{}{ + "name": "test", + }, + }) + return w + }(), + }, + { + "TestResource/default", + &attribute.TestResource{ + Type: "default", + Attrs: &attribute.TestResource_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + func() *structpb.Struct { + w, _ := structpb.NewStruct(map[string]interface{}{ + "type": "default", + "attributes": map[string]interface{}{ + "name": "test", + }, + }) + return w + }(), + }, + { + "TestNoOneOf", + &attribute.TestNoOneOf{ + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + &attribute.TestNoOneOf{ + Type: "sub_resource", + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + }, + { + "TestNoAttributes", + &attribute.TestNoAttributes{ + Id: "test", + Type: "no_attr", + }, + &attribute.TestNoAttributes{ + Id: "test", + Type: "no_attr", + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + got, err := Filterable(tc.item) + require.NoError(t, err) + require.Empty(t, cmp.Diff(got, tc.want, protocmp.Transform())) + }) + } +} diff --git a/internal/types/subtypes/attributes.go b/internal/types/subtypes/attributes.go index 7b3ad12d0..135d7c373 100644 --- a/internal/types/subtypes/attributes.go +++ b/internal/types/subtypes/attributes.go @@ -46,7 +46,7 @@ var globalAttributeRegistry attributeRegistry // to be called on any protobuf message. However, if a message has subtypes but // does not provide a field with a subtype of "default", or if the default // field is not a *structpb.Struct type, an error is returned. -func (ak attributeRegistry) register(d protoreflect.MessageDescriptor) error { +func (ak *attributeRegistry) register(d protoreflect.MessageDescriptor) error { ak.Lock() defer ak.Unlock() @@ -96,7 +96,7 @@ func (ak attributeRegistry) register(d protoreflect.MessageDescriptor) error { // attributeField retrieves the FieldDescriptor for a given subtype's // attribute fields. If the corresponding protobuf message has not been // registered it will return an error. -func (ak attributeRegistry) attributeField(d protoreflect.MessageDescriptor, t Subtype) (protoreflect.FieldDescriptor, error) { +func (ak *attributeRegistry) attributeField(d protoreflect.MessageDescriptor, t Subtype) (protoreflect.FieldDescriptor, error) { ak.RLock() defer ak.RUnlock() diff --git a/internal/types/subtypes/source_registry.go b/internal/types/subtypes/source_registry.go index d0bfb5f1e..dc3e0575f 100644 --- a/internal/types/subtypes/source_registry.go +++ b/internal/types/subtypes/source_registry.go @@ -35,7 +35,7 @@ type sourceRegistry struct { m map[protoreflect.FullName]protoreflect.FieldDescriptor } -func (s sourceRegistry) register(d protoreflect.MessageDescriptor) error { +func (s *sourceRegistry) register(d protoreflect.MessageDescriptor) error { s.Lock() defer s.Unlock() @@ -58,7 +58,7 @@ func (s sourceRegistry) register(d protoreflect.MessageDescriptor) error { return nil } -func (s sourceRegistry) get(d protoreflect.MessageDescriptor) protoreflect.FieldDescriptor { +func (s *sourceRegistry) get(d protoreflect.MessageDescriptor) protoreflect.FieldDescriptor { s.RLock() defer s.RUnlock() From 349e32afe4030faea56dd59d1e17d99bc621dabf Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Mon, 4 Apr 2022 11:52:26 -0400 Subject: [PATCH 13/45] feat(account): Use new filterable function to support filtering --- .../servers/controller/handlers/accounts/account_service.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/servers/controller/handlers/accounts/account_service.go b/internal/servers/controller/handlers/accounts/account_service.go index b842aeba3..6336200a2 100644 --- a/internal/servers/controller/handlers/accounts/account_service.go +++ b/internal/servers/controller/handlers/accounts/account_service.go @@ -168,7 +168,11 @@ func (s Service) ListAccounts(ctx context.Context, req *pbs.ListAccountsRequest) // This comes last so that we can use item fields in the filter after // the allowed fields are populated above - if filter.Match(item) { + filterable, err := subtypes.Filterable(item) + if err != nil { + return nil, err + } + if filter.Match(filterable) { finalItems = append(finalItems, item) } } From cc7e7429ab92f74ed594e42e2f5c59c38ae5874a Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 31 Mar 2022 12:45:29 -0400 Subject: [PATCH 14/45] feat(account): Add domain file option --- .../controller/api/resources/accounts/v1/account.proto | 2 ++ sdk/pbs/controller/api/resources/accounts/account.pb.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/proto/controller/api/resources/accounts/v1/account.proto b/internal/proto/controller/api/resources/accounts/v1/account.proto index 19110244e..ea8fc12ea 100644 --- a/internal/proto/controller/api/resources/accounts/v1/account.proto +++ b/internal/proto/controller/api/resources/accounts/v1/account.proto @@ -11,6 +11,8 @@ import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; +option (custom_options.v1.domain) = "auth"; + // Account contains all fields related to an Account resource message Account { // Output only. The ID of the Account. diff --git a/sdk/pbs/controller/api/resources/accounts/account.pb.go b/sdk/pbs/controller/api/resources/accounts/account.pb.go index eb675fa68..3d39777b9 100644 --- a/sdk/pbs/controller/api/resources/accounts/account.pb.go +++ b/sdk/pbs/controller/api/resources/accounts/account.pb.go @@ -486,13 +486,13 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, - 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, + 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x5a, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0xa2, 0xe3, + 0x29, 0x04, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From e76c48ad36370eeb4c7e5237cd4652207109bd31 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 1 Apr 2022 08:41:32 -0400 Subject: [PATCH 15/45] feat(account): Mark auth_method_id as a source id for subtypes --- .../api/services/account_service.pb.go | 327 +++++++++--------- .../gen/testing/attribute/attribute.pb.go | 28 +- .../api/resources/accounts/v1/account.proto | 4 +- .../api/services/v1/account_service.proto | 3 + .../testing/attribute/v1/attribute.proto | 0 .../api/resources/accounts/account.pb.go | 136 ++++---- 6 files changed, 252 insertions(+), 246 deletions(-) rename internal/proto/{local => }/testing/attribute/v1/attribute.proto (100%) diff --git a/internal/gen/controller/api/services/account_service.pb.go b/internal/gen/controller/api/services/account_service.pb.go index 87ec7ec05..c715e8f16 100644 --- a/internal/gen/controller/api/services/account_service.pb.go +++ b/internal/gen/controller/api/services/account_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" accounts "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/accounts" + _ "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" @@ -767,176 +768,180 @@ var file_controller_api_services_v1_account_service_proto_rawDesc = []byte{ 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x22, 0x55, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x22, 0x59, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, + 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, 0x23, + 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x55, 0x0a, 0x13, + 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, + 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, - 0x6c, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x02, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa7, 0x01, - 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, + 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x22, 0x59, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x02, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6c, 0x0a, 0x15, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 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, 0x5a, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa7, 0x01, 0x0a, 0x14, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 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, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x5a, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, + 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x17, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 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, 0x17, 0x0a, 0x15, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5a, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x22, 0x58, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x01, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x91, 0x01, 0x0a, 0x15, 0x43, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, - 0x0a, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x65, - 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x5b, - 0x0a, 0x16, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x18, 0x01, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xd9, 0x0a, 0x0a, 0x0e, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7, - 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x47, 0x65, 0x74, 0x41, 0x63, - 0x63, 0x6f, 0x75, 0x6e, 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, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x92, 0x41, - 0x18, 0x12, 0x16, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, - 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, - 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, - 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb9, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, - 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x22, 0x5a, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x58, 0x0a, 0x13, + 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x91, 0x01, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x75, + 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6e, 0x65, + 0x77, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x5b, 0x0a, 0x16, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xd9, 0x0a, 0x0a, 0x0e, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7, 0x01, 0x0a, 0x0a, 0x47, + 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 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, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, - 0x2f, 0x12, 0x2d, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x12, 0xd0, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 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, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 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, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5a, 0x92, 0x41, 0x37, - 0x12, 0x35, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, - 0x6c, 0x65, 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x0c, 0x2f, - 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb3, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 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, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x92, 0x41, 0x18, 0x12, 0x16, 0x47, + 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x11, 0x2f, 0x76, 0x31, + 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb9, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x2f, 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, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x2f, 0x12, 0x2d, 0x4c, + 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, + 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x12, 0xd0, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x30, 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, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5a, 0x92, 0x41, 0x37, 0x12, 0x35, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x12, 0xb3, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 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, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, 0x92, 0x41, 0x15, 0x12, + 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x32, 0x11, 0x2f, 0x76, 0x31, 0x2f, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa7, 0x01, 0x0a, 0x0d, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 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, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, - 0x92, 0x41, 0x15, 0x12, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x32, 0x11, - 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, - 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa7, 0x01, - 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x30, 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, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x92, 0x41, 0x15, 0x12, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x13, 0x2a, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xcf, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 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, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x92, 0x41, 0x2d, 0x12, 0x2b, 0x53, - 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x64, 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, - 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, - 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xdb, 0x01, 0x0a, 0x0e, 0x43, 0x68, - 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x31, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x62, 0x92, 0x41, 0x2d, 0x12, 0x2b, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, - 0x68, 0x65, 0x20, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x22, 0x21, 0x2f, 0x76, 0x31, - 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x63, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x3a, 0x01, - 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 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, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x31, 0x92, 0x41, 0x15, 0x12, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, + 0x6e, 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, + 0x2a, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, + 0x69, 0x64, 0x7d, 0x12, 0xcf, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x12, 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, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x92, 0x41, 0x2d, 0x12, 0x2b, 0x53, 0x65, 0x74, 0x73, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x20, 0x66, 0x6f, 0x72, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, 0x1e, 0x2f, 0x76, + 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, + 0x73, 0x65, 0x74, 0x2d, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x3a, 0x01, 0x2a, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xdb, 0x01, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x62, 0x92, 0x41, 0x2d, 0x12, 0x2b, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x22, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x2d, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 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, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/internal/gen/testing/attribute/attribute.pb.go b/internal/gen/testing/attribute/attribute.pb.go index 21562e13c..da0a789aa 100644 --- a/internal/gen/testing/attribute/attribute.pb.go +++ b/internal/gen/testing/attribute/attribute.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.17.3 +// protoc (unknown) // source: testing/attribute/v1/attribute.proto package attribute @@ -1451,9 +1451,9 @@ var file_testing_attribute_v1_attribute_proto_rawDesc = []byte{ 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, - 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x92, 0x41, - 0x0b, 0x12, 0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x12, 0xaf, 0x01, 0x0a, + 0x73, 0x65, 0x22, 0x28, 0x92, 0x41, 0x0b, 0x12, 0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x6c, 0x69, + 0x73, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, + 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0xaf, 0x01, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, @@ -1461,10 +1461,10 @@ var file_testing_attribute_v1_attribute_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x12, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x92, 0x41, 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, + 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, - 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0xb4, + 0x65, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb4, 0x01, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, @@ -1472,21 +1472,21 @@ var file_testing_attribute_v1_attribute_proto_rawDesc = []byte{ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x0d, 0x12, 0x0b, 0x54, + 0x65, 0x73, 0x74, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0xa2, 0x01, 0x0a, 0x0f, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa2, 0x01, 0x0a, 0x0f, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x17, - 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x0a, - 0x12, 0x08, 0x54, 0x65, 0x73, 0x74, 0x20, 0x67, 0x65, 0x74, 0x42, 0x50, 0x5a, 0x46, 0x67, 0x69, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x92, 0x41, 0x0a, 0x12, 0x08, 0x54, 0x65, 0x73, + 0x74, 0x20, 0x67, 0x65, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x17, 0x2f, 0x76, 0x31, + 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x42, 0x50, 0x5a, 0x46, 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, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, diff --git a/internal/proto/controller/api/resources/accounts/v1/account.proto b/internal/proto/controller/api/resources/accounts/v1/account.proto index ea8fc12ea..fff5c9220 100644 --- a/internal/proto/controller/api/resources/accounts/v1/account.proto +++ b/internal/proto/controller/api/resources/accounts/v1/account.proto @@ -11,8 +11,6 @@ import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; -option (custom_options.v1.domain) = "auth"; - // Account contains all fields related to an Account resource message Account { // Output only. The ID of the Account. @@ -41,7 +39,7 @@ message Account { string type = 80; // @gotags: `class:"public"` // The ID of the Auth Method that is associated with this Account. - string auth_method_id = 90 [json_name="auth_method_id"]; // @gotags: `class:"public"` + string auth_method_id = 90 [json_name="auth_method_id", (custom_options.v1.subtype_source_id) = true]; // @gotags: `class:"public"` oneof attrs { // The attributes that are applicable for the specific Account type. diff --git a/internal/proto/controller/api/services/v1/account_service.proto b/internal/proto/controller/api/services/v1/account_service.proto index 56adfb1ab..09995e8fe 100644 --- a/internal/proto/controller/api/services/v1/account_service.proto +++ b/internal/proto/controller/api/services/v1/account_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/accounts/v1/account.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "auth"; service AccountService { diff --git a/internal/proto/local/testing/attribute/v1/attribute.proto b/internal/proto/testing/attribute/v1/attribute.proto similarity index 100% rename from internal/proto/local/testing/attribute/v1/attribute.proto rename to internal/proto/testing/attribute/v1/attribute.proto diff --git a/sdk/pbs/controller/api/resources/accounts/account.pb.go b/sdk/pbs/controller/api/resources/accounts/account.pb.go index 3d39777b9..3e1ff1567 100644 --- a/sdk/pbs/controller/api/resources/accounts/account.pb.go +++ b/sdk/pbs/controller/api/resources/accounts/account.pb.go @@ -398,7 +398,7 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 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, 0xd0, 0x07, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, + 0x74, 0x6f, 0x22, 0xd6, 0x07, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, @@ -425,74 +425,74 @@ var file_controller_api_resources_accounts_v1_account_proto_rawDesc = []byte{ 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, 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, + 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, - 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x42, 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, 0xa3, 0x01, 0x0a, 0x1b, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x20, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, - 0x29, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, - 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x19, 0x70, 0x61, - 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x93, 0x01, 0x0a, 0x17, 0x6f, 0x69, 0x64, 0x63, - 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1c, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x04, - 0x6f, 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, - 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x15, 0x6f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, - 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, - 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, - 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, - 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6c, 0x6f, - 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, - 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x14, 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, - 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, - 0x88, 0x02, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x06, 0x69, 0x73, 0x73, - 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, - 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x75, 0x6c, 0x6c, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x6e, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3a, 0x0a, 0x0c, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x69, - 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, - 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x42, 0x5a, 0x5a, 0x50, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, - 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, - 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0xa2, 0xe3, - 0x29, 0x04, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xe3, 0x29, 0x01, 0x52, 0x0e, 0x61, 0x75, 0x74, + 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0xa3, 0x01, 0x0a, 0x1b, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x20, + 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, + 0x48, 0x00, 0x52, 0x19, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x93, 0x01, + 0x0a, 0x17, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3b, 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, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1c, 0xa0, 0xda, + 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x04, 0x6f, 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, + 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x15, 0x6f, 0x69, + 0x64, 0x63, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, + 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x19, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, + 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2a, 0xa0, + 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x22, 0x0a, 0x15, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x2e, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x09, + 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x14, 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, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x88, 0x02, 0x0a, 0x15, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x1c, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1e, 0x0a, + 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, + 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x12, 0x3a, 0x0a, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, + 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x52, 0x0b, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x12, 0x41, 0x0a, + 0x0f, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, + 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, + 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, + 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, + 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3b, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 64ef193cfcc5688d5963e4938cf9988b5dffd1fa Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 1 Apr 2022 08:53:09 -0400 Subject: [PATCH 16/45] test(account): Fix parallel validation tests --- internal/servers/controller/handlers/accounts/validate_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/servers/controller/handlers/accounts/validate_test.go b/internal/servers/controller/handlers/accounts/validate_test.go index cca7a580a..e4190d6fb 100644 --- a/internal/servers/controller/handlers/accounts/validate_test.go +++ b/internal/servers/controller/handlers/accounts/validate_test.go @@ -111,6 +111,7 @@ func TestValidateCreateRequest(t *testing.T) { }, } for _, tc := range cases { + tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() req := &pbs.CreateAccountRequest{Item: tc.item} @@ -174,6 +175,7 @@ func TestValidateUpdateRequest(t *testing.T) { }, } for _, tc := range cases { + tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() err := validateUpdateRequest(tc.req) From 0fc5cd5a3372a3819b9282f97996d330b8d29d61 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 1 Apr 2022 08:57:21 -0400 Subject: [PATCH 17/45] test(account): Use require to prevent panic on test failure If these assertions failed, then next assersions would result in a panic when accessing the slice. --- internal/tests/api/accounts/account_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/tests/api/accounts/account_test.go b/internal/tests/api/accounts/account_test.go index ee84c2704..671d0af8c 100644 --- a/internal/tests/api/accounts/account_test.go +++ b/internal/tests/api/accounts/account_test.go @@ -63,7 +63,7 @@ func TestListPassword(t *testing.T) { ulResult, err = accountClient.List(tc.Context(), am.Id, accounts.WithFilter(fmt.Sprintf(`"/item/attributes/login_name"==%q`, filterItem.Attributes["login_name"]))) require.NoError(err) - assert.Len(ulResult.Items, 1) + require.Len(ulResult.Items, 1) assert.Equal(filterItem.Id, ulResult.Items[0].Id) } @@ -120,7 +120,7 @@ func TestListOidc(t *testing.T) { ulResult, err = accountClient.List(tc.Context(), am.Id, accounts.WithFilter(fmt.Sprintf(`"/item/attributes/subject"==%q`, filterItem.Attributes["subject"]))) require.NoError(err) - assert.Len(ulResult.Items, 1) + require.Len(ulResult.Items, 1) assert.Equal(filterItem.Id, ulResult.Items[0].Id) } From ec25e7682c9f54fd820520c45bee5ed12bd39053 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 8 Apr 2022 09:38:21 -0400 Subject: [PATCH 18/45] fix(controller): Clone messages before auditing (#1982) It is not unreasonable for downstream users of the request and response messages to mutate them, indeed we mutate the response on the way out to get the desired external API. To avoid inconsistent messages being audited, make a copy of the entire message before returning from the interceptor. This was discovered while testing the new subtype transformation interceptor. --- internal/servers/controller/interceptor.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/servers/controller/interceptor.go b/internal/servers/controller/interceptor.go index 5fd96e14c..13c8c1413 100644 --- a/internal/servers/controller/interceptor.go +++ b/internal/servers/controller/interceptor.go @@ -241,7 +241,10 @@ func auditRequestInterceptor( handler grpc.UnaryHandler) (interface{}, error, ) { if msg, ok := req.(proto.Message); ok { - if err := event.WriteAudit(interceptorCtx, op, event.WithRequest(&event.Request{Details: msg})); err != nil { + // Clone the request before writing it to the audit log, + // in case downstream interceptors modify it. + clonedMsg := proto.Clone(msg) + if err := event.WriteAudit(interceptorCtx, op, event.WithRequest(&event.Request{Details: clonedMsg})); err != nil { return req, status.Errorf(codes.Internal, "unable to write request msg audit: %s", err) } } @@ -263,7 +266,10 @@ func auditResponseInterceptor( resp, err := handler(interceptorCtx, req) if msg, ok := resp.(proto.Message); ok { - if err := event.WriteAudit(interceptorCtx, op, event.WithResponse(&event.Response{Details: msg})); err != nil { + // Clone the response before writing it to the audit log, + // in case downstream interceptors modify it. + clonedMsg := proto.Clone(msg) + if err := event.WriteAudit(interceptorCtx, op, event.WithResponse(&event.Response{Details: clonedMsg})); err != nil { return req, status.Errorf(codes.Internal, "unable to write response msg audit: %s", err) } } From 53481146fd56ba1524cb0a5a805f39e5acb49ef0 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 8 Apr 2022 11:40:59 -0400 Subject: [PATCH 19/45] feat(authmethods): add well typed attribute options (#1972) Add well typed attribute options to the authmethods proto definitions, while hiding them from being rendered in the openapiv2 spec. --- internal/auth/oidc/ids.go | 3 +- internal/auth/password/public_ids.go | 3 +- internal/auth/subtype.go | 3 + .../api/services/auth_method_service.pb.go | 536 ++++++++------- .../services/auth_method_service_taggable.go | 130 ---- .../authmethods/v1/auth_method.proto | 23 +- .../api/services/v1/auth_method_service.proto | 11 +- .../authmethods/authmethod_service.go | 286 ++++---- .../authmethods/authmethod_service_test.go | 457 ++++++------ .../controller/handlers/authmethods/oidc.go | 6 +- .../handlers/authmethods/oidc_test.go | 650 +++++++++--------- .../handlers/authmethods/password.go | 6 +- .../handlers/authmethods/password_test.go | 97 +-- .../api/authmethods/authenticate_test.go | 8 +- .../tests/api/authmethods/authmethod_test.go | 152 +++- .../api/authmethods/classification_test.go | 97 +-- .../service_classification_test.go} | 42 +- internal/types/subtypes/interceptor.go | 5 +- .../resources/authmethods/auth_method.pb.go | 496 +++++++------ .../authmethods/auth_method_taggable.go | 82 --- 20 files changed, 1544 insertions(+), 1549 deletions(-) delete mode 100644 internal/gen/controller/api/services/auth_method_service_taggable.go rename sdk/pbs/controller/api/resources/authmethods/auth_method_taggable_test.go => internal/tests/api/authmethods/classification_test.go (50%) rename internal/{gen/controller/api/services/auth_method_service_taggable_test.go => tests/api/authmethods/service_classification_test.go} (73%) diff --git a/internal/auth/oidc/ids.go b/internal/auth/oidc/ids.go index 2e0cf18e1..0aeee3e8a 100644 --- a/internal/auth/oidc/ids.go +++ b/internal/auth/oidc/ids.go @@ -3,6 +3,7 @@ package oidc import ( "context" + "github.com/hashicorp/boundary/internal/auth" "github.com/hashicorp/boundary/internal/db" "github.com/hashicorp/boundary/internal/errors" "github.com/hashicorp/boundary/internal/intglobals" @@ -10,7 +11,7 @@ import ( ) func init() { - if err := subtypes.Register("auth", Subtype, AuthMethodPrefix, AccountPrefix, intglobals.OidcManagedGroupPrefix); err != nil { + if err := subtypes.Register(auth.Domain, Subtype, AuthMethodPrefix, AccountPrefix, intglobals.OidcManagedGroupPrefix); err != nil { panic(err) } } diff --git a/internal/auth/password/public_ids.go b/internal/auth/password/public_ids.go index 70e176df0..24f8f9e41 100644 --- a/internal/auth/password/public_ids.go +++ b/internal/auth/password/public_ids.go @@ -1,6 +1,7 @@ package password import ( + "github.com/hashicorp/boundary/internal/auth" "github.com/hashicorp/boundary/internal/db" "github.com/hashicorp/boundary/internal/errors" "github.com/hashicorp/boundary/internal/intglobals" @@ -8,7 +9,7 @@ import ( ) func init() { - if err := subtypes.Register("auth", Subtype, AuthMethodPrefix, intglobals.OldPasswordAccountPrefix, intglobals.NewPasswordAccountPrefix); err != nil { + if err := subtypes.Register(auth.Domain, Subtype, AuthMethodPrefix, intglobals.OldPasswordAccountPrefix, intglobals.NewPasswordAccountPrefix); err != nil { panic(err) } } diff --git a/internal/auth/subtype.go b/internal/auth/subtype.go index 4ecd1e246..10fcd1c44 100644 --- a/internal/auth/subtype.go +++ b/internal/auth/subtype.go @@ -4,6 +4,9 @@ import ( "github.com/hashicorp/boundary/internal/boundary" ) +// Domain defines the domain for the auth package. +const Domain = "auth" + // AuthMethod contains the common methods across all the different types of auth methods. type AuthMethod interface { boundary.Resource diff --git a/internal/gen/controller/api/services/auth_method_service.pb.go b/internal/gen/controller/api/services/auth_method_service.pb.go index e2053593f..06d1dc86b 100644 --- a/internal/gen/controller/api/services/auth_method_service.pb.go +++ b/internal/gen/controller/api/services/auth_method_service.pb.go @@ -9,7 +9,9 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" authmethods "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" + _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" _ "google.golang.org/genproto/googleapis/api/annotations" + _ "google.golang.org/genproto/googleapis/api/visibility" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" @@ -595,8 +597,10 @@ type ChangeStateRequest struct { // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - // The attributes specific to this auth method's state. - Attributes *structpb.Struct `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *ChangeStateRequest_Attributes + // *ChangeStateRequest_OidcChangeStateAttributes + Attrs isChangeStateRequest_Attrs `protobuf_oneof:"attrs"` } func (x *ChangeStateRequest) Reset() { @@ -645,13 +649,44 @@ func (x *ChangeStateRequest) GetVersion() uint32 { return 0 } +func (m *ChangeStateRequest) GetAttrs() isChangeStateRequest_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *ChangeStateRequest) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*ChangeStateRequest_Attributes); ok { return x.Attributes } return nil } +func (x *ChangeStateRequest) GetOidcChangeStateAttributes() *OidcChangeStateAttributes { + if x, ok := x.GetAttrs().(*ChangeStateRequest_OidcChangeStateAttributes); ok { + return x.OidcChangeStateAttributes + } + return nil +} + +type isChangeStateRequest_Attrs interface { + isChangeStateRequest_Attrs() +} + +type ChangeStateRequest_Attributes struct { + // The attributes specific to this auth method's state. + Attributes *structpb.Struct `protobuf:"bytes,4,opt,name=attributes,proto3,oneof"` +} + +type ChangeStateRequest_OidcChangeStateAttributes struct { + OidcChangeStateAttributes *OidcChangeStateAttributes `protobuf:"bytes,5,opt,name=oidc_change_state_attributes,json=oidcChangeStateAttributes,proto3,oneof"` +} + +func (*ChangeStateRequest_Attributes) isChangeStateRequest_Attrs() {} + +func (*ChangeStateRequest_OidcChangeStateAttributes) isChangeStateRequest_Attrs() {} + type ChangeStateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1035,230 +1070,246 @@ var file_controller_api_services_v1_auth_method_service_proto_rawDesc = []byte{ 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x39, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x14, 0x47, - 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6a, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, - 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, - 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 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, 0x64, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x05, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x62, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 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, 0x20, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x39, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 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, 0x26, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x15, + 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, + 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6a, + 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, + 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, + 0x76, 0x65, 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, 0x64, 0x0a, 0x17, 0x4c, 0x69, + 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 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, + 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x22, 0x62, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x47, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x22, 0x75, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x75, 0x0a, 0x18, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0xb0, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb0, 0x01, 0x0a, 0x17, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x63, + 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x22, 0x29, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x47, - 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 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, 0x63, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, - 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x29, 0x0a, 0x17, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, - 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x4f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x52, 0x0a, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x12, 0x43, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x22, 0x5e, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x55, 0x0a, 0x17, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, - 0x67, 0x69, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, - 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x96, 0x01, 0x0a, 0x13, 0x4f, 0x69, - 0x64, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x12, 0x45, 0x0a, 0x11, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x11, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, - 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x61, 0x63, 0x68, - 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x61, 0x63, 0x68, - 0x65, 0x64, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x22, 0x30, 0x0a, 0x13, 0x4f, 0x69, 0x64, 0x63, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x49, 0x64, 0x22, 0xdb, 0x01, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, - 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, - 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x5f, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0a, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4a, - 0x04, 0x08, 0x03, 0x10, 0x04, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x14, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x32, 0x95, 0x0b, 0x0a, 0x11, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb8, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, - 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x30, 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, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x92, - 0x41, 0x1c, 0x12, 0x1a, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, - 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x12, 0xb0, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, - 0x92, 0x41, 0x19, 0x12, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x41, - 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x73, 0x12, 0xc5, 0x01, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, - 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, - 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1a, + 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x4f, + 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x52, + 0x0a, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x24, 0x64, 0x69, + 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0xa4, 0x02, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x18, 0x04, 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, 0x0b, 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, 0x92, 0x01, 0x0a, 0x1c, + 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x4f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x18, 0x9a, 0xe3, 0x29, 0x04, 0x6f, + 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x19, 0x6f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x5e, 0x0a, 0x13, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x1f, 0x12, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x10, - 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, - 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xc4, 0x01, 0x0a, - 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, - 0x19, 0x12, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, - 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, - 0x32, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x12, 0xb6, 0x01, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x55, 0x0a, 0x17, 0x50, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x22, 0x96, 0x01, 0x0a, 0x13, 0x4f, 0x69, 0x64, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x72, 0x6f, 0x75, 0x6e, + 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x11, 0x72, 0x6f, + 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, + 0x38, 0x0a, 0x18, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, + 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x16, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, + 0x69, 0x70, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x30, 0x0a, 0x13, 0x4f, 0x69, 0x64, + 0x63, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x64, 0x22, 0xdb, 0x01, 0x0a, 0x13, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, + 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x02, 0x18, 0x01, 0x52, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x52, 0x0b, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x14, 0x41, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, + 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x32, 0x95, 0x0b, 0x0a, 0x11, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb8, 0x01, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, + 0x30, 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, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x92, 0x41, 0x1c, 0x12, 0x1a, 0x47, 0x65, 0x74, 0x73, 0x20, + 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x15, 0x2f, 0x76, 0x31, + 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, + 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb0, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, + 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x32, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x92, 0x41, 0x19, 0x12, 0x17, 0x4c, 0x69, 0x73, 0x74, + 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0xc5, 0x01, 0x0a, 0x10, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x1f, + 0x12, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x12, 0xc4, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x37, 0x92, 0x41, 0x17, 0x12, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xcf, 0x01, 0x0a, - 0x0b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 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, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x92, - 0x41, 0x29, 0x12, 0x27, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x4f, 0x49, 0x44, 0x43, - 0x20, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x2d, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xf7, - 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, - 0x2f, 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, 0x41, 0x75, 0x74, - 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x30, 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, 0x41, 0x75, - 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x83, 0x01, 0x92, 0x41, 0x47, 0x12, 0x45, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, - 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x74, 0x6f, - 0x20, 0x61, 0x6e, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, - 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, - 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x22, 0x2e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, - 0x69, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 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, + 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, 0x19, 0x12, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x32, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb6, 0x01, 0x0a, 0x10, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, + 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x92, 0x41, 0x17, 0x12, + 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x76, + 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, + 0x69, 0x64, 0x7d, 0x12, 0xcf, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 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, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x92, 0x41, 0x29, 0x12, 0x27, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x20, + 0x61, 0x6e, 0x20, 0x4f, 0x49, 0x44, 0x43, 0x20, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xf7, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, + 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x2f, 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, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, 0x01, 0x92, 0x41, 0x47, 0x12, + 0x45, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x61, 0x6e, + 0x20, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x22, 0x2e, 0x2f, 0x76, + 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x7d, 0x3a, + 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 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, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1306,29 +1357,30 @@ var file_controller_api_services_v1_auth_method_service_proto_depIdxs = []int32{ 19, // 5: controller.api.services.v1.UpdateAuthMethodRequest.update_mask:type_name -> google.protobuf.FieldMask 18, // 6: controller.api.services.v1.UpdateAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod 20, // 7: controller.api.services.v1.ChangeStateRequest.attributes:type_name -> google.protobuf.Struct - 18, // 8: controller.api.services.v1.ChangeStateResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 20, // 9: controller.api.services.v1.OidcStartAttributes.roundtrip_payload:type_name -> google.protobuf.Struct - 20, // 10: controller.api.services.v1.AuthenticateRequest.attributes:type_name -> google.protobuf.Struct - 20, // 11: controller.api.services.v1.AuthenticateResponse.attributes:type_name -> google.protobuf.Struct - 0, // 12: controller.api.services.v1.AuthMethodService.GetAuthMethod:input_type -> controller.api.services.v1.GetAuthMethodRequest - 2, // 13: controller.api.services.v1.AuthMethodService.ListAuthMethods:input_type -> controller.api.services.v1.ListAuthMethodsRequest - 4, // 14: controller.api.services.v1.AuthMethodService.CreateAuthMethod:input_type -> controller.api.services.v1.CreateAuthMethodRequest - 6, // 15: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:input_type -> controller.api.services.v1.UpdateAuthMethodRequest - 8, // 16: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:input_type -> controller.api.services.v1.DeleteAuthMethodRequest - 11, // 17: controller.api.services.v1.AuthMethodService.ChangeState:input_type -> controller.api.services.v1.ChangeStateRequest - 16, // 18: controller.api.services.v1.AuthMethodService.Authenticate:input_type -> controller.api.services.v1.AuthenticateRequest - 1, // 19: controller.api.services.v1.AuthMethodService.GetAuthMethod:output_type -> controller.api.services.v1.GetAuthMethodResponse - 3, // 20: controller.api.services.v1.AuthMethodService.ListAuthMethods:output_type -> controller.api.services.v1.ListAuthMethodsResponse - 5, // 21: controller.api.services.v1.AuthMethodService.CreateAuthMethod:output_type -> controller.api.services.v1.CreateAuthMethodResponse - 7, // 22: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:output_type -> controller.api.services.v1.UpdateAuthMethodResponse - 9, // 23: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:output_type -> controller.api.services.v1.DeleteAuthMethodResponse - 12, // 24: controller.api.services.v1.AuthMethodService.ChangeState:output_type -> controller.api.services.v1.ChangeStateResponse - 17, // 25: controller.api.services.v1.AuthMethodService.Authenticate:output_type -> controller.api.services.v1.AuthenticateResponse - 19, // [19:26] is the sub-list for method output_type - 12, // [12:19] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 10, // 8: controller.api.services.v1.ChangeStateRequest.oidc_change_state_attributes:type_name -> controller.api.services.v1.OidcChangeStateAttributes + 18, // 9: controller.api.services.v1.ChangeStateResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 20, // 10: controller.api.services.v1.OidcStartAttributes.roundtrip_payload:type_name -> google.protobuf.Struct + 20, // 11: controller.api.services.v1.AuthenticateRequest.attributes:type_name -> google.protobuf.Struct + 20, // 12: controller.api.services.v1.AuthenticateResponse.attributes:type_name -> google.protobuf.Struct + 0, // 13: controller.api.services.v1.AuthMethodService.GetAuthMethod:input_type -> controller.api.services.v1.GetAuthMethodRequest + 2, // 14: controller.api.services.v1.AuthMethodService.ListAuthMethods:input_type -> controller.api.services.v1.ListAuthMethodsRequest + 4, // 15: controller.api.services.v1.AuthMethodService.CreateAuthMethod:input_type -> controller.api.services.v1.CreateAuthMethodRequest + 6, // 16: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:input_type -> controller.api.services.v1.UpdateAuthMethodRequest + 8, // 17: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:input_type -> controller.api.services.v1.DeleteAuthMethodRequest + 11, // 18: controller.api.services.v1.AuthMethodService.ChangeState:input_type -> controller.api.services.v1.ChangeStateRequest + 16, // 19: controller.api.services.v1.AuthMethodService.Authenticate:input_type -> controller.api.services.v1.AuthenticateRequest + 1, // 20: controller.api.services.v1.AuthMethodService.GetAuthMethod:output_type -> controller.api.services.v1.GetAuthMethodResponse + 3, // 21: controller.api.services.v1.AuthMethodService.ListAuthMethods:output_type -> controller.api.services.v1.ListAuthMethodsResponse + 5, // 22: controller.api.services.v1.AuthMethodService.CreateAuthMethod:output_type -> controller.api.services.v1.CreateAuthMethodResponse + 7, // 23: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:output_type -> controller.api.services.v1.UpdateAuthMethodResponse + 9, // 24: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:output_type -> controller.api.services.v1.DeleteAuthMethodResponse + 12, // 25: controller.api.services.v1.AuthMethodService.ChangeState:output_type -> controller.api.services.v1.ChangeStateResponse + 17, // 26: controller.api.services.v1.AuthMethodService.Authenticate:output_type -> controller.api.services.v1.AuthenticateResponse + 20, // [20:27] is the sub-list for method output_type + 13, // [13:20] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_controller_api_services_v1_auth_method_service_proto_init() } @@ -1554,6 +1606,10 @@ func file_controller_api_services_v1_auth_method_service_proto_init() { } } } + file_controller_api_services_v1_auth_method_service_proto_msgTypes[11].OneofWrappers = []interface{}{ + (*ChangeStateRequest_Attributes)(nil), + (*ChangeStateRequest_OidcChangeStateAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/internal/gen/controller/api/services/auth_method_service_taggable.go b/internal/gen/controller/api/services/auth_method_service_taggable.go deleted file mode 100644 index 140f579cb..000000000 --- a/internal/gen/controller/api/services/auth_method_service_taggable.go +++ /dev/null @@ -1,130 +0,0 @@ -package services - -import "github.com/hashicorp/eventlogger/filters/encrypt" - -// Tags implements the encrypt.Taggable interface which allows -// AuthenticateResponse Attributes to be classified for the encrypt filter. -func (req *AuthenticateResponse) Tags() ([]encrypt.PointerTag, error) { - if req.Attributes == nil { - return nil, nil - } - return []encrypt.PointerTag{ - // public fields - { - Pointer: "/Attributes/Fields/account_id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/approximate_last_used_time", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/auth_method_id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/authorized_actions", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/created_time", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/expiration_time", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/scope", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/type", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/updated_time", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/user_id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/status", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/auth_url", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/token_id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/final_redirect_url", - Classification: encrypt.PublicClassification, - }, - // secret fields - { - Pointer: "/Attributes/Fields/token", - Classification: encrypt.SecretClassification, - }, - }, nil -} - -// Tags implements the encrypt.Taggable interface which allows -// AuthenticateRequest Attributes to be classified for the encrypt filter. -func (req *AuthenticateRequest) Tags() ([]encrypt.PointerTag, error) { - if req.Attributes == nil { - return nil, nil - } - return []encrypt.PointerTag{ - // public fields - { - Pointer: "/Attributes/Fields/login_name", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/auth_url", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/token_id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/state", - Classification: encrypt.PublicClassification, - }, - // secret fields - { - Pointer: "/Attributes/Fields/password", - Classification: encrypt.SecretClassification, - }, - { - Pointer: "/Attributes/Fields/code", - Classification: encrypt.SecretClassification, - }, - }, nil -} - -// Tags implements the encrypt.Taggable interface which allows -// ChangeStateRequest Attributes to be classified for the encrypt filter. -func (req *ChangeStateRequest) Tags() ([]encrypt.PointerTag, error) { - if req.Attributes == nil { - return nil, nil - } - return []encrypt.PointerTag{ - // public fields - { - Pointer: "/Attributes/Fields/state", - Classification: encrypt.PublicClassification, - }, - }, nil -} diff --git a/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto b/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto index ba4a16bfc..34cab4d76 100644 --- a/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto +++ b/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto @@ -7,9 +7,12 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; +option (custom_options.v1.domain) = "auth"; + // AuthMethod contains all fields related to an Auth Method resource message AuthMethod { // Output only. The ID of the Auth Method. @@ -41,8 +44,20 @@ message AuthMethod { // The Auth Method type. string type = 90; // @gotags: `class:"public"` - // The attributes that are applicable for the specific Auth Method type. - google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific Auth Method type. + google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "default"]; + PasswordAuthMethodAttributes password_auth_method_attributes = 101 [ + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "password", + (google.api.field_visibility).restriction = "INTERNAL" + ]; + OidcAuthMethodAttributes oidc_auth_methods_attributes = 102 [ + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "oidc", + (google.api.field_visibility).restriction = "INTERNAL" + ]; + } // Output only. Whether this auth method is the primary auth method for it's scope. // To change this value update the primary_auth_method_id field on the scope. @@ -52,7 +67,7 @@ message AuthMethod { repeated string authorized_actions = 300 [json_name = "authorized_actions"]; // @gotags: `class:"public"` // Output only. The authorized actions for the scope's collections. - map authorized_collection_actions = 310 [json_name = "authorized_collection_actions"]; + map authorized_collection_actions = 310 [json_name = "authorized_collection_actions"]; // classified as public via taggable implementation } // The attributes of a password typed auth method. @@ -191,4 +206,4 @@ message OidcAuthMethodAuthenticateTokenResponse { // The status. This will always be "unknown". It will never be forwarded to // the consumer. string status = 10; // @gotags: `class:"public"` -} \ No newline at end of file +} diff --git a/internal/proto/controller/api/services/v1/auth_method_service.proto b/internal/proto/controller/api/services/v1/auth_method_service.proto index cc4a529a2..1e6be74fd 100644 --- a/internal/proto/controller/api/services/v1/auth_method_service.proto +++ b/internal/proto/controller/api/services/v1/auth_method_service.proto @@ -6,9 +6,13 @@ option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/s import "protoc-gen-openapiv2/options/annotations.proto"; import "google/api/annotations.proto"; +import "google/api/visibility.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "controller/api/resources/authmethods/v1/auth_method.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "auth"; service AuthMethodService { // GetAuthMethod returns a stored Auth Method if present. The provided request @@ -165,8 +169,11 @@ message ChangeStateRequest { // The mutation will fail if the version does not match the latest known good version. uint32 version = 2; - // The attributes specific to this auth method's state. - google.protobuf.Struct attributes = 4; + oneof attrs { + // The attributes specific to this auth method's state. + google.protobuf.Struct attributes = 4 [(custom_options.v1.subtype) = "default"]; + OidcChangeStateAttributes oidc_change_state_attributes = 5 [(custom_options.v1.subtype) = "oidc", (google.api.field_visibility).restriction = "INTERNAL"]; + } } message ChangeStateResponse { diff --git a/internal/servers/controller/handlers/authmethods/authmethod_service.go b/internal/servers/controller/handlers/authmethods/authmethod_service.go index d1173eb48..ec9cbca0a 100644 --- a/internal/servers/controller/handlers/authmethods/authmethod_service.go +++ b/internal/servers/controller/handlers/authmethods/authmethod_service.go @@ -32,7 +32,6 @@ import ( "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" "github.com/hashicorp/go-secure-stdlib/strutil" "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -46,6 +45,8 @@ const ( authMethodIdField = "auth_method_id" tokenTypeField = "type" isPrimaryField = "is_primary" + + domain = "auth" ) var ( @@ -150,7 +151,7 @@ func (s Service) ListAuthMethods(ctx context.Context, req *pbs.ListAuthMethodsRe for _, am := range ul { res.Id = am.GetPublicId() res.ScopeId = am.GetScopeId() - authorizedActions := authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())], requestauth.WithResource(&res)).Strings() + authorizedActions := authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, am.GetPublicId())], requestauth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue } @@ -177,7 +178,13 @@ func (s Service) ListAuthMethods(ctx context.Context, req *pbs.ListAuthMethodsRe 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) } } @@ -211,7 +218,7 @@ func (s Service) GetAuthMethod(ctx context.Context, req *pbs.GetAuthMethodReques outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -256,7 +263,7 @@ func (s Service) CreateAuthMethod(ctx context.Context, req *pbs.CreateAuthMethod outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -306,7 +313,7 @@ func (s Service) UpdateAuthMethod(ctx context.Context, req *pbs.UpdateAuthMethod outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -321,8 +328,8 @@ func (s Service) UpdateAuthMethod(ctx context.Context, req *pbs.UpdateAuthMethod return nil, err } - if item.GetAttributes() != nil && dryRun { - item.GetAttributes().Fields["dry_run"] = structpb.NewBoolValue(true) + if item.GetOidcAuthMethodsAttributes() != nil && dryRun { + item.GetOidcAuthMethodsAttributes().DryRun = true } return &pbs.UpdateAuthMethodResponse{Item: item}, nil @@ -360,7 +367,7 @@ func (s Service) ChangeState(ctx context.Context, req *pbs.ChangeStateRequest) ( outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", am.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, am.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, am.GetPublicId())]).Strings())) } if outputFields.Has(globals.AuthorizedCollectionActionsField) { collectionActions, err := requestauth.CalculateAuthorizedCollectionActions(ctx, authResults, collectionTypeMap, authResults.Scope.Id, am.GetPublicId()) @@ -401,7 +408,7 @@ func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) return nil, err } - switch subtypes.SubtypeFromId("auth", req.GetAuthMethodId()) { + switch subtypes.SubtypeFromId(domain, req.GetAuthMethodId()) { case password.Subtype: if err := validateAuthenticatePasswordRequest(req); err != nil { return nil, err @@ -417,7 +424,7 @@ func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) return nil, authResults.Error } - switch subtypes.SubtypeFromId("auth", req.GetAuthMethodId()) { + switch subtypes.SubtypeFromId(domain, req.GetAuthMethodId()) { case password.Subtype: return s.authenticatePassword(ctx, req, &authResults) @@ -430,7 +437,7 @@ func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) func (s Service) getFromRepo(ctx context.Context, id string) (auth.AuthMethod, error) { var lookupErr error var am auth.AuthMethod - switch subtypes.SubtypeFromId("auth", id) { + switch subtypes.SubtypeFromId(domain, id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -500,7 +507,7 @@ func (s Service) listFromRepo(ctx context.Context, scopeIds []string, authResult func (s Service) createInRepo(ctx context.Context, scopeId string, item *pb.AuthMethod) (auth.AuthMethod, error) { const op = "authmethods.(Service).createInRepo" var out auth.AuthMethod - switch subtypes.SubtypeFromType("auth", item.GetType()) { + switch subtypes.SubtypeFromType(domain, item.GetType()) { case password.Subtype: am, err := s.createPwInRepo(ctx, scopeId, item) if err != nil { @@ -529,7 +536,7 @@ func (s Service) updateInRepo(ctx context.Context, scopeId string, req *pbs.Upda var am auth.AuthMethod var dryRun bool - switch subtypes.SubtypeFromId("auth", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case password.Subtype: pam, err := s.updatePwInRepo(ctx, scopeId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) if err != nil { @@ -559,7 +566,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, const op = "authmethods.(Service).deleteFromRepo" var rows int var dErr error - switch subtypes.SubtypeFromId("auth", id) { + switch subtypes.SubtypeFromId(domain, id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -588,18 +595,14 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, func (s Service) changeStateInRepo(ctx context.Context, req *pbs.ChangeStateRequest) (auth.AuthMethod, error) { const op = "authmethod_service.(Service).changeStateInRepo" - switch subtypes.SubtypeFromId("auth", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case oidc.Subtype: repo, err := s.oidcRepoFn() if err != nil { return nil, err } - attrs := &pbs.OidcChangeStateAttributes{} - if err := handlers.StructToProto(req.GetAttributes(), attrs); err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to parse attributes")) - } - + attrs := req.GetOidcChangeStateAttributes() var opts []oidc.Option if attrs.GetDisableDiscoveredConfigValidation() { opts = append(opts, oidc.WithForce()) @@ -651,7 +654,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) reque } default: var authMeth auth.AuthMethod - switch subtypes.SubtypeFromId("auth", id) { + switch subtypes.SubtypeFromId(domain, id) { case password.Subtype: repo, err := s.pwRepoFn() if err != nil { @@ -744,14 +747,12 @@ func toAuthMethodProto(ctx context.Context, in auth.AuthMethod, opt ...handlers. if !outputFields.Has(globals.AttributesField) { break } - st, err := handlers.ProtoToStruct(&pb.PasswordAuthMethodAttributes{ - MinLoginNameLength: i.GetMinLoginNameLength(), - MinPasswordLength: i.GetMinPasswordLength(), - }) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building password attribute struct: %v", err) + out.Attrs = &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinLoginNameLength: i.GetMinLoginNameLength(), + MinPasswordLength: i.GetMinPasswordLength(), + }, } - out.Attributes = st case *oidc.AuthMethod: if outputFields.Has(globals.TypeField) { out.Type = oidc.Subtype.String() @@ -787,12 +788,11 @@ func toAuthMethodProto(ctx context.Context, in auth.AuthMethod, opt ...handlers. attrs.MaxAge = wrapperspb.UInt32(uint32(i.GetMaxAge())) } - st, err := handlers.ProtoToStruct(attrs) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building oidc attribute struct: %v", err) + out.Attrs = &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: attrs, } - out.Attributes = st } + fmt.Println("attrs", out.Attrs) return &out, nil } @@ -837,16 +837,14 @@ func validateCreateRequest(ctx context.Context, req *pbs.CreateAuthMethodRequest if req.GetItem().GetIsPrimary() { badFields[isPrimaryField] = "This field is read only." } - switch subtypes.SubtypeFromType("auth", req.GetItem().GetType()) { + switch subtypes.SubtypeFromType(domain, req.GetItem().GetType()) { case password.Subtype: - attrs := &pb.PasswordAuthMethodAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } + // Password attributes are not required when creating a password auth method. case oidc.Subtype: - attrs := &pb.OidcAuthMethodAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." + attrs := req.GetItem().GetOidcAuthMethodsAttributes() + if attrs == nil { + // OIDC attributes are required when creating an OIDC auth method. + badFields[attributesField] = "Attributes are required for creating an OIDC auth method." } else { if attrs.GetIssuer().GetValue() != "" { iss, err := url.Parse(attrs.GetIssuer().GetValue()) @@ -935,119 +933,114 @@ func validateUpdateRequest(ctx context.Context, req *pbs.UpdateAuthMethodRequest if handlers.MaskContains(req.GetUpdateMask().GetPaths(), isPrimaryField) { badFields[isPrimaryField] = "This field is read only." } - switch subtypes.SubtypeFromId("auth", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case password.Subtype: - if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("auth", req.GetItem().GetType()) != password.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, req.GetItem().GetType()) != password.Subtype { badFields[typeField] = "Cannot modify the resource type." } - attrs := &pb.PasswordAuthMethodAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } case oidc.Subtype: - if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("auth", req.GetItem().GetType()) != oidc.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, req.GetItem().GetType()) != oidc.Subtype { badFields[typeField] = "Cannot modify the resource type." } - attrs := &pb.OidcAuthMethodAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } - if attrs.DryRun && attrs.DisableDiscoveredConfigValidation { - badFields[disableDiscoveredConfigValidationField] = "This field cannot be set to true with dry_run." - } + attrs := req.GetItem().GetOidcAuthMethodsAttributes() + if attrs != nil { + if attrs.DryRun && attrs.DisableDiscoveredConfigValidation { + badFields[disableDiscoveredConfigValidationField] = "This field cannot be set to true with dry_run." + } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), apiUrlPrefixField) { - // TODO: When we start accepting the address used in the request make this an optional field. - if strings.TrimSpace(attrs.GetApiUrlPrefix().GetValue()) == "" { - badFields[apiUrlPrefixField] = "This field should not be set to empty." - } - if cu, err := url.Parse(attrs.GetApiUrlPrefix().GetValue()); err != nil || (cu.Scheme != "http" && cu.Scheme != "https") || cu.Host == "" { - badFields[apiUrlPrefixField] = fmt.Sprintf("%q cannot be parsed as a url.", attrs.GetApiUrlPrefix().GetValue()) - } - } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), issuerField) { - if attrs.GetIssuer().GetValue() != "" { - iss, err := url.Parse(attrs.GetIssuer().GetValue()) - if err != nil { - badFields[issuerField] = fmt.Sprintf("Cannot be parsed as a url. %v", err) + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), apiUrlPrefixField) { + // TODO: When we start accepting the address used in the request make this an optional field. + if strings.TrimSpace(attrs.GetApiUrlPrefix().GetValue()) == "" { + badFields[apiUrlPrefixField] = "This field should not be set to empty." } - if iss != nil && !strutil.StrListContains([]string{"http", "https"}, iss.Scheme) { - badFields[issuerField] = fmt.Sprintf("Must have schema %q or %q specified", "http", "https") - } - } - } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), apiUrlPrefixField) { - if attrs.GetApiUrlPrefix().GetValue() != "" { - cu, err := url.Parse(attrs.GetApiUrlPrefix().GetValue()) - if err != nil || cu.Host == "" { + if cu, err := url.Parse(attrs.GetApiUrlPrefix().GetValue()); err != nil || (cu.Scheme != "http" && cu.Scheme != "https") || cu.Host == "" { badFields[apiUrlPrefixField] = fmt.Sprintf("%q cannot be parsed as a url.", attrs.GetApiUrlPrefix().GetValue()) } - if !strutil.StrListContains([]string{"http", "https"}, cu.Scheme) { - badFields[apiUrlPrefixField] = fmt.Sprintf("Must have schema %q or %q specified", "http", "https") - } } - } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), clientSecretField) && attrs.GetClientSecret().GetValue() == "" { - badFields[clientSecretField] = "Can change but cannot unset this field." - } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), clientIdField) && attrs.GetClientId().GetValue() == "" { - badFields[clientIdField] = "Can change but cannot unset this field." - } - - if attrs.GetClientSecretHmac() != "" { - badFields[clientSecretHmacField] = "Field is read only." - } - if attrs.GetState() != "" { - badFields[stateField] = "Field is read only." - } - if attrs.GetCallbackUrl() != "" { - badFields[callbackUrlField] = "Field is read only." - } - - if len(attrs.GetSigningAlgorithms()) > 0 { - for _, sa := range attrs.GetSigningAlgorithms() { - if !oidc.SupportedAlgorithm(oidc.Alg(sa)) { - badFields[signingAlgorithmField] = fmt.Sprintf("Contains unsupported algorithm %q", sa) - break - } - } - } - if len(attrs.GetIdpCaCerts()) > 0 { - if _, err := oidc.ParseCertificates(ctx, attrs.GetIdpCaCerts()...); err != nil { - badFields[idpCaCertsField] = fmt.Sprintf("Cannot parse CA certificates. %v", err.Error()) - } - } - if len(attrs.GetClaimsScopes()) > 0 { - for _, cs := range attrs.GetClaimsScopes() { - if cs == oidc.DefaultClaimsScope { - badFields[claimsScopesField] = fmt.Sprintf("%s is the default scope and cannot be added as optional %q", oidc.DefaultClaimsScope, cs) - break - } - } - } - if len(attrs.GetAccountClaimMaps()) > 0 { - acm, err := oidc.ParseAccountClaimMaps(ctx, attrs.GetAccountClaimMaps()...) - if err != nil { - badFields[accountClaimMapsField] = fmt.Sprintf("Contains invalid map %q", err.Error()) - } else { - foundTo := make(map[string]bool, len(attrs.GetAccountClaimMaps())) - for _, m := range acm { - if foundTo[m.To] { - badFields[accountClaimMapsField] = fmt.Sprintf("%s=%s contains invalid map - multiple maps to the same Boundary to-claim %s", m.From, m.To, m.To) - } - foundTo[m.To] = true - - to, err := oidc.ConvertToAccountToClaim(ctx, m.To) + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), issuerField) { + if attrs.GetIssuer().GetValue() != "" { + iss, err := url.Parse(attrs.GetIssuer().GetValue()) if err != nil { - badFields[accountClaimMapsField] = fmt.Sprintf("%s=%s contains invalid map %q", m.From, m.To, err.Error()) + badFields[issuerField] = fmt.Sprintf("Cannot be parsed as a url. %v", err) + } + if iss != nil && !strutil.StrListContains([]string{"http", "https"}, iss.Scheme) { + badFields[issuerField] = fmt.Sprintf("Must have schema %q or %q specified", "http", "https") + } + } + } + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), apiUrlPrefixField) { + if attrs.GetApiUrlPrefix().GetValue() != "" { + cu, err := url.Parse(attrs.GetApiUrlPrefix().GetValue()) + if err != nil || cu.Host == "" { + badFields[apiUrlPrefixField] = fmt.Sprintf("%q cannot be parsed as a url.", attrs.GetApiUrlPrefix().GetValue()) + } + if !strutil.StrListContains([]string{"http", "https"}, cu.Scheme) { + badFields[apiUrlPrefixField] = fmt.Sprintf("Must have schema %q or %q specified", "http", "https") + } + } + } + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), clientSecretField) && attrs.GetClientSecret().GetValue() == "" { + badFields[clientSecretField] = "Can change but cannot unset this field." + } + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), clientIdField) && attrs.GetClientId().GetValue() == "" { + badFields[clientIdField] = "Can change but cannot unset this field." + } + + if attrs.GetClientSecretHmac() != "" { + badFields[clientSecretHmacField] = "Field is read only." + } + if attrs.GetState() != "" { + badFields[stateField] = "Field is read only." + } + if attrs.GetCallbackUrl() != "" { + badFields[callbackUrlField] = "Field is read only." + } + + if len(attrs.GetSigningAlgorithms()) > 0 { + for _, sa := range attrs.GetSigningAlgorithms() { + if !oidc.SupportedAlgorithm(oidc.Alg(sa)) { + badFields[signingAlgorithmField] = fmt.Sprintf("Contains unsupported algorithm %q", sa) break } - if to == oidc.ToSubClaim { - badFields[accountClaimMapsField] = fmt.Sprintf("%s=%s contains invalid map: not allowed to update sub claim maps", m.From, m.To) + } + } + if len(attrs.GetIdpCaCerts()) > 0 { + if _, err := oidc.ParseCertificates(ctx, attrs.GetIdpCaCerts()...); err != nil { + badFields[idpCaCertsField] = fmt.Sprintf("Cannot parse CA certificates. %v", err.Error()) + } + } + if len(attrs.GetClaimsScopes()) > 0 { + for _, cs := range attrs.GetClaimsScopes() { + if cs == oidc.DefaultClaimsScope { + badFields[claimsScopesField] = fmt.Sprintf("%s is the default scope and cannot be added as optional %q", oidc.DefaultClaimsScope, cs) break } } } + if len(attrs.GetAccountClaimMaps()) > 0 { + acm, err := oidc.ParseAccountClaimMaps(ctx, attrs.GetAccountClaimMaps()...) + if err != nil { + badFields[accountClaimMapsField] = fmt.Sprintf("Contains invalid map %q", err.Error()) + } else { + foundTo := make(map[string]bool, len(attrs.GetAccountClaimMaps())) + for _, m := range acm { + if foundTo[m.To] { + badFields[accountClaimMapsField] = fmt.Sprintf("%s=%s contains invalid map - multiple maps to the same Boundary to-claim %s", m.From, m.To, m.To) + } + foundTo[m.To] = true + + to, err := oidc.ConvertToAccountToClaim(ctx, m.To) + if err != nil { + badFields[accountClaimMapsField] = fmt.Sprintf("%s=%s contains invalid map %q", m.From, m.To, err.Error()) + break + } + if to == oidc.ToSubClaim { + badFields[accountClaimMapsField] = fmt.Sprintf("%s=%s contains invalid map: not allowed to update sub claim maps", m.From, m.To) + break + } + } + } + } } default: badFields["id"] = "Incorrectly formatted identifier." @@ -1088,7 +1081,7 @@ func validateChangeStateRequest(req *pbs.ChangeStateRequest) error { if req == nil { return errors.NewDeprecated(errors.InvalidParameter, op, "Missing request") } - if st := subtypes.SubtypeFromId("auth", req.GetId()); st != oidc.Subtype { + if st := subtypes.SubtypeFromId(domain, req.GetId()); st != oidc.Subtype { return handlers.NotFoundErrorf("This endpoint is only available for the %q Auth Method type.", oidc.Subtype.String()) } badFields := make(map[string]string) @@ -1096,14 +1089,15 @@ func validateChangeStateRequest(req *pbs.ChangeStateRequest) error { badFields[versionField] = "Resource version is required." } - attrs := &pbs.OidcChangeStateAttributes{} - if err := handlers.StructToProto(req.GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Attribute fields do not match the expected format." - } - switch oidcStateMap[attrs.GetState()] { - case inactiveState, privateState, publicState: - default: - badFields[stateField] = fmt.Sprintf("Only supported values are %q, %q, or %q.", inactiveState.String(), privateState.String(), publicState.String()) + attrs := req.GetOidcChangeStateAttributes() + if attrs == nil { + badFields[attributesField] = "Attributes are required when changing an auth method." + } else { + switch oidcStateMap[attrs.GetState()] { + case inactiveState, privateState, publicState: + default: + badFields[stateField] = fmt.Sprintf("Only supported values are %q, %q, or %q.", inactiveState.String(), privateState.String(), publicState.String()) + } } if len(badFields) > 0 { return handlers.InvalidArgumentErrorf("Invalid fields provided in request.", badFields) @@ -1122,7 +1116,7 @@ func validateAuthenticateRequest(req *pbs.AuthenticateRequest) error { if strings.TrimSpace(req.GetAuthMethodId()) == "" { badFields[authMethodIdField] = "This is a required field." } else { - st := subtypes.SubtypeFromId("auth", req.GetAuthMethodId()) + st := subtypes.SubtypeFromId(domain, req.GetAuthMethodId()) switch st { case password.Subtype, oidc.Subtype: default: diff --git a/internal/servers/controller/handlers/authmethods/authmethod_service_test.go b/internal/servers/controller/handlers/authmethods/authmethod_service_test.go index 577ec6275..9653c8412 100644 --- a/internal/servers/controller/handlers/authmethods/authmethod_service_test.go +++ b/internal/servers/controller/handlers/authmethods/authmethod_service_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "regexp" - "sort" "strings" "testing" @@ -102,10 +101,12 @@ func TestGet(t *testing.T) { CreatedTime: am.CreateTime.GetTimestamp(), UpdatedTime: am.UpdateTime.GetTimestamp(), Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, Version: 1, Scope: &scopepb.ScopeInfo{ Id: o.GetPublicId(), @@ -128,14 +129,16 @@ func TestGet(t *testing.T) { CreatedTime: oidcam.CreateTime.GetTimestamp(), UpdatedTime: oidcam.UpdateTime.GetTimestamp(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://alice.com"), - "client_id": structpb.NewStringValue("alice_rp"), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.InactiveState)), - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "callback_url": structpb.NewStringValue(fmt.Sprintf(oidc.CallbackEndpoint, "https://api.com")), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://alice.com"), + ClientId: wrapperspb.String("alice_rp"), + ClientSecretHmac: "", + State: string(oidc.InactiveState), + ApiUrlPrefix: wrapperspb.String("https://api.com"), + CallbackUrl: fmt.Sprintf(oidc.CallbackEndpoint, "https://api.com"), + }, + }, Version: 1, Scope: &scopepb.ScopeInfo{ Id: o.GetPublicId(), @@ -201,11 +204,10 @@ func TestGet(t *testing.T) { return } require.NoError(gErr) - if _, ok := got.Item.Attributes.Fields["client_secret_hmac"]; ok { - assert.NotEqual("secret", got.Item.Attributes.Fields["client_secret_hmac"]) - got.Item.Attributes.Fields["client_secret_hmac"] = structpb.NewStringValue("") + if oidcAttrs := got.Item.GetOidcAuthMethodsAttributes(); oidcAttrs != nil { + assert.NotEqual("secret", oidcAttrs.ClientSecretHmac) } - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "GetAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) + assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.IgnoreFields(&pb.OidcAuthMethodAttributes{}, "client_secret_hmac")), "GetAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) }) } } @@ -249,18 +251,19 @@ func TestList(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: oWithAuthMethods.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 2, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://alice.com"), - "client_id": structpb.NewStringValue("alice_rp"), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.ActivePublicState)), - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "callback_url": structpb.NewStringValue(fmt.Sprintf(oidc.CallbackEndpoint, "https://api.com")), - "signing_algorithms": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.EdDSA)}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://alice.com"), + ClientId: wrapperspb.String("alice_rp"), + ClientSecretHmac: "", + State: string(oidc.ActivePublicState), + ApiUrlPrefix: wrapperspb.String("https://api.com"), + CallbackUrl: fmt.Sprintf(oidc.CallbackEndpoint, "https://api.com"), + SigningAlgorithms: []string{ + string(oidc.EdDSA), + }, + }, + }, IsPrimary: true, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -275,10 +278,12 @@ func TestList(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: oWithAuthMethods.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }) @@ -294,10 +299,12 @@ func TestList(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: oWithOtherAuthMethods.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }) @@ -369,21 +376,20 @@ func TestList(t *testing.T) { return } require.NoError(gErr) - for i, g := range got.Items { - if _, ok := g.Attributes.Fields["client_secret_hmac"]; ok { - assert.NotEqual("secret", g.Attributes.Fields["client_secret_hmac"]) - delete(g.Attributes.Fields, "client_secret_hmac") - delete(tc.res.Items[i].Attributes.Fields, "client_secret_hmac") + for _, g := range got.Items { + if oidcAttrs := g.GetOidcAuthMethodsAttributes(); oidcAttrs != nil { + assert.NotEqual("secret", oidcAttrs.ClientSecretHmac) } } - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "ListAuthMethods() for scope %q got response %q, wanted %q", tc.req.GetScopeId(), got, tc.res) + assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.IgnoreFields(&pb.OidcAuthMethodAttributes{}, "client_secret_hmac")), + "ListAuthMethods() for scope %q got response %q, wanted %q", tc.req.GetScopeId(), got, tc.res) // Now check with anonymous user got, gErr = s.ListAuthMethods(requestauth.DisabledAuthTestContext(iamRepoFn, tc.req.GetScopeId(), requestauth.WithUserId(requestauth.AnonymousUserId)), tc.req) require.NoError(gErr) assert.Len(got.Items, len(tc.res.Items)) for _, g := range got.GetItems() { - assert.Nil(g.Attributes) + assert.Nil(g.Attrs) assert.Nil(g.CreatedTime) assert.Nil(g.UpdatedTime) assert.Empty(g.Version) @@ -560,10 +566,12 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()}, Version: 1, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }, @@ -574,24 +582,17 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/.well-known/openid-configuration/"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "api_url_prefix": structpb.NewStringValue("https://callback.prefix:9281/path"), - "allowed_audiences": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"foo", "bar"}) - return structpb.NewListValue(lv) - }(), - "claims_scopes": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"email", "profile"}) - return structpb.NewListValue(lv) - }(), - "account_claim_maps": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"display_name=name", "oid=sub"}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://example.discovery.url:4821/.well-known/openid-configuration/"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + ApiUrlPrefix: wrapperspb.String("https://callback.prefix:9281/path"), + AllowedAudiences: []string{"foo", "bar"}, + ClaimsScopes: []string{"email", "profile"}, + AccountClaimMaps: []string{"display_name=name", "oid=sub"}, + }, + }, }}, idPrefix: oidc.AuthMethodPrefix + "_", res: &pbs.CreateAuthMethodResponse{ @@ -604,26 +605,19 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.InactiveState)), - "api_url_prefix": structpb.NewStringValue("https://callback.prefix:9281/path"), - "callback_url": structpb.NewStringValue("https://callback.prefix:9281/path/v1/auth-methods/oidc:authenticate:callback"), - "allowed_audiences": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"foo", "bar"}) - return structpb.NewListValue(lv) - }(), - "claims_scopes": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"email", "profile"}) - return structpb.NewListValue(lv) - }(), - "account_claim_maps": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"display_name=name", "oid=sub"}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://example.discovery.url:4821/"), + ClientId: wrapperspb.String("someclientid"), + ClientSecretHmac: "", + State: string(oidc.InactiveState), + ApiUrlPrefix: wrapperspb.String("https://callback.prefix:9281/path"), + CallbackUrl: "https://callback.prefix:9281/path/v1/auth-methods/oidc:authenticate:callback", + AllowedAudiences: []string{"foo", "bar"}, + ClaimsScopes: []string{"email", "profile"}, + AccountClaimMaps: []string{"display_name=name", "oid=sub"}, + }, + }, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }, @@ -650,10 +644,12 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: scope.Global.String(), Type: scope.Global.String(), Name: scope.Global.String(), Description: "Global Scope"}, Version: 1, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }, @@ -664,12 +660,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: scope.Global.String(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://example.discovery.url"), - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://example.discovery.url"), + ApiUrlPrefix: wrapperspb.String("https://api.com"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + }, + }, }}, idPrefix: oidc.AuthMethodPrefix + "_", res: &pbs.CreateAuthMethodResponse{ @@ -682,13 +680,15 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: scope.Global.String(), Type: scope.Global.String(), Name: scope.Global.String(), Description: "Global Scope"}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example.discovery.url"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.InactiveState)), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example.discovery.url"), + ClientId: wrapperspb.String("someclientid"), + ClientSecretHmac: "", + State: string(oidc.InactiveState), + }, + }, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }, @@ -754,46 +754,18 @@ func TestCreate(t *testing.T) { res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, - { - name: "Attributes must be valid for password type", - req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "Attributes must be valid for type"}, - Description: &wrapperspb.StringValue{Value: "Attributes must be valid for type"}, - Type: password.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "invalid_field": structpb.NewStringValue("invalid_value"), - "min_login_name_length": structpb.NewNumberValue(3), - }}, - }}, - res: nil, - err: handlers.ApiErrorWithCode(codes.InvalidArgument), - }, - { - name: "Attributes must be valid for oidc type", - req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "Attributes must be valid for type"}, - Description: &wrapperspb.StringValue{Value: "Attributes must be valid for type"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "login-name": structpb.NewStringValue("invalid_value"), - "password": structpb.NewNumberValue(3), - }}, - }}, - res: nil, - err: handlers.ApiErrorWithCode(codes.InvalidArgument), - }, { name: "OIDC AuthMethod Doesn't Require Issuer", req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + }, + }, }}, res: &pbs.CreateAuthMethodResponse{ Uri: fmt.Sprintf("auth-methods/%s_", oidc.AuthMethodPrefix), @@ -805,12 +777,14 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.InactiveState)), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + ClientId: wrapperspb.String("someclientid"), + ClientSecretHmac: "", + State: string(oidc.InactiveState), + }, + }, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, }, @@ -821,10 +795,12 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -833,11 +809,13 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/.well-known/openid-configuration/"), - "client_secret": structpb.NewStringValue("secret"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example.discovery.url:4821/.well-known/openid-configuration/"), + ClientSecret: wrapperspb.String("secret"), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -846,11 +824,13 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/.well-known/openid-configuration/"), - "client_id": structpb.NewStringValue("someclientid"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example.discovery.url:4821/.well-known/openid-configuration/"), + ClientId: wrapperspb.String("someclientid"), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -859,13 +839,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/.well-known/openid-configuration/"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "client_secret_hmac": structpb.NewStringValue("hmac"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example.discovery.url:4821/.well-known/openid-configuration/"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + ClientSecretHmac: "hmac", + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -874,13 +856,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/.well-known/openid-configuration/"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "state": structpb.NewStringValue(string(oidc.InactiveState)), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example.discovery.url:4821/.well-known/openid-configuration/"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + State: string(oidc.InactiveState), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -889,16 +873,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example2.discovery.url:4821"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "signing_algorithms": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.ES256), strings.ToLower(string(oidc.EdDSA))}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example2.discovery.url:4821"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + SigningAlgorithms: []string{string(oidc.ES256), strings.ToLower(string(oidc.EdDSA))}, + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -907,12 +890,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://example2.discovery.url:4821"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "api_url_prefix": structpb.NewStringValue("invalid path"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://example2.discovery.url:4821"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + ApiUrlPrefix: wrapperspb.String("invalid path"), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -921,12 +906,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue("https://example2.discovery.url:4821"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "callback_url": structpb.NewStringValue("http://another.url.com:82471"), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String("https://example2.discovery.url:4821"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + CallbackUrl: "http://another.url.com:82471", + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -935,16 +922,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example2.discovery.url:4821"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "idp_ca_certs": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"unparseable"}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example2.discovery.url:4821"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + IdpCaCerts: []string{"unparseable"}, + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -953,16 +939,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateAuthMethodRequest{Item: &pb.AuthMethod{ ScopeId: o.GetPublicId(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://api.com"), - "issuer": structpb.NewStringValue("https://example.discovery.url:4821/.well-known/openid-configuration/"), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "claims_scopes": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"openid"}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://api.com"), + Issuer: wrapperspb.String("https://example.discovery.url:4821/.well-known/openid-configuration/"), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + ClaimsScopes: []string{"openid"}, + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -984,6 +969,7 @@ func TestCreate(t *testing.T) { if tc.res == nil { require.Nil(got) } + cmpOptions := []cmp.Option{protocmp.Transform()} if got != nil { assert.Contains(got.GetUri(), tc.res.Uri) assert.True(strings.HasPrefix(got.GetItem().GetId(), tc.idPrefix)) @@ -994,38 +980,27 @@ func TestCreate(t *testing.T) { assert.True(gotCreateTime.AsTime().After(defaultCreated.AsTime()), "New auth_method should have been created after default auth_method. Was created %v, which is after %v", gotCreateTime, defaultCreated) assert.True(gotUpdateTime.AsTime().After(defaultCreated.AsTime()), "New auth_method should have been updated after default auth_method. Was updated %v, which is after %v", gotUpdateTime, defaultCreated) - // Clear all values which are hard to compare against. - got.Uri, tc.res.Uri = "", "" - got.Item.Id, tc.res.Item.Id = "", "" - got.Item.CreatedTime, got.Item.UpdatedTime, tc.res.Item.CreatedTime, tc.res.Item.UpdatedTime = nil, nil, nil, nil - if _, ok := got.Item.Attributes.Fields["client_secret_hmac"]; ok { - assert.NotEqual(tc.req.Item.Attributes.Fields["client_secret"], got.Item.Attributes.Fields["client_secret_hmac"]) - got.Item.Attributes.Fields["client_secret_hmac"] = structpb.NewStringValue("") - } - if _, ok := got.Item.Attributes.Fields["callback_url"]; ok { - exp := tc.res.Item.Attributes.Fields["callback_url"].GetStringValue() - gVal := got.Item.Attributes.Fields["callback_url"].GetStringValue() + // Ignore all values which are hard to compare against. + cmpOptions = append( + cmpOptions, + protocmp.IgnoreFields(&pbs.CreateAuthMethodResponse{}, "uri"), + protocmp.IgnoreFields(&pb.AuthMethod{}, "id", "created_time", "updated_time"), + ) + if oidcAttrs := got.Item.GetOidcAuthMethodsAttributes(); oidcAttrs != nil { + assert.NotEqual(oidcAttrs.ClientSecret, oidcAttrs.ClientSecretHmac) + exp := tc.res.Item.Attrs.(*pb.AuthMethod_OidcAuthMethodsAttributes).OidcAuthMethodsAttributes.CallbackUrl + gVal := oidcAttrs.CallbackUrl matches, err := regexp.MatchString(exp, gVal) require.NoError(err) assert.True(matches, "%q doesn't match %q", gVal, exp) - delete(got.Item.Attributes.Fields, "callback_url") - delete(tc.res.Item.Attributes.Fields, "callback_url") + cmpOptions = append( + cmpOptions, + protocmp.SortRepeatedFields(&pb.OidcAuthMethodAttributes{}, "account_claim_maps"), + protocmp.IgnoreFields(&pb.OidcAuthMethodAttributes{}, "client_secret_hmac", "callback_url"), + ) } - if v, ok := got.Item.Attributes.Fields["account_claim_maps"]; ok { - lv := v.GetListValue().GetValues() - sort.Slice(lv, func(i, j int) bool { - return lv[i].GetStringValue() < lv[j].GetStringValue() - }) - } - if v, ok := tc.res.Item.Attributes.Fields["account_claim_maps"]; ok { - lv := v.GetListValue().GetValues() - sort.Slice(lv, func(i, j int) bool { - return lv[i].GetStringValue() < lv[j].GetStringValue() - }) - } - } - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.SortRepeatedFields(got)), "CreateAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) + assert.Empty(cmp.Diff(got, tc.res, cmpOptions...), "CreateAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) }) } } diff --git a/internal/servers/controller/handlers/authmethods/oidc.go b/internal/servers/controller/handlers/authmethods/oidc.go index 6a5b4de92..4aeabbd17 100644 --- a/internal/servers/controller/handlers/authmethods/oidc.go +++ b/internal/servers/controller/handlers/authmethods/oidc.go @@ -414,11 +414,7 @@ func toStorageOidcAuthMethod(ctx context.Context, scopeId string, in *pb.AuthMet if in == nil { return nil, false, false, errors.NewDeprecated(errors.InvalidParameter, op, "nil auth method.") } - attrs := &pb.OidcAuthMethodAttributes{} - if err := handlers.StructToProto(in.GetAttributes(), attrs); err != nil { - return nil, false, false, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{attributesField: "Attribute fields do not match the expected format."}) - } + attrs := in.GetOidcAuthMethodsAttributes() clientId := attrs.GetClientId().GetValue() clientSecret := oidc.ClientSecret(attrs.GetClientSecret().GetValue()) diff --git a/internal/servers/controller/handlers/authmethods/oidc_test.go b/internal/servers/controller/handlers/authmethods/oidc_test.go index 6b656852e..c067a0fd7 100644 --- a/internal/servers/controller/handlers/authmethods/oidc_test.go +++ b/internal/servers/controller/handlers/authmethods/oidc_test.go @@ -267,39 +267,27 @@ func TestUpdate_OIDC(t *testing.T) { tp.SetClientCreds(tpClientId, tpClientSecret) _, _, tpAlg, _ := tp.SigningKeys() - defaultAttributeFields := func() map[string]*structpb.Value { - return map[string]*structpb.Value{ - "issuer": structpb.NewStringValue(tp.Addr()), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret": structpb.NewStringValue("secret"), - "api_url_prefix": structpb.NewStringValue("http://example.com"), - "idp_ca_certs": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{tp.CACert()}) - return structpb.NewListValue(lv) - }(), - "signing_algorithms": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(tpAlg)}) - return structpb.NewListValue(lv) - }(), - } + defaultAttributes := &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String(tp.Addr()), + ClientId: wrapperspb.String("someclientid"), + ClientSecret: wrapperspb.String("secret"), + ApiUrlPrefix: wrapperspb.String("https://example.com"), + IdpCaCerts: []string{tp.CACert()}, + SigningAlgorithms: []string{string(tpAlg)}, + }, } - defaultReadAttributeFields := func() map[string]*structpb.Value { - return map[string]*structpb.Value{ - "issuer": structpb.NewStringValue(tp.Addr()), - "client_id": structpb.NewStringValue("someclientid"), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.ActivePrivateState)), - "api_url_prefix": structpb.NewStringValue("http://example.com"), - "callback_url": structpb.NewStringValue("http://example.com/v1/auth-methods/oidc:authenticate:callback"), - "idp_ca_certs": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{tp.CACert()}) - return structpb.NewListValue(lv) - }(), - "signing_algorithms": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(tpAlg)}) - return structpb.NewListValue(lv) - }(), - } + defaultReadAttributes := &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String(tp.Addr()), + ClientId: wrapperspb.String("someclientid"), + ClientSecretHmac: "", + State: string(oidc.ActivePrivateState), + ApiUrlPrefix: wrapperspb.String("https://example.com"), + CallbackUrl: "https://example.com/v1/auth-methods/oidc:authenticate:callback", + IdpCaCerts: []string{tp.CACert()}, + SigningAlgorithms: []string{string(tpAlg)}, + }, } freshAuthMethod := func(t *testing.T) (*pb.AuthMethod, func()) { @@ -309,17 +297,17 @@ func TestUpdate_OIDC(t *testing.T) { Name: wrapperspb.String("default"), Description: wrapperspb.String("default"), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultAttributeFields(), - }, + Attrs: defaultAttributes, }}) require.NoError(t, err) csr, err := tested.ChangeState(ctx, &pbs.ChangeStateRequest{ Id: am.GetItem().GetId(), Version: am.GetItem().GetVersion(), - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{"state": structpb.NewStringValue("active-private")}, + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-private", + }, }, }) require.NoError(t, err) @@ -353,13 +341,11 @@ func TestUpdate_OIDC(t *testing.T) { }, res: &pbs.UpdateAuthMethodResponse{ Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "new"}, - Description: &wrapperspb.StringValue{Value: "desc"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultReadAttributeFields(), - }, + ScopeId: o.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: oidc.Subtype.String(), + Attrs: defaultReadAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -380,13 +366,11 @@ func TestUpdate_OIDC(t *testing.T) { }, res: &pbs.UpdateAuthMethodResponse{ Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "new"}, - Description: &wrapperspb.StringValue{Value: "desc"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultReadAttributeFields(), - }, + ScopeId: o.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "new"}, + Description: &wrapperspb.StringValue{Value: "desc"}, + Type: oidc.Subtype.String(), + Attrs: defaultReadAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -400,14 +384,12 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.issuer"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultAttributeFields() - f["issuer"] = structpb.NewStringValue("http://localhost:72759/somepath/.well-known/openid-configuration") - f["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.Issuer = wrapperspb.String("http://localhost:72759/somepath/.well-known/openid-configuration") + f.DisableDiscoveredConfigValidation = true + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), }, }, res: &pbs.UpdateAuthMethodResponse{ @@ -416,14 +398,13 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["issuer"] = structpb.NewStringValue("http://localhost:72759/somepath/") - f["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.Issuer = wrapperspb.String("http://localhost:72759/somepath/") + f.DisableDiscoveredConfigValidation = true + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), + Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -437,14 +418,12 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.issuer"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultAttributeFields() - f["issuer"] = structpb.NewStringValue("http://localhost:7dddd") - f["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.Issuer = wrapperspb.String("http://localhost:7dddd") + f.DisableDiscoveredConfigValidation = true + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -514,12 +493,10 @@ func TestUpdate_OIDC(t *testing.T) { }, res: &pbs.UpdateAuthMethodResponse{ Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Description: &wrapperspb.StringValue{Value: "default"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultReadAttributeFields(), - }, + ScopeId: o.GetPublicId(), + Description: &wrapperspb.StringValue{Value: "default"}, + Type: oidc.Subtype.String(), + Attrs: defaultReadAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -538,12 +515,10 @@ func TestUpdate_OIDC(t *testing.T) { }, res: &pbs.UpdateAuthMethodResponse{ Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "default"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultReadAttributeFields(), - }, + ScopeId: o.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "default"}, + Type: oidc.Subtype.String(), + Attrs: defaultReadAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -563,13 +538,11 @@ func TestUpdate_OIDC(t *testing.T) { }, res: &pbs.UpdateAuthMethodResponse{ Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "updated"}, - Description: &wrapperspb.StringValue{Value: "default"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultReadAttributeFields(), - }, + ScopeId: o.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "updated"}, + Description: &wrapperspb.StringValue{Value: "default"}, + Type: oidc.Subtype.String(), + Attrs: defaultReadAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -589,13 +562,11 @@ func TestUpdate_OIDC(t *testing.T) { }, res: &pbs.UpdateAuthMethodResponse{ Item: &pb.AuthMethod{ - ScopeId: o.GetPublicId(), - Name: &wrapperspb.StringValue{Value: "default"}, - Description: &wrapperspb.StringValue{Value: "notignored"}, - Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: defaultReadAttributeFields(), - }, + ScopeId: o.GetPublicId(), + Name: &wrapperspb.StringValue{Value: "default"}, + Description: &wrapperspb.StringValue{Value: "notignored"}, + Type: oidc.Subtype.String(), + Attrs: defaultReadAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -707,9 +678,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.max_age"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "max_age": structpb.NewNumberValue(0), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + MaxAge: wrapperspb.UInt32(0), }, }, }, @@ -720,13 +691,11 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["max_age"] = structpb.NewNumberValue(0) - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.MaxAge = wrapperspb.UInt32(0) + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -740,9 +709,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.max_age"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "max_age": structpb.NewNumberValue(4), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + MaxAge: wrapperspb.UInt32(4), }, }, }, @@ -753,13 +722,11 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["max_age"] = structpb.NewNumberValue(4) - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.MaxAge = wrapperspb.UInt32(4) + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -773,9 +740,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.client_id"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "client_id": structpb.NewStringValue("new id"), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ClientId: wrapperspb.String("new id"), }, }, }, @@ -786,13 +753,11 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["client_id"] = structpb.NewStringValue("new id") - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.ClientId = wrapperspb.String("new id") + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -806,7 +771,11 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.api_url_prefix"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: nil, // Not strictly necessary to populate this, since it is the zero value, but be explicit + }, + }, }, }, wantErr: true, @@ -818,13 +787,10 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.api_url_prefix"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue("https://callback.prefix:9281/path"), - } - return f - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String("https://callback.prefix:9281/path"), + }, }, }, }, @@ -834,14 +800,12 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["api_url_prefix"] = structpb.NewStringValue("https://callback.prefix:9281/path") - f["callback_url"] = structpb.NewStringValue("https://callback.prefix:9281/path/v1/auth-methods/oidc:authenticate:callback") - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.ApiUrlPrefix = wrapperspb.String("https://callback.prefix:9281/path") + f.CallbackUrl = "https://callback.prefix:9281/path/v1/auth-methods/oidc:authenticate:callback" + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -855,12 +819,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.allowed_audiences"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "allowed_audiences": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"bar", "foo"}) - return structpb.NewListValue(lv) - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + AllowedAudiences: []string{"bar", "foo"}, }, }, }, @@ -871,16 +832,11 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["allowed_audiences"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"bar", "foo"}) - return structpb.NewListValue(lv) - }() - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.AllowedAudiences = []string{"bar", "foo"} + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -894,12 +850,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.claims_scopes"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "claims_scopes": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"email", "profile"}) - return structpb.NewListValue(lv) - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ClaimsScopes: []string{"email", "profile"}, }, }, }, @@ -910,16 +863,11 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["claims_scopes"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"email", "profile"}) - return structpb.NewListValue(lv) - }() - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.ClaimsScopes = []string{"email", "profile"} + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -933,12 +881,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.account_claim_maps"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "account_claim_maps": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"display_name=name"}) - return structpb.NewListValue(lv) - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + AccountClaimMaps: []string{"display_name=name"}, }, }, }, @@ -949,16 +894,11 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["account_claim_maps"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"display_name=name"}) - return structpb.NewListValue(lv) - }() - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.AccountClaimMaps = []string{"display_name=name"} + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -972,12 +912,9 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.account_claim_maps"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "account_claim_maps": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{"oid=sub"}) - return structpb.NewListValue(lv) - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + AccountClaimMaps: []string{"oid=sub"}, }, }, }, @@ -1001,15 +938,10 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.signing_algorithms"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultAttributeFields() - f["signing_algorithms"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.EdDSA)}) - return structpb.NewListValue(lv) - }() - return f - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + SigningAlgorithms: []string{string(oidc.EdDSA)}, + }, }, }, }, @@ -1022,16 +954,11 @@ func TestUpdate_OIDC(t *testing.T) { Paths: []string{"attributes.signing_algorithms"}, }, Item: &pb.AuthMethod{ - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultAttributeFields() - f["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - f["signing_algorithms"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.EdDSA)}) - return structpb.NewListValue(lv) - }() - return f - }(), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + DisableDiscoveredConfigValidation: true, + SigningAlgorithms: []string{string(oidc.EdDSA)}, + }, }, }, }, @@ -1041,17 +968,12 @@ func TestUpdate_OIDC(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{ - Fields: func() map[string]*structpb.Value { - f := defaultReadAttributeFields() - f["signing_algorithms"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.EdDSA)}) - return structpb.NewListValue(lv) - }() - f["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - return f - }(), - }, + Attrs: func() *pb.AuthMethod_OidcAuthMethodsAttributes { + f := proto.Clone(defaultReadAttributes.OidcAuthMethodsAttributes).(*pb.OidcAuthMethodAttributes) + f.SigningAlgorithms = []string{string(oidc.EdDSA)} + f.DisableDiscoveredConfigValidation = true + return &pb.AuthMethod_OidcAuthMethodsAttributes{OidcAuthMethodsAttributes: f} + }(), Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -1088,7 +1010,7 @@ func TestUpdate_OIDC(t *testing.T) { if tc.res == nil { require.Nil(got) } - + cmpOptions := []cmp.Option{protocmp.Transform()} if got != nil { assert.NotNilf(tc.res, "Expected UpdateAuthMethod response to be nil, but was %v", got) gotUpdateTime := got.GetItem().GetUpdatedTime().AsTime() @@ -1097,27 +1019,26 @@ func TestUpdate_OIDC(t *testing.T) { // Verify it is a auth_method updated after it was created assert.True(gotUpdateTime.After(created), "Updated auth_method should have been updated after it's creation. Was updated %v, which is after %v", gotUpdateTime, created) - // Clear all values which are hard to compare against. - if _, ok := got.Item.Attributes.Fields["client_secret_hmac"]; ok { - assert.NotEqual("secret", got.Item.Attributes.Fields["client_secret_hmac"]) - got.Item.Attributes.Fields["client_secret_hmac"] = structpb.NewStringValue("") - } - if _, ok := got.Item.Attributes.Fields["callback_url"]; ok { - exp := tc.res.Item.Attributes.Fields["callback_url"].GetStringValue() - gVal := got.Item.Attributes.Fields["callback_url"].GetStringValue() + // Ignore all values which are hard to compare against. + cmpOptions = append( + cmpOptions, + protocmp.IgnoreFields(&pb.AuthMethod{}, "updated_time"), + protocmp.IgnoreFields(&pb.OidcAuthMethodAttributes{}, "client_secret_hmac", "callback_url"), + ) + assert.NotEqual("secret", got.Item.GetOidcAuthMethodsAttributes().GetClientSecretHmac()) + if got.Item.GetOidcAuthMethodsAttributes().CallbackUrl != "" { + exp := tc.res.Item.GetOidcAuthMethodsAttributes().GetCallbackUrl() + gVal := got.Item.GetOidcAuthMethodsAttributes().GetCallbackUrl() matches, err := regexp.MatchString(exp, gVal) require.NoError(err) assert.True(matches, "%q doesn't match %q", gVal, exp) - delete(got.Item.Attributes.Fields, "callback_url") - delete(tc.res.Item.Attributes.Fields, "callback_url") } - got.Item.UpdatedTime, tc.res.Item.UpdatedTime = nil, nil - assert.EqualValues(3, got.Item.Version) tc.res.Item.Version = 3 + } - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.SortRepeatedFields(got)), "UpdateAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) + assert.Empty(cmp.Diff(got, tc.res, cmpOptions...), "UpdateAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) }) } } @@ -1179,22 +1100,18 @@ func TestUpdate_OIDCDryRun(t *testing.T) { Type: oidc.Subtype.String(), AuthorizedActions: oidcAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "api_url_prefix": structpb.NewStringValue(am.GetApiUrl()), - "callback_url": structpb.NewStringValue(fmt.Sprintf("%s/v1/auth-methods/oidc:authenticate:callback", am.GetApiUrl())), - "client_id": structpb.NewStringValue(am.GetClientId()), - "client_secret_hmac": structpb.NewStringValue(am.GetClientSecretHmac()), - "issuer": structpb.NewStringValue(am.GetIssuer()), - "state": structpb.NewStringValue(am.GetOperationalState()), - "idp_ca_certs": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{tp.CACert()}) - return structpb.NewListValue(lv) - }(), - "signing_algorithms": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(tpAlg)}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + ApiUrlPrefix: wrapperspb.String(am.GetApiUrl()), + CallbackUrl: fmt.Sprintf("%s/v1/auth-methods/oidc:authenticate:callback", am.GetApiUrl()), + ClientId: wrapperspb.String(am.GetClientId()), + ClientSecretHmac: am.GetClientSecretHmac(), + Issuer: wrapperspb.String(am.GetIssuer()), + State: am.GetOperationalState(), + IdpCaCerts: []string{tp.CACert()}, + SigningAlgorithms: []string{string(tpAlg)}, + }, + }, } tested, err := authmethods.NewService(kmsCache, pwRepoFn, oidcRepoFn, iamRepoFn, atRepoFn) @@ -1216,15 +1133,17 @@ func TestUpdate_OIDCDryRun(t *testing.T) { Name: wrapperspb.String("updated"), Description: wrapperspb.String("updated"), Version: am.GetVersion(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "dry_run": structpb.NewBoolValue(true), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + DryRun: true, + }, + }, }, want: func() *pb.AuthMethod { c := proto.Clone(wireAuthMethod).(*pb.AuthMethod) c.Name = wrapperspb.String("updated") c.Description = wrapperspb.String("updated") - c.GetAttributes().GetFields()["dry_run"] = structpb.NewBoolValue(true) + c.GetOidcAuthMethodsAttributes().DryRun = true return c }(), }, @@ -1234,9 +1153,11 @@ func TestUpdate_OIDCDryRun(t *testing.T) { mask: []string{"attributes.issuer"}, item: &pb.AuthMethod{ Version: am.GetVersion(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "dry_run": structpb.NewBoolValue(true), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + DryRun: true, + }, + }, }, wantErr: true, }, @@ -1246,13 +1167,12 @@ func TestUpdate_OIDCDryRun(t *testing.T) { mask: []string{"attributes.signing_algorithms"}, item: &pb.AuthMethod{ Version: am.GetVersion(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "dry_run": structpb.NewBoolValue(true), - "signing_algorithms": func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.RS512)}) - return structpb.NewListValue(lv) - }(), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + DryRun: true, + SigningAlgorithms: []string{string(oidc.RS512)}, + }, + }, }, wantErr: true, }, @@ -1262,10 +1182,12 @@ func TestUpdate_OIDCDryRun(t *testing.T) { mask: []string{"name"}, item: &pb.AuthMethod{ Version: am.GetVersion(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "dry_run": structpb.NewBoolValue(true), - "disable_discovered_config_validation": structpb.NewBoolValue(true), - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + DryRun: true, + DisableDiscoveredConfigValidation: true, + }, + }, }, wantErr: true, }, @@ -1341,34 +1263,24 @@ func TestChangeState_OIDC(t *testing.T) { s, err := authmethods.NewService(kmsCache, pwRepoFn, oidcRepoFn, iamRepoFn, atRepoFn) require.NoError(t, err, "Error when getting new auth_method service.") - signingAlg := func() *structpb.Value { - lv, err := structpb.NewList([]interface{}{string(tpAlg)}) - require.NoError(t, err) - return structpb.NewListValue(lv) - }() - - certs := func() *structpb.Value { - lv, err := structpb.NewList([]interface{}{tp.CACert()}) - require.NoError(t, err) - return structpb.NewListValue(lv) - }() - wantTemplate := &pb.AuthMethod{ Id: oidcam.GetPublicId(), ScopeId: oidcam.GetScopeId(), CreatedTime: oidcam.CreateTime.GetTimestamp(), UpdatedTime: oidcam.UpdateTime.GetTimestamp(), Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "issuer": structpb.NewStringValue(oidcam.GetIssuer()), - "client_id": structpb.NewStringValue(tpClientId), - "client_secret_hmac": structpb.NewStringValue(""), - "state": structpb.NewStringValue(string(oidc.InactiveState)), - "callback_url": structpb.NewStringValue("https://example.callback:58/v1/auth-methods/oidc:authenticate:callback"), - "api_url_prefix": structpb.NewStringValue("https://example.callback:58"), - "signing_algorithms": signingAlg, - "idp_ca_certs": certs, - }}, + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + Issuer: wrapperspb.String(oidcam.GetIssuer()), + ClientId: wrapperspb.String(tpClientId), + ClientSecretHmac: "", + State: string(oidc.InactiveState), + CallbackUrl: "https://example.callback:58/v1/auth-methods/oidc:authenticate:callback", + ApiUrlPrefix: wrapperspb.String("https://example.callback:58"), + SigningAlgorithms: []string{string(tpAlg)}, + IdpCaCerts: []string{tp.CACert()}, + }, + }, Version: 1, Scope: &scopepb.ScopeInfo{ Id: o.GetPublicId(), @@ -1379,10 +1291,6 @@ func TestChangeState_OIDC(t *testing.T) { AuthorizedCollectionActions: authorizedCollectionActions, } - toState := func(s string) *structpb.Struct { - return &structpb.Struct{Fields: map[string]*structpb.Value{"state": structpb.NewStringValue(s)}} - } - // These test cases must be run in this order since these tests rely on the correct versions being provided cases := []struct { name string @@ -1392,17 +1300,40 @@ func TestChangeState_OIDC(t *testing.T) { }{ { name: "Password Auth Method", - req: &pbs.ChangeStateRequest{Id: pwam.GetPublicId(), Version: pwam.GetVersion(), Attributes: toState("inactive")}, - err: true, + req: &pbs.ChangeStateRequest{ + Id: pwam.GetPublicId(), + Version: pwam.GetVersion(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "inactive", + }, + }, + }, + err: true, }, { name: "No Version Specified", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Attributes: toState("inactive")}, - err: true, + req: &pbs.ChangeStateRequest{ + Id: oidcam.GetPublicId(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "inactive", + }, + }, + }, + err: true, }, { name: "Keep Inactive", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: oidcam.GetVersion(), Attributes: toState("inactive")}, + req: &pbs.ChangeStateRequest{ + Id: oidcam.GetPublicId(), + Version: oidcam.GetVersion(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "inactive", + }, + }, + }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) return am @@ -1410,20 +1341,40 @@ func TestChangeState_OIDC(t *testing.T) { }, { name: "Make Incomplete Private", - req: &pbs.ChangeStateRequest{Id: incompleteAm.GetPublicId(), Version: oidcam.GetVersion(), Attributes: toState("active-private")}, - err: true, + req: &pbs.ChangeStateRequest{ + Id: incompleteAm.GetPublicId(), + Version: oidcam.GetVersion(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-private", + }, + }, + }, + err: true, }, { name: "Make Incomplete Public", - req: &pbs.ChangeStateRequest{Id: incompleteAm.GetPublicId(), Version: oidcam.GetVersion(), Attributes: toState("active-public")}, - err: true, + req: &pbs.ChangeStateRequest{ + Id: incompleteAm.GetPublicId(), + Version: oidcam.GetVersion(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-public", + }, + }, + }, + err: true, }, { name: "Mismatched To Public", req: &pbs.ChangeStateRequest{ - Id: mismatchedAM.GetPublicId(), - Version: mismatchedAM.GetVersion(), - Attributes: toState("active-public"), + Id: mismatchedAM.GetPublicId(), + Version: mismatchedAM.GetVersion(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-public", + }, + }, }, err: true, }, @@ -1432,22 +1383,20 @@ func TestChangeState_OIDC(t *testing.T) { req: &pbs.ChangeStateRequest{ Id: mismatchedAM.GetPublicId(), Version: mismatchedAM.GetVersion(), - Attributes: func() *structpb.Struct { - s := toState("active-public") - s.Fields["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - return s - }(), + Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-public", + DisableDiscoveredConfigValidation: true, + }, + }, }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) am.Id = mismatchedAM.PublicId - am.Attributes.Fields["disable_discovered_config_validation"] = structpb.NewBoolValue(true) - am.Attributes.Fields["state"] = structpb.NewStringValue("active-public") - am.Attributes.Fields["client_id"] = structpb.NewStringValue(mismatchedAM.ClientId) - am.Attributes.Fields["signing_algorithms"] = func() *structpb.Value { - lv, _ := structpb.NewList([]interface{}{string(oidc.EdDSA)}) - return structpb.NewListValue(lv) - }() + am.GetOidcAuthMethodsAttributes().DisableDiscoveredConfigValidation = true + am.GetOidcAuthMethodsAttributes().State = "active-public" + am.GetOidcAuthMethodsAttributes().ClientId = wrapperspb.String(mismatchedAM.ClientId) + am.GetOidcAuthMethodsAttributes().SigningAlgorithms = []string{string(oidc.EdDSA)} am.CreatedTime = mismatchedAM.CreateTime.GetTimestamp() am.Version = 2 return am @@ -1455,30 +1404,45 @@ func TestChangeState_OIDC(t *testing.T) { }, { name: "Make Complete Private", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: oidcam.GetVersion(), Attributes: toState("active-private")}, + req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: oidcam.GetVersion(), Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-private", + }, + }, + }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) - am.Attributes.Fields["state"] = structpb.NewStringValue("active-private") + am.GetOidcAuthMethodsAttributes().State = "active-private" am.Version = 2 return am }()}, }, { name: "Make Complete Public", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: 2, Attributes: toState("active-public")}, + req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: 2, Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-public", + }, + }, + }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) - am.Attributes.Fields["state"] = structpb.NewStringValue("active-public") + am.GetOidcAuthMethodsAttributes().State = "active-public" am.Version = 3 return am }()}, }, { name: "Make Complete Inactive", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: 3, Attributes: toState("inactive")}, + req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: 3, Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "inactive", + }, + }, + }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) - am.Attributes.Fields["state"] = structpb.NewStringValue("inactive") + am.GetOidcAuthMethodsAttributes().State = "inactive" am.Version = 4 return am }()}, @@ -1494,21 +1458,19 @@ func TestChangeState_OIDC(t *testing.T) { return } require.NoError(gErr) - if _, ok := got.Item.Attributes.Fields["client_secret_hmac"]; ok { - got.Item.Attributes.Fields["client_secret_hmac"] = structpb.NewStringValue("") - } - if _, ok := got.Item.Attributes.Fields["callback_url"]; ok { - exp := tc.res.Item.Attributes.Fields["callback_url"].GetStringValue() - gVal := got.Item.Attributes.Fields["callback_url"].GetStringValue() + if got.Item.GetOidcAuthMethodsAttributes().CallbackUrl != "" { + exp := tc.res.Item.GetOidcAuthMethodsAttributes().CallbackUrl + gVal := got.Item.GetOidcAuthMethodsAttributes().CallbackUrl matches, err := regexp.MatchString(exp, gVal) require.NoError(err) assert.True(matches, "%q doesn't match %q", gVal, exp) - delete(got.Item.Attributes.Fields, "callback_url") - delete(tc.res.Item.Attributes.Fields, "callback_url") } got.Item.UpdatedTime, tc.res.Item.UpdatedTime = nil, nil - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "ChangeState() got response %q, wanted %q", got, tc.res) + assert.Empty( + cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.IgnoreFields(&pb.OidcAuthMethodAttributes{}, "client_secret_hmac", "callback_url")), + "ChangeState() got response %q, wanted %q", got, tc.res, + ) }) } } diff --git a/internal/servers/controller/handlers/authmethods/password.go b/internal/servers/controller/handlers/authmethods/password.go index e8ba38e2d..fc6824113 100644 --- a/internal/servers/controller/handlers/authmethods/password.go +++ b/internal/servers/controller/handlers/authmethods/password.go @@ -189,11 +189,7 @@ func toStoragePwAuthMethod(scopeId string, item *pb.AuthMethod) (*password.AuthM return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build auth method for creation: %v.", err) } - pwAttrs := &pb.PasswordAuthMethodAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), pwAttrs); err != nil { - return nil, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{attributesField: "Attribute fields do not match the expected format."}) - } + pwAttrs := item.GetPasswordAuthMethodAttributes() if pwAttrs.GetMinLoginNameLength() != 0 { u.MinLoginNameLength = pwAttrs.GetMinLoginNameLength() } diff --git a/internal/servers/controller/handlers/authmethods/password_test.go b/internal/servers/controller/handlers/authmethods/password_test.go index b7ac3b6cd..4321ed225 100644 --- a/internal/servers/controller/handlers/authmethods/password_test.go +++ b/internal/servers/controller/handlers/authmethods/password_test.go @@ -100,10 +100,12 @@ func TestUpdate_Password(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -128,10 +130,12 @@ func TestUpdate_Password(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -206,10 +210,12 @@ func TestUpdate_Password(t *testing.T) { ScopeId: o.GetPublicId(), Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -233,10 +239,12 @@ func TestUpdate_Password(t *testing.T) { Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -260,10 +268,12 @@ func TestUpdate_Password(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "notignored"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 3, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -347,10 +357,12 @@ func TestUpdate_Password(t *testing.T) { Item: &pb.AuthMethod{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_login_name_length": structpb.NewNumberValue(42), - "min_password_length": structpb.NewNumberValue(55555), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinLoginNameLength: 42, + MinPasswordLength: 55555, + }, + }, }, }, res: &pbs.UpdateAuthMethodResponse{ @@ -359,10 +371,12 @@ func TestUpdate_Password(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(8), - "min_login_name_length": structpb.NewNumberValue(42), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 8, + MinLoginNameLength: 42, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -378,10 +392,12 @@ func TestUpdate_Password(t *testing.T) { Item: &pb.AuthMethod{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_login_name_length": structpb.NewNumberValue(5555), - "min_password_length": structpb.NewNumberValue(42), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinLoginNameLength: 5555, + MinPasswordLength: 42, + }, + }, }, }, res: &pbs.UpdateAuthMethodResponse{ @@ -390,10 +406,12 @@ func TestUpdate_Password(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: "password", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "min_password_length": structpb.NewNumberValue(42), - "min_login_name_length": structpb.NewNumberValue(3), - }}, + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinPasswordLength: 42, + MinLoginNameLength: 3, + }, + }, Scope: defaultScopeInfo, AuthorizedActions: pwAuthorizedActions, AuthorizedCollectionActions: authorizedCollectionActions, @@ -428,6 +446,7 @@ func TestUpdate_Password(t *testing.T) { require.Nil(got) } + cmpOptions := []cmp.Option{protocmp.Transform()} if got != nil { assert.NotNilf(tc.res, "Expected UpdateAuthMethod response to be nil, but was %v", got) @@ -436,13 +455,13 @@ func TestUpdate_Password(t *testing.T) { // Verify it is a auth_method updated after it was created assert.True(gotUpdateTime.After(created), "Updated auth_method should have been updated after it's creation. Was updated %v, which is after %v", gotUpdateTime, created) - // Clear all values which are hard to compare against. - got.Item.UpdatedTime, tc.res.Item.UpdatedTime = nil, nil + // Ignore all values which are hard to compare against. + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pb.AuthMethod{}, "updated_time")) assert.EqualValues(2, got.Item.Version) tc.res.Item.Version = 2 } - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform()), "UpdateAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) + assert.Empty(cmp.Diff(got, tc.res, cmpOptions...), "UpdateAuthMethod(%q) got response %q, wanted %q", tc.req, got, tc.res) }) } } diff --git a/internal/tests/api/authmethods/authenticate_test.go b/internal/tests/api/authmethods/authenticate_test.go index 0cc5a1eee..85323a1be 100644 --- a/internal/tests/api/authmethods/authenticate_test.go +++ b/internal/tests/api/authmethods/authenticate_test.go @@ -80,13 +80,15 @@ func TestAuthenticate(t *testing.T) { assert.NotNil(tok) got := tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name()) + // All attribute fields are classified for now. + // TODO(johanbrandhorst): revert this when classification is done for auth methods reqDetails := tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["attributes"], "password") + tests_api.AssertRedactedValues(t, reqDetails["attributes"], "password", "login_name") respDetails := tests_api.GetEventDetails(t, got, "response") tests_api.AssertRedactedValues(t, respDetails) - tests_api.AssertRedactedValues(t, respDetails["attributes"], "token") + tests_api.AssertRedactedValues(t, respDetails["attributes"], "token", "approximate_last_used_time", "expiration_time", "token_type", "updated_time", "user_id", "account_id", "auth_method_id", "authorized_actions", "created_time", "id") _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls tok, err = methods.Authenticate(tc.Context(), tc.Server().DevPasswordAuthMethodId, "login", map[string]interface{}{"login_name": "user", "password": "bad-pass"}) @@ -96,5 +98,5 @@ func TestAuthenticate(t *testing.T) { reqDetails = tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["attributes"], "password") + tests_api.AssertRedactedValues(t, reqDetails["attributes"], "password", "login_name") } diff --git a/internal/tests/api/authmethods/authmethod_test.go b/internal/tests/api/authmethods/authmethod_test.go index 4936e49c8..1c409141a 100644 --- a/internal/tests/api/authmethods/authmethod_test.go +++ b/internal/tests/api/authmethods/authmethod_test.go @@ -6,6 +6,8 @@ import ( "sync" "testing" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/boundary/api" "github.com/hashicorp/boundary/api/authmethods" "github.com/hashicorp/boundary/internal/auth/password" @@ -39,7 +41,7 @@ func TestCrud(t *testing.T) { tcConfig.Eventing = &eventConfig.EventerConfig tc := controller.NewTestController(t, &controller.TestControllerOpts{Config: tcConfig}) - defer tc.Shutdown() + t.Cleanup(tc.Shutdown) client := tc.Client() token := tc.Token() @@ -58,84 +60,175 @@ func TestCrud(t *testing.T) { require.NotNil(eventConfig.AuditEvents) _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls - u, err := amClient.Create(tc.Context(), "password", global, + pw, err := amClient.Create(tc.Context(), "password", global, authmethods.WithName("bar")) require.NoError(err) - checkAuthMethod("create", u.Item, "bar", 1) + t.Cleanup(func() { + _, err = amClient.Delete(tc.Context(), pw.Item.Id) + require.NoError(err) + }) + checkAuthMethod("create", pw.Item, "bar", 1) got := tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name()) reqItem := tests_api.GetEventDetails(t, got, "request")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, reqItem) + tests_api.AssertRedactedValues(t, reqItem["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, reqItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) respItem := tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) - tests_api.AssertRedactedValues(t, respItem["attributes"]) + tests_api.AssertRedactedValues(t, respItem["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls - u, err = amClient.Read(tc.Context(), u.Item.Id) + pw, err = amClient.Read(tc.Context(), pw.Item.Id) require.NoError(err) - checkAuthMethod("read", u.Item, "bar", 1) + checkAuthMethod("read", pw.Item, "bar", 1) got = tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name()) tests_api.AssertRedactedValues(t, tests_api.GetEventDetails(t, got, "request")) respItem = tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) - tests_api.AssertRedactedValues(t, respItem["attributes"]) + tests_api.AssertRedactedValues(t, respItem["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls - u, err = amClient.Update(tc.Context(), u.Item.Id, u.Item.Version, authmethods.WithName("buz")) + pw, err = amClient.Update(tc.Context(), pw.Item.Id, pw.Item.Version, authmethods.WithName("buz")) require.NoError(err) - checkAuthMethod("update", u.Item, "buz", 2) + checkAuthMethod("update", pw.Item, "buz", 2) got = tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name()) tests_api.AssertRedactedValues(t, tests_api.GetEventDetails(t, got, "request")["item"].(map[string]interface{})) respItem = tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) - tests_api.AssertRedactedValues(t, respItem["attributes"]) + tests_api.AssertRedactedValues(t, respItem["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) - u, err = amClient.Update(tc.Context(), u.Item.Id, u.Item.Version, authmethods.DefaultName()) - require.NoError(err) - checkAuthMethod("update", u.Item, "", 3) - - _, err = amClient.Delete(tc.Context(), u.Item.Id) + pw, err = amClient.Update(tc.Context(), pw.Item.Id, pw.Item.Version, authmethods.DefaultName()) require.NoError(err) + checkAuthMethod("update", pw.Item, "", 3) _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls // OIDC auth methods - u, err = amClient.Create(tc.Context(), "oidc", global, + oidc, err := amClient.Create(tc.Context(), "oidc", global, authmethods.WithName("foo"), authmethods.WithOidcAuthMethodApiUrlPrefix("https://api.com"), authmethods.WithOidcAuthMethodIssuer("https://example.com"), authmethods.WithOidcAuthMethodClientSecret("secret"), authmethods.WithOidcAuthMethodClientId("client-id")) require.NoError(err) - checkAuthMethod("create", u.Item, "foo", 1) + t.Cleanup(func() { + _, err = amClient.Delete(tc.Context(), oidc.Item.Id) + require.NoError(err) + }) + checkAuthMethod("create", oidc.Item, "foo", 1) got = tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name()) reqItem = tests_api.GetEventDetails(t, got, "request")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, reqItem) - tests_api.AssertRedactedValues(t, reqItem["attributes"], "client_secret") + tests_api.AssertRedactedValues(t, reqItem["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, reqItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"], "callback_url", "state", "client_secret_hmac") respItem = tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) - tests_api.AssertRedactedValues(t, respItem["attributes"]) + tests_api.AssertRedactedValues(t, respItem["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"], "state", "client_secret_hmac", "callback_url") - u, err = amClient.Read(tc.Context(), u.Item.Id) + oidc, err = amClient.Read(tc.Context(), oidc.Item.Id) require.NoError(err) - checkAuthMethod("read", u.Item, "foo", 1) + checkAuthMethod("read", oidc.Item, "foo", 1) - u, err = amClient.Update(tc.Context(), u.Item.Id, u.Item.Version, authmethods.WithName("bar")) + oidc, err = amClient.Update(tc.Context(), oidc.Item.Id, oidc.Item.Version, authmethods.WithName("bar")) require.NoError(err) - checkAuthMethod("update", u.Item, "bar", 2) + checkAuthMethod("update", oidc.Item, "bar", 2) - u, err = amClient.Update(tc.Context(), u.Item.Id, u.Item.Version, authmethods.DefaultName()) + oidc, err = amClient.Update(tc.Context(), oidc.Item.Id, oidc.Item.Version, authmethods.DefaultName()) require.NoError(err) - checkAuthMethod("update", u.Item, "", 3) + checkAuthMethod("update", oidc.Item, "", 3) +} - _, err = amClient.Delete(tc.Context(), u.Item.Id) +func TestList(t *testing.T) { + assert, require := assert.New(t), require.New(t) + tcConfig, err := config.DevController() require.NoError(err) + + tc := controller.NewTestController(t, &controller.TestControllerOpts{Config: tcConfig}) + t.Cleanup(tc.Shutdown) + + client := tc.Client() + token := tc.Token() + client.SetToken(token.Token) + amClient := authmethods.NewClient(client) + + result, err := amClient.List(tc.Context(), global) + require.NoError(err) + require.Len(result.Items, 2) + genOIDCAM := result.Items[0] + genPWAM := result.Items[1] + + pwAM, err := amClient.Create(tc.Context(), "password", global, + authmethods.WithName("bar"), + authmethods.WithPasswordAuthMethodMinPasswordLength(10), + ) + require.NoError(err) + t.Cleanup(func() { + _, err = amClient.Delete(tc.Context(), pwAM.Item.Id) + require.NoError(err) + }) + + result, err = amClient.List(tc.Context(), global) + require.NoError(err) + require.Len(result.Items, 3) + assert.Empty(cmp.Diff(genOIDCAM, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty(cmp.Diff(genPWAM, result.Items[1], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty(cmp.Diff(pwAM.Item, result.Items[2], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + + oidcAM, err := amClient.Create(tc.Context(), "oidc", global, + authmethods.WithName("foo"), + authmethods.WithOidcAuthMethodApiUrlPrefix("https://api.com"), + authmethods.WithOidcAuthMethodIssuer("https://example.com"), + authmethods.WithOidcAuthMethodClientSecret("secret"), + authmethods.WithOidcAuthMethodClientId("client-id")) + require.NoError(err) + t.Cleanup(func() { + _, err = amClient.Delete(tc.Context(), oidcAM.Item.Id) + require.NoError(err) + }) + + result, err = amClient.List(tc.Context(), global) + require.NoError(err) + require.Len(result.Items, 4) + assert.Empty(cmp.Diff(genOIDCAM, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty(cmp.Diff(oidcAM.Item, result.Items[1], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty(cmp.Diff(genPWAM, result.Items[2], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty(cmp.Diff(pwAM.Item, result.Items[3], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + + result, err = amClient.List(tc.Context(), global, + authmethods.WithFilter(`"/item/attributes/client_id"=="client-id"`)) + require.NoError(err) + require.Len(result.Items, 1) + assert.Empty(cmp.Diff(oidcAM.Item, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + + result, err = amClient.List(tc.Context(), global, + authmethods.WithFilter(`"/item/attributes/min_login_name_length"==3`)) + require.NoError(err) + require.Len(result.Items, 2) + assert.Empty(cmp.Diff(genPWAM, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty(cmp.Diff(pwAM.Item, result.Items[1], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + + result, err = amClient.List(tc.Context(), global, + authmethods.WithFilter(`"/item/attributes/min_password_length"==10`)) + require.NoError(err) + require.Len(result.Items, 1) + assert.Empty(cmp.Diff(pwAM.Item, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) } func TestCustomMethods(t *testing.T) { @@ -193,11 +286,14 @@ func TestCustomMethods(t *testing.T) { reqDetails := tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["attributes"]) + tests_api.AssertRedactedValues(t, reqDetails["Attrs"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["OidcChangeStateAttributes"], "state") respItem := tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) - tests_api.AssertRedactedValues(t, respItem["attributes"]) + // TODO(johanbrandhorst): Not all of these fields will be redacted eventually + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"], "signing_algorithms", "callback_url", "idp_ca_certs", "state", "client_secret_hmac") _, err = amClient.ChangeState(tc.Context(), u.Item.Id, u.Item.Version, "", authmethods.WithOidcAuthMethodDisableDiscoveredConfigValidation(true)) assert.Error(err) diff --git a/sdk/pbs/controller/api/resources/authmethods/auth_method_taggable_test.go b/internal/tests/api/authmethods/classification_test.go similarity index 50% rename from sdk/pbs/controller/api/resources/authmethods/auth_method_taggable_test.go rename to internal/tests/api/authmethods/classification_test.go index aab9f930d..bad427d65 100644 --- a/sdk/pbs/controller/api/resources/authmethods/auth_method_taggable_test.go +++ b/internal/tests/api/authmethods/classification_test.go @@ -1,4 +1,4 @@ -package authmethods +package authmethods_test import ( "context" @@ -7,6 +7,7 @@ import ( "time" "github.com/hashicorp/boundary/sdk/pbs/controller/api" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" "github.com/hashicorp/boundary/sdk/wrapper" "github.com/hashicorp/eventlogger" "github.com/hashicorp/eventlogger/filters/encrypt" @@ -32,29 +33,29 @@ func TestAuthMethod_Tags(t *testing.T) { testEvent: &eventlogger.Event{ Type: "test", CreatedAt: now, - Payload: &AuthMethod{ + Payload: &pb.AuthMethod{ Id: "id", ScopeId: "scope-id", Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "description"}, Type: "oidc", - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "state": structpb.NewStringValue("public-state"), - "issuer": structpb.NewStringValue("public-issuer"), - "client_id": structpb.NewStringValue("public-client_id"), - "client_secret_hmac": structpb.NewStringValue("public-client_secret_hmac"), - "max_age": structpb.NewStringValue("public-max_age"), - "signing_algorithms": structpb.NewStringValue("public-signing_algorithms"), - "idp_ca_certs": structpb.NewStringValue("public-signing_algorithms"), - "api_url_prefix": structpb.NewStringValue("public-api_url_prefix"), - "callback_url": structpb.NewStringValue("public-callback_url"), - "allowed_audiences": structpb.NewStringValue("public-allowed_audiences"), - "claims_scopes": structpb.NewStringValue("public-claims_scopes"), - "account_claim_maps": structpb.NewStringValue("public-account_claim_maps"), - "disable_discovered_config_validation": structpb.NewStringValue("public-disable_discovered_config_validation"), - "dry_run": structpb.NewStringValue("public-dry_run"), - "client_secret": structpb.NewStringValue("secret-client_secret"), + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + State: "public-state", + Issuer: wrapperspb.String("public-issuer"), + ClientId: wrapperspb.String("public-client_id"), + ClientSecretHmac: "public-client_secret_hmac", + MaxAge: wrapperspb.UInt32(100), + SigningAlgorithms: []string{"public-signing_algorithms"}, + IdpCaCerts: []string{"public-idp_ca_certs"}, + ApiUrlPrefix: wrapperspb.String("public-api_url_prefix"), + CallbackUrl: "public-callback_url", + AllowedAudiences: []string{"public-allowed_audiences"}, + ClaimsScopes: []string{"public-claims_scopes"}, + AccountClaimMaps: []string{"public-account_claim_maps"}, + DisableDiscoveredConfigValidation: false, + DryRun: false, + ClientSecret: wrapperspb.String("secret-client_secret"), }, }, AuthorizedActions: []string{"action-1", "action-2"}, @@ -71,29 +72,30 @@ func TestAuthMethod_Tags(t *testing.T) { wantEvent: &eventlogger.Event{ Type: "test", CreatedAt: now, - Payload: &AuthMethod{ + Payload: &pb.AuthMethod{ Id: "id", ScopeId: "scope-id", Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "description"}, Type: "oidc", - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "state": structpb.NewStringValue("public-state"), - "issuer": structpb.NewStringValue("public-issuer"), - "client_id": structpb.NewStringValue("public-client_id"), - "client_secret_hmac": structpb.NewStringValue("public-client_secret_hmac"), - "max_age": structpb.NewStringValue("public-max_age"), - "signing_algorithms": structpb.NewStringValue("public-signing_algorithms"), - "idp_ca_certs": structpb.NewStringValue("public-signing_algorithms"), - "api_url_prefix": structpb.NewStringValue("public-api_url_prefix"), - "callback_url": structpb.NewStringValue("public-callback_url"), - "allowed_audiences": structpb.NewStringValue("public-allowed_audiences"), - "claims_scopes": structpb.NewStringValue("public-claims_scopes"), - "account_claim_maps": structpb.NewStringValue("public-account_claim_maps"), - "disable_discovered_config_validation": structpb.NewStringValue("public-disable_discovered_config_validation"), - "dry_run": structpb.NewStringValue("public-dry_run"), - "client_secret": structpb.NewStringValue(encrypt.RedactedData), + // TODO(johanbrandhorst): update redaction once typed attributes are available + Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ + OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ + State: encrypt.RedactedData, + Issuer: wrapperspb.String(encrypt.RedactedData), + ClientId: wrapperspb.String(encrypt.RedactedData), + ClientSecretHmac: encrypt.RedactedData, + MaxAge: wrapperspb.UInt32(100), + SigningAlgorithms: []string{encrypt.RedactedData}, + IdpCaCerts: []string{encrypt.RedactedData}, + ApiUrlPrefix: wrapperspb.String(encrypt.RedactedData), + CallbackUrl: encrypt.RedactedData, + AllowedAudiences: []string{encrypt.RedactedData}, + ClaimsScopes: []string{encrypt.RedactedData}, + AccountClaimMaps: []string{encrypt.RedactedData}, + DisableDiscoveredConfigValidation: false, + DryRun: false, + ClientSecret: wrapperspb.String(encrypt.RedactedData), }, }, AuthorizedActions: []string{"action-1", "action-2"}, @@ -113,16 +115,16 @@ func TestAuthMethod_Tags(t *testing.T) { testEvent: &eventlogger.Event{ Type: "test", CreatedAt: now, - Payload: &AuthMethod{ + Payload: &pb.AuthMethod{ Id: "id", ScopeId: "scope-id", Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "description"}, Type: "password", - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "min_login_name_length": structpb.NewStringValue("public-min_login_name_length"), - "min_password_length": structpb.NewStringValue("public-min_password_length"), + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinLoginNameLength: 100, + MinPasswordLength: 100, }, }, AuthorizedActions: []string{"action-1", "action-2"}, @@ -139,16 +141,17 @@ func TestAuthMethod_Tags(t *testing.T) { wantEvent: &eventlogger.Event{ Type: "test", CreatedAt: now, - Payload: &AuthMethod{ + Payload: &pb.AuthMethod{ Id: "id", ScopeId: "scope-id", Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "description"}, Type: "password", - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "min_login_name_length": structpb.NewStringValue("public-min_login_name_length"), - "min_password_length": structpb.NewStringValue("public-min_password_length"), + // TODO(johanbrandhorst): update redaction once typed attributes are available + Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ + PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ + MinLoginNameLength: 100, + MinPasswordLength: 100, }, }, AuthorizedActions: []string{"action-1", "action-2"}, diff --git a/internal/gen/controller/api/services/auth_method_service_taggable_test.go b/internal/tests/api/authmethods/service_classification_test.go similarity index 73% rename from internal/gen/controller/api/services/auth_method_service_taggable_test.go rename to internal/tests/api/authmethods/service_classification_test.go index acd086e32..87b2d2253 100644 --- a/internal/gen/controller/api/services/auth_method_service_taggable_test.go +++ b/internal/tests/api/authmethods/service_classification_test.go @@ -1,4 +1,4 @@ -package services_test +package authmethods_test import ( "context" @@ -65,23 +65,24 @@ func TestAuthenticate_Tags(t *testing.T) { CreatedAt: now, Payload: &services.AuthenticateResponse{ Command: "public-command", + // TODO(johanbrandhorst): update redaction once typed attributes are available Attributes: &structpb.Struct{ Fields: map[string]*structpb.Value{ - "account_id": structpb.NewStringValue("public-account_id"), - "approximate_last_used_time": structpb.NewStringValue("public-approximate_last_used_time"), - "auth_method_id": structpb.NewStringValue("public-auth_method_id"), - "authorized_actions": structpb.NewStringValue("public-authorized_actions"), - "created_time": structpb.NewStringValue("public-created_time"), - "expiration_time": structpb.NewStringValue("public-expiration_time"), - "id": structpb.NewStringValue("public-id"), - "scope": structpb.NewStringValue("public-scope"), - "type": structpb.NewStringValue("public-type"), - "updated_time": structpb.NewStringValue("public-updated_time"), - "user_id": structpb.NewStringValue("public-user_id"), - "status": structpb.NewStringValue("public-status"), - "auth_url": structpb.NewStringValue("public-auth_url"), - "token_id": structpb.NewStringValue("public-token_id"), - "final_redirect_url": structpb.NewStringValue("public-final_redirect_url"), + "account_id": structpb.NewStringValue(encrypt.RedactedData), + "approximate_last_used_time": structpb.NewStringValue(encrypt.RedactedData), + "auth_method_id": structpb.NewStringValue(encrypt.RedactedData), + "authorized_actions": structpb.NewStringValue(encrypt.RedactedData), + "created_time": structpb.NewStringValue(encrypt.RedactedData), + "expiration_time": structpb.NewStringValue(encrypt.RedactedData), + "id": structpb.NewStringValue(encrypt.RedactedData), + "scope": structpb.NewStringValue(encrypt.RedactedData), + "type": structpb.NewStringValue(encrypt.RedactedData), + "updated_time": structpb.NewStringValue(encrypt.RedactedData), + "user_id": structpb.NewStringValue(encrypt.RedactedData), + "status": structpb.NewStringValue(encrypt.RedactedData), + "auth_url": structpb.NewStringValue(encrypt.RedactedData), + "token_id": structpb.NewStringValue(encrypt.RedactedData), + "final_redirect_url": structpb.NewStringValue(encrypt.RedactedData), "token": structpb.NewStringValue(encrypt.RedactedData), }, }, @@ -116,12 +117,13 @@ func TestAuthenticate_Tags(t *testing.T) { AuthMethodId: "public-auth-method-id", TokenType: "public-token-type", Command: "public-command", + // TODO(johanbrandhorst): update redaction once typed attributes are available Attributes: &structpb.Struct{ Fields: map[string]*structpb.Value{ - "login_name": structpb.NewStringValue("public-login_name"), - "auth_url": structpb.NewStringValue("public-auth_url"), - "token_id": structpb.NewStringValue("public-token_id"), - "state": structpb.NewStringValue("public-state"), + "login_name": structpb.NewStringValue(encrypt.RedactedData), + "auth_url": structpb.NewStringValue(encrypt.RedactedData), + "token_id": structpb.NewStringValue(encrypt.RedactedData), + "state": structpb.NewStringValue(encrypt.RedactedData), "password": structpb.NewStringValue(encrypt.RedactedData), "code": structpb.NewStringValue(encrypt.RedactedData), }, diff --git a/internal/types/subtypes/interceptor.go b/internal/types/subtypes/interceptor.go index ea4b1aad8..9fe7e8bae 100644 --- a/internal/types/subtypes/interceptor.go +++ b/internal/types/subtypes/interceptor.go @@ -295,14 +295,13 @@ func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerIntercep } res, handlerErr := handler(interceptorCtx, req) - newRes := res if res, ok := res.(proto.Message); ok { - newRes, err = transformResponseAttributes(res) + res, err = transformResponseAttributes(res) if err != nil { return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building attribute struct: %v", err) } } - return newRes, handlerErr + return res, handlerErr } } diff --git a/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go b/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go index a506c71f6..670625e6f 100644 --- a/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go +++ b/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go @@ -9,6 +9,7 @@ package authmethods import ( 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" @@ -50,15 +51,18 @@ type AuthMethod struct { Version uint32 `protobuf:"varint,80,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // The Auth Method type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` - // The attributes that are applicable for the specific Auth Method type. - Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *AuthMethod_Attributes + // *AuthMethod_PasswordAuthMethodAttributes + // *AuthMethod_OidcAuthMethodsAttributes + Attrs isAuthMethod_Attrs `protobuf_oneof:"attrs"` // Output only. Whether this auth method is the primary auth method for it's scope. // To change this value update the primary_auth_method_id field on the scope. IsPrimary bool `protobuf:"varint,110,opt,name=is_primary,proto3" json:"is_primary,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" class:"public"` // @gotags: `class:"public"` // Output only. The authorized actions for the scope's collections. - AuthorizedCollectionActions map[string]*structpb.ListValue `protobuf:"bytes,310,rep,name=authorized_collection_actions,proto3" json:"authorized_collection_actions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AuthorizedCollectionActions map[string]*structpb.ListValue `protobuf:"bytes,310,rep,name=authorized_collection_actions,proto3" json:"authorized_collection_actions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // classified as public via taggable implementation } func (x *AuthMethod) Reset() { @@ -156,13 +160,34 @@ func (x *AuthMethod) GetType() string { return "" } +func (m *AuthMethod) GetAttrs() isAuthMethod_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *AuthMethod) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*AuthMethod_Attributes); ok { return x.Attributes } return nil } +func (x *AuthMethod) GetPasswordAuthMethodAttributes() *PasswordAuthMethodAttributes { + if x, ok := x.GetAttrs().(*AuthMethod_PasswordAuthMethodAttributes); ok { + return x.PasswordAuthMethodAttributes + } + return nil +} + +func (x *AuthMethod) GetOidcAuthMethodsAttributes() *OidcAuthMethodAttributes { + if x, ok := x.GetAttrs().(*AuthMethod_OidcAuthMethodsAttributes); ok { + return x.OidcAuthMethodsAttributes + } + return nil +} + func (x *AuthMethod) GetIsPrimary() bool { if x != nil { return x.IsPrimary @@ -184,6 +209,29 @@ func (x *AuthMethod) GetAuthorizedCollectionActions() map[string]*structpb.ListV return nil } +type isAuthMethod_Attrs interface { + isAuthMethod_Attrs() +} + +type AuthMethod_Attributes struct { + // The attributes that are applicable for the specific Auth Method type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3,oneof"` +} + +type AuthMethod_PasswordAuthMethodAttributes struct { + PasswordAuthMethodAttributes *PasswordAuthMethodAttributes `protobuf:"bytes,101,opt,name=password_auth_method_attributes,json=passwordAuthMethodAttributes,proto3,oneof"` +} + +type AuthMethod_OidcAuthMethodsAttributes struct { + OidcAuthMethodsAttributes *OidcAuthMethodAttributes `protobuf:"bytes,102,opt,name=oidc_auth_methods_attributes,json=oidcAuthMethodsAttributes,proto3,oneof"` +} + +func (*AuthMethod_Attributes) isAuthMethod_Attrs() {} + +func (*AuthMethod_PasswordAuthMethodAttributes) isAuthMethod_Attrs() {} + +func (*AuthMethod_OidcAuthMethodsAttributes) isAuthMethod_Attrs() {} + // The attributes of a password typed auth method. type PasswordAuthMethodAttributes struct { state protoimpl.MessageState @@ -750,201 +798,226 @@ var file_controller_api_resources_authmethods_v1_auth_method_proto_rawDesc = []b 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, - 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, - 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xf1, 0x06, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, - 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, - 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, - 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, - 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x4e, 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, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x5a, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x70, - 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, - 0x5f, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, - 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9b, 0x01, 0x0a, 0x1d, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb6, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x54, 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, 0x61, 0x75, - 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, - 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, - 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x22, 0x83, 0x02, 0x0a, 0x1c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x74, 0x0a, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, - 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x0d, 0x42, 0x3e, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x36, 0x0a, 0x20, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, - 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, - 0x12, 0x4d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x52, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x6d, 0x0a, 0x13, 0x6d, 0x69, - 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x3b, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, - 0x33, 0x0a, 0x1e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, - 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x12, 0x11, 0x4d, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x52, 0x13, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe6, 0x09, 0x0a, 0x18, 0x4f, 0x69, - 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x06, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x14, 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, 0x23, 0xa0, 0xda, 0x29, 0x01, - 0xc2, 0xdd, 0x29, 0x1b, 0x0a, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x2e, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x06, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x52, - 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x64, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x6f, 0x74, 0x6f, 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, 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, 0xdf, 0x09, 0x0a, + 0x0a, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x28, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, - 0x29, 0x20, 0x0a, 0x14, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x49, 0x64, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x74, 0x0a, - 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 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, 0x30, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x28, 0x0a, 0x18, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x0c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, - 0x63, 0x72, 0x65, 0x74, 0x52, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, - 0x63, 0x72, 0x65, 0x74, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x68, - 0x6d, 0x61, 0x63, 0x12, 0x5c, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x3c, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x24, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1c, 0x0a, 0x12, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, - 0x12, 0x06, 0x4d, 0x61, 0x78, 0x41, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, - 0x65, 0x12, 0x64, 0x0a, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6c, 0x67, - 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x18, 0x46, 0x20, 0x03, 0x28, 0x09, 0x42, 0x34, 0xa0, - 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2c, 0x0a, 0x1d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x12, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x41, - 0x6c, 0x67, 0x73, 0x52, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6c, 0x67, - 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x12, 0x71, 0x0a, 0x0e, 0x61, 0x70, 0x69, 0x5f, 0x75, - 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0b, 0x32, + 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, 0x4e, 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, + 0x44, 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, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x42, 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, 0xb0, 0x01, 0x0a, 0x1f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, + 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x42, 0x20, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x08, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, + 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x1c, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0xa2, 0x01, 0x0a, 0x1c, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, + 0x1c, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x04, 0x6f, 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, + 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, + 0x19, 0x6f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, + 0x5f, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x69, 0x73, 0x5f, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9b, 0x01, 0x0a, 0x1d, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb6, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x54, 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, + 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x83, + 0x02, 0x0a, 0x1c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x74, 0x0a, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x3e, + 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x36, 0x0a, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x4d, 0x69, 0x6e, 0x4c, + 0x6f, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x52, 0x15, + 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x6d, 0x0a, 0x13, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x14, 0x20, 0x01, + 0x28, 0x0d, 0x42, 0x3b, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x33, 0x0a, 0x1e, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x11, 0x4d, 0x69, + 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x52, + 0x13, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe6, 0x09, 0x0a, 0x18, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, + 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x59, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, + 0x72, 0x18, 0x14, 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, 0x23, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1b, 0x0a, + 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x72, 0x12, 0x06, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x72, 0x12, 0x64, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x1e, 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, 0x28, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x20, 0x0a, 0x14, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x69, 0x64, 0x12, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x52, 0x09, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x74, 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 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, 0x2b, 0xa0, - 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x23, 0x0a, 0x19, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x12, 0x06, 0x41, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x5f, - 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, - 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x12, 0x53, - 0x0a, 0x0c, 0x69, 0x64, 0x70, 0x5f, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x73, 0x18, 0x64, - 0x20, 0x03, 0x28, 0x09, 0x42, 0x2f, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x27, 0x0a, 0x17, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x69, 0x64, 0x70, 0x5f, 0x63, - 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x73, 0x12, 0x0c, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x73, 0x52, 0x0c, 0x69, 0x64, 0x70, 0x5f, 0x63, 0x61, 0x5f, 0x63, 0x65, - 0x72, 0x74, 0x73, 0x12, 0x5f, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, - 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x42, 0x31, - 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x29, 0x0a, 0x1c, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x75, 0x64, - 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x09, 0x41, 0x75, 0x64, 0x43, 0x6c, 0x61, 0x69, 0x6d, - 0x73, 0x52, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x65, - 0x6e, 0x63, 0x65, 0x73, 0x12, 0x56, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x70, 0x20, 0x03, 0x28, 0x09, 0x42, 0x30, 0xa0, 0xda, 0x29, - 0x01, 0xc2, 0xdd, 0x29, 0x28, 0x0a, 0x18, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x2e, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, - 0x0c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x0d, 0x63, - 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x69, 0x0a, 0x12, + 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x30, 0xa0, + 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x28, 0x0a, 0x18, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x12, 0x0c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, + 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x2e, + 0x0a, 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, + 0x68, 0x6d, 0x61, 0x63, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x12, 0x5c, + 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x24, 0xa0, + 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1c, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x12, 0x06, 0x4d, 0x61, 0x78, + 0x41, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x12, 0x64, 0x0a, 0x12, + 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, + 0x6d, 0x73, 0x18, 0x46, 0x20, 0x03, 0x28, 0x09, 0x42, 0x34, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, + 0x29, 0x2c, 0x0a, 0x1d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x73, + 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, + 0x73, 0x12, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x41, 0x6c, 0x67, 0x73, 0x52, 0x12, + 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, + 0x6d, 0x73, 0x12, 0x71, 0x0a, 0x0e, 0x61, 0x70, 0x69, 0x5f, 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, + 0x65, 0x66, 0x69, 0x78, 0x18, 0x50, 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, 0x2b, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, + 0x29, 0x23, 0x0a, 0x19, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x5f, 0x75, 0x72, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x06, 0x41, + 0x70, 0x69, 0x55, 0x72, 0x6c, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x5f, 0x75, 0x72, 0x6c, 0x5f, 0x70, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, + 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x61, 0x6c, + 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x75, 0x72, 0x6c, 0x12, 0x53, 0x0a, 0x0c, 0x69, 0x64, 0x70, + 0x5f, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x73, 0x18, 0x64, 0x20, 0x03, 0x28, 0x09, 0x42, + 0x2f, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x27, 0x0a, 0x17, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x69, 0x64, 0x70, 0x5f, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, + 0x74, 0x73, 0x12, 0x0c, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, + 0x52, 0x0c, 0x69, 0x64, 0x70, 0x5f, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x73, 0x12, 0x5f, + 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, + 0x63, 0x65, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x42, 0x31, 0xa0, 0xda, 0x29, 0x01, 0xc2, + 0xdd, 0x29, 0x29, 0x0a, 0x1c, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, + 0x73, 0x12, 0x09, 0x41, 0x75, 0x64, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x52, 0x11, 0x61, 0x6c, + 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x12, + 0x56, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, + 0x18, 0x70, 0x20, 0x03, 0x28, 0x09, 0x42, 0x30, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x28, + 0x0a, 0x18, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x61, + 0x69, 0x6d, 0x73, 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x0c, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x73, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x73, + 0x5f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x69, 0x0a, 0x12, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x6d, 0x61, 0x70, 0x73, 0x18, 0x71, 0x20, + 0x03, 0x28, 0x09, 0x42, 0x39, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x31, 0x0a, 0x1d, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x6d, 0x61, 0x70, 0x73, 0x12, 0x10, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x61, 0x70, 0x73, 0x52, 0x12, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x6d, 0x61, - 0x70, 0x73, 0x18, 0x71, 0x20, 0x03, 0x28, 0x09, 0x42, 0x39, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, - 0x29, 0x31, 0x0a, 0x1d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x5f, 0x6d, 0x61, 0x70, - 0x73, 0x12, 0x10, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, - 0x61, 0x70, 0x73, 0x52, 0x12, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x63, 0x6c, 0x61, - 0x69, 0x6d, 0x5f, 0x6d, 0x61, 0x70, 0x73, 0x12, 0x58, 0x0a, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x78, 0x20, 0x01, 0x28, 0x08, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x24, 0x64, 0x69, 0x73, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1f, 0x0a, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x82, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, - 0x75, 0x6e, 0x22, 0x61, 0x0a, 0x27, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x22, 0xb7, 0x01, 0x0a, 0x29, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, - 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x12, 0x2c, 0x0a, 0x11, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x32, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x75, 0x72, 0x69, 0x22, - 0x5c, 0x0a, 0x2a, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, - 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, - 0x12, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, - 0x75, 0x72, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, 0x69, 0x6e, 0x61, 0x6c, - 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x22, 0x44, 0x0a, - 0x26, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, - 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x5f, 0x69, 0x64, 0x22, 0x41, 0x0a, 0x27, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x58, 0x5a, 0x56, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x73, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x73, 0x12, 0x58, 0x0a, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x78, 0x20, 0x01, 0x28, 0x08, + 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, + 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x07, + 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, 0x04, + 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x22, 0x61, 0x0a, + 0x27, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, + 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x68, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, + 0x5f, 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, + 0x22, 0xb7, 0x01, 0x0a, 0x29, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x43, + 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2c, + 0x0a, 0x11, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x75, 0x72, 0x69, 0x22, 0x5c, 0x0a, 0x2a, 0x4f, 0x69, + 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x61, + 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x22, 0x44, 0x0a, 0x26, 0x4f, 0x69, 0x64, 0x63, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, + 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x22, 0x41, + 0x0a, 0x27, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x42, 0x60, 0x5a, 0x56, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x3b, + 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0xa2, 0xe3, 0x29, 0x04, 0x61, + 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -984,18 +1057,20 @@ var file_controller_api_resources_authmethods_v1_auth_method_proto_depIdxs = []i 11, // 3: controller.api.resources.authmethods.v1.AuthMethod.created_time:type_name -> google.protobuf.Timestamp 11, // 4: controller.api.resources.authmethods.v1.AuthMethod.updated_time:type_name -> google.protobuf.Timestamp 12, // 5: controller.api.resources.authmethods.v1.AuthMethod.attributes:type_name -> google.protobuf.Struct - 8, // 6: controller.api.resources.authmethods.v1.AuthMethod.authorized_collection_actions:type_name -> controller.api.resources.authmethods.v1.AuthMethod.AuthorizedCollectionActionsEntry - 10, // 7: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.issuer:type_name -> google.protobuf.StringValue - 10, // 8: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.client_id:type_name -> google.protobuf.StringValue - 10, // 9: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.client_secret:type_name -> google.protobuf.StringValue - 13, // 10: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.max_age:type_name -> google.protobuf.UInt32Value - 10, // 11: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.api_url_prefix:type_name -> google.protobuf.StringValue - 14, // 12: controller.api.resources.authmethods.v1.AuthMethod.AuthorizedCollectionActionsEntry.value:type_name -> google.protobuf.ListValue - 13, // [13:13] is the sub-list for method output_type - 13, // [13:13] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 1, // 6: controller.api.resources.authmethods.v1.AuthMethod.password_auth_method_attributes:type_name -> controller.api.resources.authmethods.v1.PasswordAuthMethodAttributes + 2, // 7: controller.api.resources.authmethods.v1.AuthMethod.oidc_auth_methods_attributes:type_name -> controller.api.resources.authmethods.v1.OidcAuthMethodAttributes + 8, // 8: controller.api.resources.authmethods.v1.AuthMethod.authorized_collection_actions:type_name -> controller.api.resources.authmethods.v1.AuthMethod.AuthorizedCollectionActionsEntry + 10, // 9: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.issuer:type_name -> google.protobuf.StringValue + 10, // 10: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.client_id:type_name -> google.protobuf.StringValue + 10, // 11: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.client_secret:type_name -> google.protobuf.StringValue + 13, // 12: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.max_age:type_name -> google.protobuf.UInt32Value + 10, // 13: controller.api.resources.authmethods.v1.OidcAuthMethodAttributes.api_url_prefix:type_name -> google.protobuf.StringValue + 14, // 14: controller.api.resources.authmethods.v1.AuthMethod.AuthorizedCollectionActionsEntry.value:type_name -> google.protobuf.ListValue + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_controller_api_resources_authmethods_v1_auth_method_proto_init() } @@ -1101,6 +1176,11 @@ func file_controller_api_resources_authmethods_v1_auth_method_proto_init() { } } } + file_controller_api_resources_authmethods_v1_auth_method_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*AuthMethod_Attributes)(nil), + (*AuthMethod_PasswordAuthMethodAttributes)(nil), + (*AuthMethod_OidcAuthMethodsAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/sdk/pbs/controller/api/resources/authmethods/auth_method_taggable.go b/sdk/pbs/controller/api/resources/authmethods/auth_method_taggable.go index 97ec05b15..6b6b53693 100644 --- a/sdk/pbs/controller/api/resources/authmethods/auth_method_taggable.go +++ b/sdk/pbs/controller/api/resources/authmethods/auth_method_taggable.go @@ -16,87 +16,5 @@ func (req *AuthMethod) Tags() ([]encrypt.PointerTag, error) { Classification: encrypt.PublicClassification, }) } - if req.Attributes != nil { - switch req.Type { - case "oidc": - oidcTags := []encrypt.PointerTag{ - // public fields - { - Pointer: "/Attributes/Fields/state", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/issuer", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/client_id", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/client_secret_hmac", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/max_age", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/signing_algorithms", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/idp_ca_certs", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/api_url_prefix", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/callback_url", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/allowed_audiences", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/claims_scopes", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/account_claim_maps", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/disable_discovered_config_validation", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/dry_run", - Classification: encrypt.PublicClassification, - }, - // secrets - { - Pointer: "/Attributes/Fields/client_secret", - Classification: encrypt.SecretClassification, - }, - } - tags = append(tags, oidcTags...) - case "password": - pwTags := []encrypt.PointerTag{ - { - Pointer: "/Attributes/Fields/min_login_name_length", - Classification: encrypt.PublicClassification, - }, - { - Pointer: "/Attributes/Fields/min_password_length", - Classification: encrypt.PublicClassification, - }, - } - tags = append(tags, pwTags...) - } - } return tags, nil } From 1fd44ee0f1aaf35d428c746546e6f97f66cf3af2 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 8 Apr 2022 15:59:18 -0400 Subject: [PATCH 20/45] refact(subtypes): Remove return from transformations This return value is just a reference to the input, which is being mutated. We may as well make that clear via the signature, which will also simplify the new custom transformation function registration logic. --- internal/types/subtypes/interceptor.go | 37 ++++++++------------- internal/types/subtypes/interceptor_test.go | 8 ++--- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/internal/types/subtypes/interceptor.go b/internal/types/subtypes/interceptor.go index 9fe7e8bae..77656f203 100644 --- a/internal/types/subtypes/interceptor.go +++ b/internal/types/subtypes/interceptor.go @@ -93,7 +93,7 @@ func messageDomain(m proto.Message) string { // // Also note that for any of the id based lookups to function, the file that contains // the proto.Message definition must set the "domain" custom option. -func transformRequestAttributes(req proto.Message) (proto.Message, error) { +func transformRequestAttributes(req proto.Message) error { domain := messageDomain(req) r := req.ProtoReflect() @@ -115,7 +115,7 @@ func transformRequestAttributes(req proto.Message) (proto.Message, error) { case itemField != nil: itemR := itemField.Message() if itemR == nil { - return req, nil + return nil } id := fieldValue(r, idField) @@ -136,19 +136,15 @@ func transformRequestAttributes(req proto.Message) (proto.Message, error) { case typeField != nil && t != "": st = Subtype(t) default: // need either type or id - return req, nil - } - if err := convertAttributesToSubtype(item, st); err != nil { - return req, err + return nil } + return convertAttributesToSubtype(item, st) case idField != nil && attributesField != nil: id := r.Get(idField).String() st = SubtypeFromId(domain, id) - if err := convertAttributesToSubtype(req, st); err != nil { - return req, err - } + return convertAttributesToSubtype(req, st) } - return req, nil + return nil } func transformResponseItemAttributes(item proto.Message) error { @@ -206,7 +202,7 @@ func transformResponseItemAttributes(item proto.Message) error { // // other subtype attributes types // } // } -func transformResponseAttributes(res proto.Message) (proto.Message, error) { +func transformResponseAttributes(res proto.Message) error { r := res.ProtoReflect() fields := r.Descriptor().Fields() @@ -215,27 +211,25 @@ func transformResponseAttributes(res proto.Message) (proto.Message, error) { switch { case itemField != nil: if itemR := itemField.Message(); itemR == nil { - return res, nil + return nil } item := r.Get(itemField).Message().Interface() - if err := transformResponseItemAttributes(item); err != nil { - return res, err - } + return transformResponseItemAttributes(item) case itemsField != nil: if !itemsField.IsList() { - return res, nil + return nil } items := r.Get(itemsField).List() for i := 0; i < items.Len(); i++ { item := items.Get(i).Message().Interface() if err := transformResponseItemAttributes(item); err != nil { - return res, err + return err } } } - return res, nil + return nil } // AttributeTransformerInterceptor is a grpc server interceptor that will @@ -285,10 +279,8 @@ func transformResponseAttributes(res proto.Message) (proto.Message, error) { func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerInterceptor { const op = "subtypes.AttributeTransformInterceptor" return func(interceptorCtx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - var err error if reqMsg, ok := req.(proto.Message); ok { - req, err = transformRequestAttributes(reqMsg) - if err != nil { + if err := transformRequestAttributes(reqMsg); err != nil { return nil, handlers.InvalidArgumentErrorf("Error in provided request.", map[string]string{"attributes": "Attribute fields do not match the expected format."}) } @@ -297,8 +289,7 @@ func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerIntercep res, handlerErr := handler(interceptorCtx, req) if res, ok := res.(proto.Message); ok { - res, err = transformResponseAttributes(res) - if err != nil { + if err := transformResponseAttributes(res); err != nil { return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building attribute struct: %v", err) } } diff --git a/internal/types/subtypes/interceptor_test.go b/internal/types/subtypes/interceptor_test.go index 3a1585321..1e2c828f8 100644 --- a/internal/types/subtypes/interceptor_test.go +++ b/internal/types/subtypes/interceptor_test.go @@ -298,9 +298,9 @@ func TestTransformRequestAttributes(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got, err := transformRequestAttributes(tc.req) + err := transformRequest(tc.req) require.NoError(t, err) - assert.Empty(t, cmp.Diff(got, tc.expected, protocmp.Transform())) + assert.Empty(t, cmp.Diff(tc.req, tc.expected, protocmp.Transform())) }) } } @@ -582,9 +582,9 @@ func TestTransformResponseAttributes(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - got, err := transformResponseAttributes(tc.resp) + err := transformResponse(tc.resp) require.NoError(t, err) - assert.Empty(t, cmp.Diff(got, tc.expected, protocmp.Transform())) + assert.Empty(t, cmp.Diff(tc.resp, tc.expected, protocmp.Transform())) }) } } From 6d56fcd26f202c99e9172ee0cb4d240e610363c1 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 8 Apr 2022 16:01:00 -0400 Subject: [PATCH 21/45] feat(subtypes): Add new transformation registration option This allows the user to register a custom transformation callback for a specific protobuf message, in cases where the transformation is sufficiently complex for it to be cumbersome to formalise the logic through protobuf options. --- .../gen/testing/attribute/attribute.pb.go | 690 +++++++++++------- .../testing/attribute/v1/attribute.proto | 10 + internal/types/subtypes/interceptor.go | 20 +- internal/types/subtypes/interceptor_test.go | 87 +++ internal/types/subtypes/transformations.go | 83 +++ 5 files changed, 609 insertions(+), 281 deletions(-) create mode 100644 internal/types/subtypes/transformations.go diff --git a/internal/gen/testing/attribute/attribute.pb.go b/internal/gen/testing/attribute/attribute.pb.go index da0a789aa..7d51194c9 100644 --- a/internal/gen/testing/attribute/attribute.pb.go +++ b/internal/gen/testing/attribute/attribute.pb.go @@ -294,6 +294,102 @@ func (x *TestNoOneOf) GetAttributes() *structpb.Struct { return nil } +type TestCustomTransformation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SomeRandomId string `protobuf:"bytes,1,opt,name=some_random_id,json=someRandomId,proto3" json:"some_random_id,omitempty"` + SecondaryId string `protobuf:"bytes,2,opt,name=secondary_id,json=secondaryId,proto3" json:"secondary_id,omitempty"` + // Types that are assignable to Attrs: + // *TestCustomTransformation_Attributes + // *TestCustomTransformation_SubResourceAttributes + Attrs isTestCustomTransformation_Attrs `protobuf_oneof:"attrs"` +} + +func (x *TestCustomTransformation) Reset() { + *x = TestCustomTransformation{} + if protoimpl.UnsafeEnabled { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TestCustomTransformation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TestCustomTransformation) ProtoMessage() {} + +func (x *TestCustomTransformation) ProtoReflect() protoreflect.Message { + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TestCustomTransformation.ProtoReflect.Descriptor instead. +func (*TestCustomTransformation) Descriptor() ([]byte, []int) { + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{4} +} + +func (x *TestCustomTransformation) GetSomeRandomId() string { + if x != nil { + return x.SomeRandomId + } + return "" +} + +func (x *TestCustomTransformation) GetSecondaryId() string { + if x != nil { + return x.SecondaryId + } + return "" +} + +func (m *TestCustomTransformation) GetAttrs() isTestCustomTransformation_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + +func (x *TestCustomTransformation) GetAttributes() *structpb.Struct { + if x, ok := x.GetAttrs().(*TestCustomTransformation_Attributes); ok { + return x.Attributes + } + return nil +} + +func (x *TestCustomTransformation) GetSubResourceAttributes() *TestSubResourceAttributes { + if x, ok := x.GetAttrs().(*TestCustomTransformation_SubResourceAttributes); ok { + return x.SubResourceAttributes + } + return nil +} + +type isTestCustomTransformation_Attrs interface { + isTestCustomTransformation_Attrs() +} + +type TestCustomTransformation_Attributes struct { + Attributes *structpb.Struct `protobuf:"bytes,10,opt,name=attributes,proto3,oneof"` +} + +type TestCustomTransformation_SubResourceAttributes struct { + SubResourceAttributes *TestSubResourceAttributes `protobuf:"bytes,20,opt,name=sub_resource_attributes,json=subResourceAttributes,proto3,oneof"` +} + +func (*TestCustomTransformation_Attributes) isTestCustomTransformation_Attrs() {} + +func (*TestCustomTransformation_SubResourceAttributes) isTestCustomTransformation_Attrs() {} + type TestListResourceRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -303,7 +399,7 @@ type TestListResourceRequest struct { func (x *TestListResourceRequest) Reset() { *x = TestListResourceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[4] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -316,7 +412,7 @@ func (x *TestListResourceRequest) String() string { func (*TestListResourceRequest) ProtoMessage() {} func (x *TestListResourceRequest) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[4] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -329,7 +425,7 @@ func (x *TestListResourceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestListResourceRequest.ProtoReflect.Descriptor instead. func (*TestListResourceRequest) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{4} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{5} } type TestListResourceResponse struct { @@ -343,7 +439,7 @@ type TestListResourceResponse struct { func (x *TestListResourceResponse) Reset() { *x = TestListResourceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[5] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -356,7 +452,7 @@ func (x *TestListResourceResponse) String() string { func (*TestListResourceResponse) ProtoMessage() {} func (x *TestListResourceResponse) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[5] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -369,7 +465,7 @@ func (x *TestListResourceResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestListResourceResponse.ProtoReflect.Descriptor instead. func (*TestListResourceResponse) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{5} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{6} } func (x *TestListResourceResponse) GetItems() []*TestResource { @@ -390,7 +486,7 @@ type TestGetResourceRequest struct { func (x *TestGetResourceRequest) Reset() { *x = TestGetResourceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[6] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -403,7 +499,7 @@ func (x *TestGetResourceRequest) String() string { func (*TestGetResourceRequest) ProtoMessage() {} func (x *TestGetResourceRequest) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[6] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -416,7 +512,7 @@ func (x *TestGetResourceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestGetResourceRequest.ProtoReflect.Descriptor instead. func (*TestGetResourceRequest) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{6} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{7} } func (x *TestGetResourceRequest) GetId() string { @@ -437,7 +533,7 @@ type TestGetResourceResponse struct { func (x *TestGetResourceResponse) Reset() { *x = TestGetResourceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[7] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -450,7 +546,7 @@ func (x *TestGetResourceResponse) String() string { func (*TestGetResourceResponse) ProtoMessage() {} func (x *TestGetResourceResponse) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[7] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -463,7 +559,7 @@ func (x *TestGetResourceResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestGetResourceResponse.ProtoReflect.Descriptor instead. func (*TestGetResourceResponse) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{7} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{8} } func (x *TestGetResourceResponse) GetItem() *TestResource { @@ -484,7 +580,7 @@ type TestCreateResourceRequest struct { func (x *TestCreateResourceRequest) Reset() { *x = TestCreateResourceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[8] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -497,7 +593,7 @@ func (x *TestCreateResourceRequest) String() string { func (*TestCreateResourceRequest) ProtoMessage() {} func (x *TestCreateResourceRequest) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[8] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -510,7 +606,7 @@ func (x *TestCreateResourceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestCreateResourceRequest.ProtoReflect.Descriptor instead. func (*TestCreateResourceRequest) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{8} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{9} } func (x *TestCreateResourceRequest) GetItem() *TestResource { @@ -531,7 +627,7 @@ type TestCreateResourceResponse struct { func (x *TestCreateResourceResponse) Reset() { *x = TestCreateResourceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[9] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -544,7 +640,7 @@ func (x *TestCreateResourceResponse) String() string { func (*TestCreateResourceResponse) ProtoMessage() {} func (x *TestCreateResourceResponse) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[9] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -557,7 +653,7 @@ func (x *TestCreateResourceResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestCreateResourceResponse.ProtoReflect.Descriptor instead. func (*TestCreateResourceResponse) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{9} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{10} } func (x *TestCreateResourceResponse) GetItem() *TestResource { @@ -580,7 +676,7 @@ type TestUpdateResourceRequest struct { func (x *TestUpdateResourceRequest) Reset() { *x = TestUpdateResourceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[10] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -593,7 +689,7 @@ func (x *TestUpdateResourceRequest) String() string { func (*TestUpdateResourceRequest) ProtoMessage() {} func (x *TestUpdateResourceRequest) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[10] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -606,7 +702,7 @@ func (x *TestUpdateResourceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestUpdateResourceRequest.ProtoReflect.Descriptor instead. func (*TestUpdateResourceRequest) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{10} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{11} } func (x *TestUpdateResourceRequest) GetId() string { @@ -641,7 +737,7 @@ type TestUpdateResourceResponse struct { func (x *TestUpdateResourceResponse) Reset() { *x = TestUpdateResourceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[11] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -654,7 +750,7 @@ func (x *TestUpdateResourceResponse) String() string { func (*TestUpdateResourceResponse) ProtoMessage() {} func (x *TestUpdateResourceResponse) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[11] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -667,7 +763,7 @@ func (x *TestUpdateResourceResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestUpdateResourceResponse.ProtoReflect.Descriptor instead. func (*TestUpdateResourceResponse) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{11} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{12} } func (x *TestUpdateResourceResponse) GetItem() *TestResource { @@ -688,7 +784,7 @@ type TestRequestNoItem struct { func (x *TestRequestNoItem) Reset() { *x = TestRequestNoItem{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[12] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -701,7 +797,7 @@ func (x *TestRequestNoItem) String() string { func (*TestRequestNoItem) ProtoMessage() {} func (x *TestRequestNoItem) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[12] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -714,7 +810,7 @@ func (x *TestRequestNoItem) ProtoReflect() protoreflect.Message { // Deprecated: Use TestRequestNoItem.ProtoReflect.Descriptor instead. func (*TestRequestNoItem) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{12} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{13} } func (x *TestRequestNoItem) GetName() string { @@ -735,7 +831,7 @@ type TestRequestItemNotMessage struct { func (x *TestRequestItemNotMessage) Reset() { *x = TestRequestItemNotMessage{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[13] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -748,7 +844,7 @@ func (x *TestRequestItemNotMessage) String() string { func (*TestRequestItemNotMessage) ProtoMessage() {} func (x *TestRequestItemNotMessage) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[13] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -761,7 +857,7 @@ func (x *TestRequestItemNotMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use TestRequestItemNotMessage.ProtoReflect.Descriptor instead. func (*TestRequestItemNotMessage) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{13} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{14} } func (x *TestRequestItemNotMessage) GetItem() string { @@ -782,7 +878,7 @@ type TestItemNoType struct { func (x *TestItemNoType) Reset() { *x = TestItemNoType{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[14] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -795,7 +891,7 @@ func (x *TestItemNoType) String() string { func (*TestItemNoType) ProtoMessage() {} func (x *TestItemNoType) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[14] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -808,7 +904,7 @@ func (x *TestItemNoType) ProtoReflect() protoreflect.Message { // Deprecated: Use TestItemNoType.ProtoReflect.Descriptor instead. func (*TestItemNoType) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{14} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{15} } func (x *TestItemNoType) GetId() string { @@ -829,7 +925,7 @@ type TestRequestItemNoType struct { func (x *TestRequestItemNoType) Reset() { *x = TestRequestItemNoType{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[15] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -842,7 +938,7 @@ func (x *TestRequestItemNoType) String() string { func (*TestRequestItemNoType) ProtoMessage() {} func (x *TestRequestItemNoType) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[15] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -855,7 +951,7 @@ func (x *TestRequestItemNoType) ProtoReflect() protoreflect.Message { // Deprecated: Use TestRequestItemNoType.ProtoReflect.Descriptor instead. func (*TestRequestItemNoType) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{15} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{16} } func (x *TestRequestItemNoType) GetItem() *TestItemNoType { @@ -880,7 +976,7 @@ type TestNoItemAttributes struct { func (x *TestNoItemAttributes) Reset() { *x = TestNoItemAttributes{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[16] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -893,7 +989,7 @@ func (x *TestNoItemAttributes) String() string { func (*TestNoItemAttributes) ProtoMessage() {} func (x *TestNoItemAttributes) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[16] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -906,7 +1002,7 @@ func (x *TestNoItemAttributes) ProtoReflect() protoreflect.Message { // Deprecated: Use TestNoItemAttributes.ProtoReflect.Descriptor instead. func (*TestNoItemAttributes) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{16} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{17} } func (x *TestNoItemAttributes) GetId() string { @@ -964,7 +1060,7 @@ type TestCreateNoOneOfRequest struct { func (x *TestCreateNoOneOfRequest) Reset() { *x = TestCreateNoOneOfRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[17] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -977,7 +1073,7 @@ func (x *TestCreateNoOneOfRequest) String() string { func (*TestCreateNoOneOfRequest) ProtoMessage() {} func (x *TestCreateNoOneOfRequest) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[17] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -990,7 +1086,7 @@ func (x *TestCreateNoOneOfRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestCreateNoOneOfRequest.ProtoReflect.Descriptor instead. func (*TestCreateNoOneOfRequest) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{17} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{18} } func (x *TestCreateNoOneOfRequest) GetItem() *TestNoOneOf { @@ -1012,7 +1108,7 @@ type TestUpdateNoOneOfRequest struct { func (x *TestUpdateNoOneOfRequest) Reset() { *x = TestUpdateNoOneOfRequest{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[18] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1025,7 +1121,7 @@ func (x *TestUpdateNoOneOfRequest) String() string { func (*TestUpdateNoOneOfRequest) ProtoMessage() {} func (x *TestUpdateNoOneOfRequest) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[18] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1038,7 +1134,7 @@ func (x *TestUpdateNoOneOfRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TestUpdateNoOneOfRequest.ProtoReflect.Descriptor instead. func (*TestUpdateNoOneOfRequest) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{18} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{19} } func (x *TestUpdateNoOneOfRequest) GetId() string { @@ -1066,7 +1162,7 @@ type TestResponseNoItem struct { func (x *TestResponseNoItem) Reset() { *x = TestResponseNoItem{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[19] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1079,7 +1175,7 @@ func (x *TestResponseNoItem) String() string { func (*TestResponseNoItem) ProtoMessage() {} func (x *TestResponseNoItem) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[19] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1092,7 +1188,7 @@ func (x *TestResponseNoItem) ProtoReflect() protoreflect.Message { // Deprecated: Use TestResponseNoItem.ProtoReflect.Descriptor instead. func (*TestResponseNoItem) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{19} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{20} } func (x *TestResponseNoItem) GetName() string { @@ -1113,7 +1209,7 @@ type TestResponseItemNotMessage struct { func (x *TestResponseItemNotMessage) Reset() { *x = TestResponseItemNotMessage{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[20] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1126,7 +1222,7 @@ func (x *TestResponseItemNotMessage) String() string { func (*TestResponseItemNotMessage) ProtoMessage() {} func (x *TestResponseItemNotMessage) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[20] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1139,7 +1235,7 @@ func (x *TestResponseItemNotMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use TestResponseItemNotMessage.ProtoReflect.Descriptor instead. func (*TestResponseItemNotMessage) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{20} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{21} } func (x *TestResponseItemNotMessage) GetItem() string { @@ -1160,7 +1256,7 @@ type TestResponseItemNoType struct { func (x *TestResponseItemNoType) Reset() { *x = TestResponseItemNoType{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[21] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1173,7 +1269,7 @@ func (x *TestResponseItemNoType) String() string { func (*TestResponseItemNoType) ProtoMessage() {} func (x *TestResponseItemNoType) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[21] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1186,7 +1282,7 @@ func (x *TestResponseItemNoType) ProtoReflect() protoreflect.Message { // Deprecated: Use TestResponseItemNoType.ProtoReflect.Descriptor instead. func (*TestResponseItemNoType) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{21} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{22} } func (x *TestResponseItemNoType) GetItem() *TestItemNoType { @@ -1207,7 +1303,7 @@ type TestCreateNoOneOfResponse struct { func (x *TestCreateNoOneOfResponse) Reset() { *x = TestCreateNoOneOfResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[22] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1220,7 +1316,7 @@ func (x *TestCreateNoOneOfResponse) String() string { func (*TestCreateNoOneOfResponse) ProtoMessage() {} func (x *TestCreateNoOneOfResponse) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[22] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1233,7 +1329,7 @@ func (x *TestCreateNoOneOfResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestCreateNoOneOfResponse.ProtoReflect.Descriptor instead. func (*TestCreateNoOneOfResponse) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{22} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{23} } func (x *TestCreateNoOneOfResponse) GetItem() *TestNoOneOf { @@ -1254,7 +1350,7 @@ type TestUpdateNoOneOfResponse struct { func (x *TestUpdateNoOneOfResponse) Reset() { *x = TestUpdateNoOneOfResponse{} if protoimpl.UnsafeEnabled { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[23] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1267,7 +1363,7 @@ func (x *TestUpdateNoOneOfResponse) String() string { func (*TestUpdateNoOneOfResponse) ProtoMessage() {} func (x *TestUpdateNoOneOfResponse) ProtoReflect() protoreflect.Message { - mi := &file_testing_attribute_v1_attribute_proto_msgTypes[23] + mi := &file_testing_attribute_v1_attribute_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1280,7 +1376,7 @@ func (x *TestUpdateNoOneOfResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TestUpdateNoOneOfResponse.ProtoReflect.Descriptor instead. func (*TestUpdateNoOneOfResponse) Descriptor() ([]byte, []int) { - return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{23} + return file_testing_attribute_v1_attribute_proto_rawDescGZIP(), []int{24} } func (x *TestUpdateNoOneOfResponse) GetItem() *TestNoOneOf { @@ -1340,159 +1436,176 @@ var file_testing_attribute_v1_attribute_proto_rawDesc = []byte{ 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, - 0x19, 0x0a, 0x17, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x54, 0x0a, 0x18, 0x54, 0x65, - 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x22, 0x28, 0x0a, 0x16, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x17, 0x54, 0x65, - 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x53, 0x0a, - 0x19, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x54, 0x0a, 0x1a, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa1, 0x01, 0x0a, 0x19, 0x54, 0x65, 0x73, - 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x54, 0x0a, 0x1a, - 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x92, 0x02, 0x0a, 0x18, 0x54, 0x65, 0x73, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0e, + 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x6f, 0x6d, 0x65, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, + 0x61, 0x72, 0x79, 0x49, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x69, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, + 0x74, 0x74, 0x72, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x54, 0x0a, 0x18, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x05, + 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x28, 0x0a, 0x16, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x51, 0x0a, 0x17, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x27, 0x0a, 0x11, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x19, 0x54, - 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, - 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x20, 0x0a, 0x0e, - 0x54, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, - 0x0a, 0x15, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, - 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x22, 0xf4, 0x01, 0x0a, 0x14, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x0b, 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, 0x7b, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, + 0x65, 0x6d, 0x22, 0x53, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x54, 0x0a, 0x1a, 0x54, 0x65, 0x73, 0x74, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa1, 0x01, + 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x54, 0x0a, 0x1a, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x36, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x27, 0x0a, 0x11, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x22, 0x2f, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x22, 0x20, 0x0a, 0x0e, 0x54, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x15, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xf4, 0x01, 0x0a, 0x14, 0x54, 0x65, 0x73, 0x74, 0x4e, + 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x46, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x0a, 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, 0x0b, 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, 0x7b, 0x0a, 0x17, 0x73, 0x75, 0x62, 0x5f, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0x9a, 0xe3, 0x29, 0x0c, 0x73, + 0x75, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0x9a, 0xe3, 0x29, 0x0c, 0x73, 0x75, 0x62, 0x5f, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x15, 0x73, 0x75, 0x62, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, - 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x51, 0x0a, 0x18, 0x54, 0x65, 0x73, 0x74, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x75, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x51, 0x0a, + 0x18, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, + 0x4f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, + 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x22, 0x61, 0x0a, 0x18, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, + 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x22, 0x28, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, + 0x1a, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, + 0x6d, 0x4e, 0x6f, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, + 0x52, 0x0a, 0x16, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, + 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, + 0x65, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x22, 0x52, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, + 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x52, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, - 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x61, 0x0a, 0x18, 0x54, - 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x28, - 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4e, 0x6f, - 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x1a, 0x54, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x52, 0x0a, 0x16, 0x54, 0x65, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x6f, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x49, 0x74, - 0x65, 0x6d, 0x4e, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x52, - 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x4f, 0x6e, - 0x65, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x52, 0x0a, 0x19, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x35, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x4f, 0x6e, 0x65, 0x4f, 0x66, - 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xc1, 0x05, 0x0a, 0x13, 0x54, 0x65, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9b, - 0x01, 0x0a, 0x10, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x28, 0x92, 0x41, 0x0b, 0x12, 0x09, 0x54, 0x65, 0x73, 0x74, 0x20, 0x6c, 0x69, - 0x73, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, - 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0xaf, 0x01, 0x0a, - 0x12, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x92, 0x41, 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, - 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x12, - 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb4, - 0x01, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, - 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x0d, 0x12, 0x0b, 0x54, - 0x65, 0x73, 0x74, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, - 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa2, 0x01, 0x0a, 0x0f, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2c, 0x2e, 0x74, 0x65, 0x73, 0x74, - 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x4f, 0x6e, 0x65, 0x4f, 0x66, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0xc1, 0x05, 0x0a, 0x13, + 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x9b, 0x01, 0x0a, 0x10, 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, - 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x92, 0x41, 0x0a, 0x12, 0x08, 0x54, 0x65, 0x73, - 0x74, 0x20, 0x67, 0x65, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x17, 0x2f, 0x76, 0x31, - 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, - 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x42, 0x50, 0x5a, 0x46, 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, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, - 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x3b, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0xa2, 0xe3, 0x29, 0x04, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x92, 0x41, 0x0b, 0x12, 0x09, 0x54, 0x65, + 0x73, 0x74, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, + 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x12, 0xaf, 0x01, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x92, 0x41, 0x0d, + 0x12, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x20, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x12, 0xb4, 0x01, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, 0x74, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x74, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, + 0x41, 0x0d, 0x12, 0x0b, 0x54, 0x65, 0x73, 0x74, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa2, 0x01, 0x0a, 0x0f, 0x54, + 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2c, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x92, 0x41, 0x0a, + 0x12, 0x08, 0x54, 0x65, 0x73, 0x74, 0x20, 0x67, 0x65, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, + 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x42, + 0x50, 0x5a, 0x46, 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, 0x74, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x3b, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0xa2, 0xe3, 0x29, 0x04, 0x74, 0x65, 0x73, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1507,67 +1620,70 @@ func file_testing_attribute_v1_attribute_proto_rawDescGZIP() []byte { return file_testing_attribute_v1_attribute_proto_rawDescData } -var file_testing_attribute_v1_attribute_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_testing_attribute_v1_attribute_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_testing_attribute_v1_attribute_proto_goTypes = []interface{}{ (*TestResource)(nil), // 0: testing.attribute.v1.TestResource (*TestSubResourceAttributes)(nil), // 1: testing.attribute.v1.TestSubResourceAttributes (*TestNoAttributes)(nil), // 2: testing.attribute.v1.TestNoAttributes (*TestNoOneOf)(nil), // 3: testing.attribute.v1.TestNoOneOf - (*TestListResourceRequest)(nil), // 4: testing.attribute.v1.TestListResourceRequest - (*TestListResourceResponse)(nil), // 5: testing.attribute.v1.TestListResourceResponse - (*TestGetResourceRequest)(nil), // 6: testing.attribute.v1.TestGetResourceRequest - (*TestGetResourceResponse)(nil), // 7: testing.attribute.v1.TestGetResourceResponse - (*TestCreateResourceRequest)(nil), // 8: testing.attribute.v1.TestCreateResourceRequest - (*TestCreateResourceResponse)(nil), // 9: testing.attribute.v1.TestCreateResourceResponse - (*TestUpdateResourceRequest)(nil), // 10: testing.attribute.v1.TestUpdateResourceRequest - (*TestUpdateResourceResponse)(nil), // 11: testing.attribute.v1.TestUpdateResourceResponse - (*TestRequestNoItem)(nil), // 12: testing.attribute.v1.TestRequestNoItem - (*TestRequestItemNotMessage)(nil), // 13: testing.attribute.v1.TestRequestItemNotMessage - (*TestItemNoType)(nil), // 14: testing.attribute.v1.TestItemNoType - (*TestRequestItemNoType)(nil), // 15: testing.attribute.v1.TestRequestItemNoType - (*TestNoItemAttributes)(nil), // 16: testing.attribute.v1.TestNoItemAttributes - (*TestCreateNoOneOfRequest)(nil), // 17: testing.attribute.v1.TestCreateNoOneOfRequest - (*TestUpdateNoOneOfRequest)(nil), // 18: testing.attribute.v1.TestUpdateNoOneOfRequest - (*TestResponseNoItem)(nil), // 19: testing.attribute.v1.TestResponseNoItem - (*TestResponseItemNotMessage)(nil), // 20: testing.attribute.v1.TestResponseItemNotMessage - (*TestResponseItemNoType)(nil), // 21: testing.attribute.v1.TestResponseItemNoType - (*TestCreateNoOneOfResponse)(nil), // 22: testing.attribute.v1.TestCreateNoOneOfResponse - (*TestUpdateNoOneOfResponse)(nil), // 23: testing.attribute.v1.TestUpdateNoOneOfResponse - (*structpb.Struct)(nil), // 24: google.protobuf.Struct - (*fieldmaskpb.FieldMask)(nil), // 25: google.protobuf.FieldMask + (*TestCustomTransformation)(nil), // 4: testing.attribute.v1.TestCustomTransformation + (*TestListResourceRequest)(nil), // 5: testing.attribute.v1.TestListResourceRequest + (*TestListResourceResponse)(nil), // 6: testing.attribute.v1.TestListResourceResponse + (*TestGetResourceRequest)(nil), // 7: testing.attribute.v1.TestGetResourceRequest + (*TestGetResourceResponse)(nil), // 8: testing.attribute.v1.TestGetResourceResponse + (*TestCreateResourceRequest)(nil), // 9: testing.attribute.v1.TestCreateResourceRequest + (*TestCreateResourceResponse)(nil), // 10: testing.attribute.v1.TestCreateResourceResponse + (*TestUpdateResourceRequest)(nil), // 11: testing.attribute.v1.TestUpdateResourceRequest + (*TestUpdateResourceResponse)(nil), // 12: testing.attribute.v1.TestUpdateResourceResponse + (*TestRequestNoItem)(nil), // 13: testing.attribute.v1.TestRequestNoItem + (*TestRequestItemNotMessage)(nil), // 14: testing.attribute.v1.TestRequestItemNotMessage + (*TestItemNoType)(nil), // 15: testing.attribute.v1.TestItemNoType + (*TestRequestItemNoType)(nil), // 16: testing.attribute.v1.TestRequestItemNoType + (*TestNoItemAttributes)(nil), // 17: testing.attribute.v1.TestNoItemAttributes + (*TestCreateNoOneOfRequest)(nil), // 18: testing.attribute.v1.TestCreateNoOneOfRequest + (*TestUpdateNoOneOfRequest)(nil), // 19: testing.attribute.v1.TestUpdateNoOneOfRequest + (*TestResponseNoItem)(nil), // 20: testing.attribute.v1.TestResponseNoItem + (*TestResponseItemNotMessage)(nil), // 21: testing.attribute.v1.TestResponseItemNotMessage + (*TestResponseItemNoType)(nil), // 22: testing.attribute.v1.TestResponseItemNoType + (*TestCreateNoOneOfResponse)(nil), // 23: testing.attribute.v1.TestCreateNoOneOfResponse + (*TestUpdateNoOneOfResponse)(nil), // 24: testing.attribute.v1.TestUpdateNoOneOfResponse + (*structpb.Struct)(nil), // 25: google.protobuf.Struct + (*fieldmaskpb.FieldMask)(nil), // 26: google.protobuf.FieldMask } var file_testing_attribute_v1_attribute_proto_depIdxs = []int32{ - 24, // 0: testing.attribute.v1.TestResource.attributes:type_name -> google.protobuf.Struct + 25, // 0: testing.attribute.v1.TestResource.attributes:type_name -> google.protobuf.Struct 1, // 1: testing.attribute.v1.TestResource.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes - 24, // 2: testing.attribute.v1.TestNoOneOf.attributes:type_name -> google.protobuf.Struct - 0, // 3: testing.attribute.v1.TestListResourceResponse.items:type_name -> testing.attribute.v1.TestResource - 0, // 4: testing.attribute.v1.TestGetResourceResponse.item:type_name -> testing.attribute.v1.TestResource - 0, // 5: testing.attribute.v1.TestCreateResourceRequest.item:type_name -> testing.attribute.v1.TestResource - 0, // 6: testing.attribute.v1.TestCreateResourceResponse.item:type_name -> testing.attribute.v1.TestResource - 0, // 7: testing.attribute.v1.TestUpdateResourceRequest.item:type_name -> testing.attribute.v1.TestResource - 25, // 8: testing.attribute.v1.TestUpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask - 0, // 9: testing.attribute.v1.TestUpdateResourceResponse.item:type_name -> testing.attribute.v1.TestResource - 14, // 10: testing.attribute.v1.TestRequestItemNoType.item:type_name -> testing.attribute.v1.TestItemNoType - 24, // 11: testing.attribute.v1.TestNoItemAttributes.attributes:type_name -> google.protobuf.Struct - 1, // 12: testing.attribute.v1.TestNoItemAttributes.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes - 3, // 13: testing.attribute.v1.TestCreateNoOneOfRequest.item:type_name -> testing.attribute.v1.TestNoOneOf - 3, // 14: testing.attribute.v1.TestUpdateNoOneOfRequest.item:type_name -> testing.attribute.v1.TestNoOneOf - 14, // 15: testing.attribute.v1.TestResponseItemNoType.item:type_name -> testing.attribute.v1.TestItemNoType - 3, // 16: testing.attribute.v1.TestCreateNoOneOfResponse.item:type_name -> testing.attribute.v1.TestNoOneOf - 3, // 17: testing.attribute.v1.TestUpdateNoOneOfResponse.item:type_name -> testing.attribute.v1.TestNoOneOf - 4, // 18: testing.attribute.v1.TestResourceService.TestListResource:input_type -> testing.attribute.v1.TestListResourceRequest - 8, // 19: testing.attribute.v1.TestResourceService.TestCreateResource:input_type -> testing.attribute.v1.TestCreateResourceRequest - 10, // 20: testing.attribute.v1.TestResourceService.TestUpdateResource:input_type -> testing.attribute.v1.TestUpdateResourceRequest - 6, // 21: testing.attribute.v1.TestResourceService.TestGetResource:input_type -> testing.attribute.v1.TestGetResourceRequest - 5, // 22: testing.attribute.v1.TestResourceService.TestListResource:output_type -> testing.attribute.v1.TestListResourceResponse - 9, // 23: testing.attribute.v1.TestResourceService.TestCreateResource:output_type -> testing.attribute.v1.TestCreateResourceResponse - 11, // 24: testing.attribute.v1.TestResourceService.TestUpdateResource:output_type -> testing.attribute.v1.TestUpdateResourceResponse - 7, // 25: testing.attribute.v1.TestResourceService.TestGetResource:output_type -> testing.attribute.v1.TestGetResourceResponse - 22, // [22:26] is the sub-list for method output_type - 18, // [18:22] is the sub-list for method input_type - 18, // [18:18] is the sub-list for extension type_name - 18, // [18:18] is the sub-list for extension extendee - 0, // [0:18] is the sub-list for field type_name + 25, // 2: testing.attribute.v1.TestNoOneOf.attributes:type_name -> google.protobuf.Struct + 25, // 3: testing.attribute.v1.TestCustomTransformation.attributes:type_name -> google.protobuf.Struct + 1, // 4: testing.attribute.v1.TestCustomTransformation.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes + 0, // 5: testing.attribute.v1.TestListResourceResponse.items:type_name -> testing.attribute.v1.TestResource + 0, // 6: testing.attribute.v1.TestGetResourceResponse.item:type_name -> testing.attribute.v1.TestResource + 0, // 7: testing.attribute.v1.TestCreateResourceRequest.item:type_name -> testing.attribute.v1.TestResource + 0, // 8: testing.attribute.v1.TestCreateResourceResponse.item:type_name -> testing.attribute.v1.TestResource + 0, // 9: testing.attribute.v1.TestUpdateResourceRequest.item:type_name -> testing.attribute.v1.TestResource + 26, // 10: testing.attribute.v1.TestUpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 11: testing.attribute.v1.TestUpdateResourceResponse.item:type_name -> testing.attribute.v1.TestResource + 15, // 12: testing.attribute.v1.TestRequestItemNoType.item:type_name -> testing.attribute.v1.TestItemNoType + 25, // 13: testing.attribute.v1.TestNoItemAttributes.attributes:type_name -> google.protobuf.Struct + 1, // 14: testing.attribute.v1.TestNoItemAttributes.sub_resource_attributes:type_name -> testing.attribute.v1.TestSubResourceAttributes + 3, // 15: testing.attribute.v1.TestCreateNoOneOfRequest.item:type_name -> testing.attribute.v1.TestNoOneOf + 3, // 16: testing.attribute.v1.TestUpdateNoOneOfRequest.item:type_name -> testing.attribute.v1.TestNoOneOf + 15, // 17: testing.attribute.v1.TestResponseItemNoType.item:type_name -> testing.attribute.v1.TestItemNoType + 3, // 18: testing.attribute.v1.TestCreateNoOneOfResponse.item:type_name -> testing.attribute.v1.TestNoOneOf + 3, // 19: testing.attribute.v1.TestUpdateNoOneOfResponse.item:type_name -> testing.attribute.v1.TestNoOneOf + 5, // 20: testing.attribute.v1.TestResourceService.TestListResource:input_type -> testing.attribute.v1.TestListResourceRequest + 9, // 21: testing.attribute.v1.TestResourceService.TestCreateResource:input_type -> testing.attribute.v1.TestCreateResourceRequest + 11, // 22: testing.attribute.v1.TestResourceService.TestUpdateResource:input_type -> testing.attribute.v1.TestUpdateResourceRequest + 7, // 23: testing.attribute.v1.TestResourceService.TestGetResource:input_type -> testing.attribute.v1.TestGetResourceRequest + 6, // 24: testing.attribute.v1.TestResourceService.TestListResource:output_type -> testing.attribute.v1.TestListResourceResponse + 10, // 25: testing.attribute.v1.TestResourceService.TestCreateResource:output_type -> testing.attribute.v1.TestCreateResourceResponse + 12, // 26: testing.attribute.v1.TestResourceService.TestUpdateResource:output_type -> testing.attribute.v1.TestUpdateResourceResponse + 8, // 27: testing.attribute.v1.TestResourceService.TestGetResource:output_type -> testing.attribute.v1.TestGetResourceResponse + 24, // [24:28] is the sub-list for method output_type + 20, // [20:24] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_testing_attribute_v1_attribute_proto_init() } @@ -1625,7 +1741,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestListResourceRequest); i { + switch v := v.(*TestCustomTransformation); i { case 0: return &v.state case 1: @@ -1637,7 +1753,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestListResourceResponse); i { + switch v := v.(*TestListResourceRequest); i { case 0: return &v.state case 1: @@ -1649,7 +1765,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestGetResourceRequest); i { + switch v := v.(*TestListResourceResponse); i { case 0: return &v.state case 1: @@ -1661,7 +1777,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestGetResourceResponse); i { + switch v := v.(*TestGetResourceRequest); i { case 0: return &v.state case 1: @@ -1673,7 +1789,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestCreateResourceRequest); i { + switch v := v.(*TestGetResourceResponse); i { case 0: return &v.state case 1: @@ -1685,7 +1801,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestCreateResourceResponse); i { + switch v := v.(*TestCreateResourceRequest); i { case 0: return &v.state case 1: @@ -1697,7 +1813,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestUpdateResourceRequest); i { + switch v := v.(*TestCreateResourceResponse); i { case 0: return &v.state case 1: @@ -1709,7 +1825,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestUpdateResourceResponse); i { + switch v := v.(*TestUpdateResourceRequest); i { case 0: return &v.state case 1: @@ -1721,7 +1837,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestRequestNoItem); i { + switch v := v.(*TestUpdateResourceResponse); i { case 0: return &v.state case 1: @@ -1733,7 +1849,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestRequestItemNotMessage); i { + switch v := v.(*TestRequestNoItem); i { case 0: return &v.state case 1: @@ -1745,7 +1861,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestItemNoType); i { + switch v := v.(*TestRequestItemNotMessage); i { case 0: return &v.state case 1: @@ -1757,7 +1873,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestRequestItemNoType); i { + switch v := v.(*TestItemNoType); i { case 0: return &v.state case 1: @@ -1769,7 +1885,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestNoItemAttributes); i { + switch v := v.(*TestRequestItemNoType); i { case 0: return &v.state case 1: @@ -1781,7 +1897,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestCreateNoOneOfRequest); i { + switch v := v.(*TestNoItemAttributes); i { case 0: return &v.state case 1: @@ -1793,7 +1909,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestUpdateNoOneOfRequest); i { + switch v := v.(*TestCreateNoOneOfRequest); i { case 0: return &v.state case 1: @@ -1805,7 +1921,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestResponseNoItem); i { + switch v := v.(*TestUpdateNoOneOfRequest); i { case 0: return &v.state case 1: @@ -1817,7 +1933,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestResponseItemNotMessage); i { + switch v := v.(*TestResponseNoItem); i { case 0: return &v.state case 1: @@ -1829,7 +1945,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestResponseItemNoType); i { + switch v := v.(*TestResponseItemNotMessage); i { case 0: return &v.state case 1: @@ -1841,7 +1957,7 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestCreateNoOneOfResponse); i { + switch v := v.(*TestResponseItemNoType); i { case 0: return &v.state case 1: @@ -1853,6 +1969,18 @@ func file_testing_attribute_v1_attribute_proto_init() { } } file_testing_attribute_v1_attribute_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TestCreateNoOneOfResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testing_attribute_v1_attribute_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TestUpdateNoOneOfResponse); i { case 0: return &v.state @@ -1869,7 +1997,11 @@ func file_testing_attribute_v1_attribute_proto_init() { (*TestResource_Attributes)(nil), (*TestResource_SubResourceAttributes)(nil), } - file_testing_attribute_v1_attribute_proto_msgTypes[16].OneofWrappers = []interface{}{ + file_testing_attribute_v1_attribute_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*TestCustomTransformation_Attributes)(nil), + (*TestCustomTransformation_SubResourceAttributes)(nil), + } + file_testing_attribute_v1_attribute_proto_msgTypes[17].OneofWrappers = []interface{}{ (*TestNoItemAttributes_Attributes)(nil), (*TestNoItemAttributes_SubResourceAttributes)(nil), } @@ -1879,7 +2011,7 @@ func file_testing_attribute_v1_attribute_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_testing_attribute_v1_attribute_proto_rawDesc, NumEnums: 0, - NumMessages: 24, + NumMessages: 25, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/proto/testing/attribute/v1/attribute.proto b/internal/proto/testing/attribute/v1/attribute.proto index 0d921d785..4a06544ed 100644 --- a/internal/proto/testing/attribute/v1/attribute.proto +++ b/internal/proto/testing/attribute/v1/attribute.proto @@ -40,6 +40,16 @@ message TestNoOneOf { google.protobuf.Struct attributes = 10; } +message TestCustomTransformation { + string some_random_id = 1; + string secondary_id = 2; + + oneof attrs { + google.protobuf.Struct attributes = 10; + TestSubResourceAttributes sub_resource_attributes = 20; + } +} + service TestResourceService { rpc TestListResource(TestListResourceRequest) returns (TestListResourceResponse) { option (google.api.http) = { diff --git a/internal/types/subtypes/interceptor.go b/internal/types/subtypes/interceptor.go index 77656f203..b9dc9d578 100644 --- a/internal/types/subtypes/interceptor.go +++ b/internal/types/subtypes/interceptor.go @@ -172,6 +172,14 @@ func transformResponseItemAttributes(item proto.Message) error { return convertAttributesToDefault(item, st) } +func transformRequest(msg proto.Message) error { + fqn := msg.ProtoReflect().Descriptor().FullName() + if fn, ok := globalTransformationRegistry.requestTransformationFuncs[fqn]; ok { + return fn(msg) + } + return transformRequestAttributes(msg) +} + // transformResponseAttributes will modify the response proto.Message, setting // any subtype attribute fields into the default structpb.Struct field. It looks // for some specific structure in the proto.Message to identify that it is a @@ -232,6 +240,14 @@ func transformResponseAttributes(res proto.Message) error { return nil } +func transformResponse(msg proto.Message) error { + fqn := msg.ProtoReflect().Descriptor().FullName() + if fn, ok := globalTransformationRegistry.responseTransformationFuncs[fqn]; ok { + return fn(msg) + } + return transformResponseAttributes(msg) +} + // AttributeTransformerInterceptor is a grpc server interceptor that will // transform subtype attributes for requests and responses. This will only // modify requests and responses that adhere to a specific structure and is done @@ -280,7 +296,7 @@ func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerIntercep const op = "subtypes.AttributeTransformInterceptor" return func(interceptorCtx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { if reqMsg, ok := req.(proto.Message); ok { - if err := transformRequestAttributes(reqMsg); err != nil { + if err := transformRequest(reqMsg); err != nil { return nil, handlers.InvalidArgumentErrorf("Error in provided request.", map[string]string{"attributes": "Attribute fields do not match the expected format."}) } @@ -289,7 +305,7 @@ func AttributeTransformerInterceptor(_ context.Context) grpc.UnaryServerIntercep res, handlerErr := handler(interceptorCtx, req) if res, ok := res.(proto.Message); ok { - if err := transformResponseAttributes(res); err != nil { + if err := transformResponse(res); err != nil { return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building attribute struct: %v", err) } } diff --git a/internal/types/subtypes/interceptor_test.go b/internal/types/subtypes/interceptor_test.go index 1e2c828f8..086ada728 100644 --- a/internal/types/subtypes/interceptor_test.go +++ b/internal/types/subtypes/interceptor_test.go @@ -588,3 +588,90 @@ func TestTransformResponseAttributes(t *testing.T) { }) } } + +func TestCustomTransformRequest(t *testing.T) { + RegisterRequestTransformationFunc( + &attribute.TestCustomTransformation{}, + func(m proto.Message) error { + msg, ok := m.(*attribute.TestCustomTransformation) + require.True(t, ok, "wrong message passed to request transformation callback") + if msg.SomeRandomId == "some_random_id" && msg.SecondaryId == "secondary_id" { + newAttrs := &attribute.TestSubResourceAttributes{} + err := structToProto(msg.GetAttributes(), newAttrs) + require.NoError(t, err) + msg.Attrs = &attribute.TestCustomTransformation_SubResourceAttributes{ + SubResourceAttributes: newAttrs, + } + } + return nil + }, + ) + request := &attribute.TestCustomTransformation{ + SomeRandomId: "some_random_id", + SecondaryId: "secondary_id", + Attrs: &attribute.TestCustomTransformation_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + } + expected := &attribute.TestCustomTransformation{ + SomeRandomId: "some_random_id", + SecondaryId: "secondary_id", + Attrs: &attribute.TestCustomTransformation_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + } + + err := transformRequest(request) + require.NoError(t, err) + assert.Empty(t, cmp.Diff(request, expected, protocmp.Transform())) +} + +func TestCustomTransformResponse(t *testing.T) { + RegisterResponseTransformationFunc( + &attribute.TestCustomTransformation{}, + func(m proto.Message) error { + msg, ok := m.(*attribute.TestCustomTransformation) + require.True(t, ok, "wrong message passed to response transformation callback") + if msg.SomeRandomId == "some_random_id" && msg.SecondaryId == "secondary_id" { + newAttrs, err := protoToStruct(msg.GetSubResourceAttributes()) + require.NoError(t, err) + msg.Attrs = &attribute.TestCustomTransformation_Attributes{ + Attributes: newAttrs, + } + } + return nil + }, + ) + response := &attribute.TestCustomTransformation{ + SomeRandomId: "some_random_id", + SecondaryId: "secondary_id", + Attrs: &attribute.TestCustomTransformation_SubResourceAttributes{ + SubResourceAttributes: &attribute.TestSubResourceAttributes{ + Name: "test", + }, + }, + } + expected := &attribute.TestCustomTransformation{ + SomeRandomId: "some_random_id", + SecondaryId: "secondary_id", + Attrs: &attribute.TestCustomTransformation_Attributes{ + Attributes: func() *structpb.Struct { + attrs, _ := structpb.NewStruct(map[string]interface{}{ + "name": "test", + }) + return attrs + }(), + }, + } + + err := transformResponse(response) + require.NoError(t, err) + assert.Empty(t, cmp.Diff(response, expected, protocmp.Transform())) +} diff --git a/internal/types/subtypes/transformations.go b/internal/types/subtypes/transformations.go new file mode 100644 index 000000000..364377d67 --- /dev/null +++ b/internal/types/subtypes/transformations.go @@ -0,0 +1,83 @@ +package subtypes + +import ( + "context" + "fmt" + "sync" + + "github.com/hashicorp/boundary/internal/errors" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" +) + +var globalTransformationRegistry = &transformationRegistry{ + requestTransformationFuncs: make(map[protoreflect.FullName]TransformationFunc), + responseTransformationFuncs: make(map[protoreflect.FullName]TransformationFunc), +} + +// transformationRegistry stores registered request and response +// transformation functions. +type transformationRegistry struct { + requestTransformationFuncs map[protoreflect.FullName]TransformationFunc + responseTransformationFuncs map[protoreflect.FullName]TransformationFunc + + sync.RWMutex +} + +func (r *transformationRegistry) registerRequestTransformationFunc(ctx context.Context, msg proto.Message, transformFn TransformationFunc) error { + r.Lock() + defer r.Unlock() + + fqn := msg.ProtoReflect().Descriptor().FullName() + const op = "subtypes.(transformationRegistry).RegisterRequestTransformationFunc" + if _, present := r.requestTransformationFuncs[fqn]; present { + return errors.New( + ctx, + errors.SubtypeAlreadyRegistered, + op, + fmt.Sprintf("proto type %q already has a request transformation function registered", fqn), + ) + } + r.requestTransformationFuncs[fqn] = transformFn + return nil +} + +func (r *transformationRegistry) registerResponseTransformationFunc(ctx context.Context, msg proto.Message, transformFn TransformationFunc) error { + r.Lock() + defer r.Unlock() + + fqn := msg.ProtoReflect().Descriptor().FullName() + const op = "subtypes.(transformationRegistry).RegisterResponseTransformationFunc" + if _, present := r.responseTransformationFuncs[fqn]; present { + return errors.New( + ctx, + errors.SubtypeAlreadyRegistered, + op, + fmt.Sprintf("proto type %q already has a response transformation function registered", fqn), + ) + } + r.responseTransformationFuncs[fqn] = transformFn + return nil +} + +// TransformationFunc defines the signature used to transform +// protobuf message attributes. The proto.Message is mutated in place. +type TransformationFunc func(proto.Message) error + +// RegisterRequestTransformationFunc registers a transformation function for +// the provided message. The message should be used as a request parameter to +// a service method. The provided callback is guaranteed to only be called with messages +// of the same type as the provided message. +func RegisterRequestTransformationFunc(msg proto.Message, transformFn TransformationFunc) error { + ctx := context.TODO() + return globalTransformationRegistry.registerRequestTransformationFunc(ctx, msg, transformFn) +} + +// RegisterResponseTransformationFunc registers a transformation function for +// the provided message. The message should be used as a response parameter to +// a service method. The provided callback is guaranteed to only be called with messages +// of the same type as the provided message. +func RegisterResponseTransformationFunc(msg proto.Message, transformFn TransformationFunc) error { + ctx := context.TODO() + return globalTransformationRegistry.registerResponseTransformationFunc(ctx, msg, transformFn) +} From 5b71aa6212768326369fd6ba3e08829396ff921d Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 8 Apr 2022 18:37:20 -0400 Subject: [PATCH 22/45] refact(subtype): Remove copied structToProto methods The original idea was for these methods to eventually become entirely encapsulated by the subtype package, but as it turns out we still have use for them in custom transformation functions, so move the subtype package to use these shared functions instead. --- .../types/subtypes/attribute_transform.go | 50 ++----------------- internal/types/subtypes/interceptor_test.go | 5 +- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/internal/types/subtypes/attribute_transform.go b/internal/types/subtypes/attribute_transform.go index ab4793047..dbc38668b 100644 --- a/internal/types/subtypes/attribute_transform.go +++ b/internal/types/subtypes/attribute_transform.go @@ -3,7 +3,7 @@ package subtypes import ( "fmt" - "google.golang.org/protobuf/encoding/protojson" + "github.com/hashicorp/boundary/internal/servers/controller/handlers" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/known/structpb" @@ -43,7 +43,7 @@ func convertAttributesToSubtype(msg proto.Message, st Subtype) error { return fmt.Errorf("found default attribute field that is not structpb.Struct: %s %s", d.FullName(), defaultAttrField.FullName()) } stAttrs := r.Get(stAttrField).Message().New().Interface() - if err := structToProto(defaultAttrs, stAttrs); err != nil { + if err := handlers.StructToProto(defaultAttrs, stAttrs); err != nil { return err } @@ -82,7 +82,7 @@ func convertAttributesToDefault(msg proto.Message, st Subtype) error { if !ok { return fmt.Errorf("found subtype attribute field that is not proto.Message: %s %s", d.FullName(), stAttrField.FullName()) } - defaultAttrs, err := protoToStruct(stAttrs) + defaultAttrs, err := handlers.ProtoToStruct(stAttrs) if err != nil { return err } @@ -91,46 +91,6 @@ func convertAttributesToDefault(msg proto.Message, st Subtype) error { return nil } -func structToProto(fields *structpb.Struct, p proto.Message) error { - if fields == nil { - // If there is no struct, don't update the default proto message. - return nil - } - js, err := fields.MarshalJSON() - if err != nil { - return err - } - - // TODO: replicate this logic but with a proto extension set on the Field - // descriptor There are some attributes where we want to discard unknown - // fields, while others that should error if there are unknown fields - // - // opts := GetOpts(opt...) - // if opts.withDiscardUnknownFields { - // err = (protojson.UnmarshalOptions{DiscardUnknown: true}.Unmarshal(js, p)) - // } else { - // err = protojson.Unmarshal(js, p) - // } - - err = protojson.Unmarshal(js, p) - if err != nil { - return err - } - return nil -} - -func protoToStruct(p proto.Message) (*structpb.Struct, error) { - js, err := protojson.MarshalOptions{UseProtoNames: true}.Marshal(p) - if err != nil { - return nil, err - } - st := &structpb.Struct{} - if err := protojson.Unmarshal(js, st); err != nil { - return nil, err - } - return st, nil -} - // Filterable converts a proto.Message so any subtype attributes fields are // structed like the API so filter strings will be correctly applied. If the // given proto.Message does not have any subtype attributes, the original @@ -174,13 +134,13 @@ func Filterable(item proto.Message) (proto.Message, error) { } attr = r.Get(oneofField).Message().Interface() - pbAttrs, err = protoToStruct(attr) + pbAttrs, err = handlers.ProtoToStruct(attr) if err != nil { return nil, err } r.Set(defaultAttrField, protoreflect.ValueOfMessage(pbAttrs.ProtoReflect())) - f, err := protoToStruct(r.Interface()) + f, err := handlers.ProtoToStruct(r.Interface()) if err != nil { return nil, err } diff --git a/internal/types/subtypes/interceptor_test.go b/internal/types/subtypes/interceptor_test.go index 086ada728..58f039add 100644 --- a/internal/types/subtypes/interceptor_test.go +++ b/internal/types/subtypes/interceptor_test.go @@ -5,6 +5,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/hashicorp/boundary/internal/gen/testing/attribute" + "github.com/hashicorp/boundary/internal/servers/controller/handlers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" @@ -597,7 +598,7 @@ func TestCustomTransformRequest(t *testing.T) { require.True(t, ok, "wrong message passed to request transformation callback") if msg.SomeRandomId == "some_random_id" && msg.SecondaryId == "secondary_id" { newAttrs := &attribute.TestSubResourceAttributes{} - err := structToProto(msg.GetAttributes(), newAttrs) + err := handlers.StructToProto(msg.GetAttributes(), newAttrs) require.NoError(t, err) msg.Attrs = &attribute.TestCustomTransformation_SubResourceAttributes{ SubResourceAttributes: newAttrs, @@ -640,7 +641,7 @@ func TestCustomTransformResponse(t *testing.T) { msg, ok := m.(*attribute.TestCustomTransformation) require.True(t, ok, "wrong message passed to response transformation callback") if msg.SomeRandomId == "some_random_id" && msg.SecondaryId == "secondary_id" { - newAttrs, err := protoToStruct(msg.GetSubResourceAttributes()) + newAttrs, err := handlers.ProtoToStruct(msg.GetSubResourceAttributes()) require.NoError(t, err) msg.Attrs = &attribute.TestCustomTransformation_Attributes{ Attributes: newAttrs, From 0e51f9cc92226f99135d9a36df7ef196e7ebf3ef Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Fri, 8 Apr 2022 18:35:59 -0400 Subject: [PATCH 23/45] feat(authtoken): Add token type to AuthToken The token type is used in the response from the OIDC Authenticate method only. --- .../api/resources/authtokens/v1/authtoken.proto | 3 +++ .../api/resources/authtokens/authtoken.pb.go | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto b/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto index f4b6e75a9..b66427529 100644 --- a/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto +++ b/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto @@ -42,6 +42,9 @@ message AuthToken { // Output only. The time this Auth Token expires. google.protobuf.Timestamp expiration_time = 110 [json_name="expiration_time"]; + // Output only. The type of this auth token. Either "cookie" or "token". + string token_type = 120 [json_name="token_type"]; + // Output only. The available actions on this resource for this user. repeated string authorized_actions = 300 [json_name="authorized_actions"]; } diff --git a/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go b/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go index 34a4903ee..4a4251f10 100644 --- a/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go +++ b/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go @@ -50,6 +50,8 @@ type AuthToken struct { ApproximateLastUsedTime *timestamppb.Timestamp `protobuf:"bytes,100,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty"` // Output only. The time this Auth Token expires. ExpirationTime *timestamppb.Timestamp `protobuf:"bytes,110,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"` + // Output only. The type of this auth token. Either "cookie" or "token". + TokenType string `protobuf:"bytes,120,opt,name=token_type,proto3" json:"token_type,omitempty"` // 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"` } @@ -163,6 +165,13 @@ func (x *AuthToken) GetExpirationTime() *timestamppb.Timestamp { return nil } +func (x *AuthToken) GetTokenType() string { + if x != nil { + return x.TokenType + } + return "" +} + func (x *AuthToken) GetAuthorizedActions() []string { if x != nil { return x.AuthorizedActions @@ -184,7 +193,7 @@ var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte 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, 0x22, 0xc7, 0x04, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x6f, 0x22, 0xe7, 0x04, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, @@ -217,7 +226,9 @@ var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x6e, 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, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x78, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 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, 0x56, 0x5a, 0x54, 0x67, From a2bff4efdf77259d03e166b7ce3edfe6ca3bc34f Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Mon, 11 Apr 2022 14:50:29 -0400 Subject: [PATCH 24/45] feat(authmethods): Add typed attributes to authenticate request and response The AuthenticateRequest and AuthenticateResponse types have a complex mapping rule system, which requires a pair of custom callback functions. --- .../api/services/auth_method_service.pb.go | 915 +++++++++++------- .../resources/authtokens/v1/authtoken.proto | 3 - .../api/services/v1/auth_method_service.proto | 34 +- .../authmethods/authmethod_service.go | 121 ++- .../handlers/authmethods/authmethod_test.go | 396 ++++++++ .../controller/handlers/authmethods/oidc.go | 104 +- .../handlers/authmethods/oidc_test.go | 144 ++- .../handlers/authmethods/password.go | 16 +- .../handlers/authmethods/password_test.go | 113 +-- .../handlers/outgoing_response_filter_test.go | 6 +- .../api/authmethods/authenticate_test.go | 9 +- .../tests/api/authmethods/authmethod_test.go | 39 +- .../service_classification_test.go | 109 ++- .../api/resources/authtokens/authtoken.pb.go | 15 +- 14 files changed, 1346 insertions(+), 678 deletions(-) create mode 100644 internal/servers/controller/handlers/authmethods/authmethod_test.go diff --git a/internal/gen/controller/api/services/auth_method_service.pb.go b/internal/gen/controller/api/services/auth_method_service.pb.go index 06d1dc86b..5648ba675 100644 --- a/internal/gen/controller/api/services/auth_method_service.pb.go +++ b/internal/gen/controller/api/services/auth_method_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" authmethods "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" + authtokens "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authtokens" _ "github.com/hashicorp/boundary/sdk/pbs/controller/protooptions" _ "google.golang.org/genproto/googleapis/api/annotations" _ "google.golang.org/genproto/googleapis/api/visibility" @@ -850,58 +851,6 @@ func (x *OidcStartAttributes) GetCachedRoundtripPayload() string { return "" } -// The layout of the struct for "attributes" field in AuthenticateRequest for a -// oidc type's token command. This message isn't directly referenced anywhere -// but is used here to define the expected field names and types. -type OidcTokenAttributes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The token id for the request. This is the token id that was returned from - // the oidc type's start command - TokenId string `protobuf:"bytes,1,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"` -} - -func (x *OidcTokenAttributes) Reset() { - *x = OidcTokenAttributes{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OidcTokenAttributes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OidcTokenAttributes) ProtoMessage() {} - -func (x *OidcTokenAttributes) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OidcTokenAttributes.ProtoReflect.Descriptor instead. -func (*OidcTokenAttributes) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_auth_method_service_proto_rawDescGZIP(), []int{15} -} - -func (x *OidcTokenAttributes) GetTokenId() string { - if x != nil { - return x.TokenId - } - return "" -} - type AuthenticateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -917,8 +866,13 @@ type AuthenticateRequest struct { // This can be "cookie" or "token". If not provided, "token" will be used. "cookie" activates a split-cookie method where the token is split partially between http-only and regular cookies in order // to keep it safe from rogue JS in the browser. Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` - // Attributes are passed to the Auth Method; the valid keys and values depend on the type of Auth Method as well as the command. - Attributes *structpb.Struct `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *AuthenticateRequest_Attributes + // *AuthenticateRequest_PasswordLoginAttributes + // *AuthenticateRequest_OidcStartAttributes + // *AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest + // *AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest + Attrs isAuthenticateRequest_Attrs `protobuf_oneof:"attrs"` // The command to perform. Command string `protobuf:"bytes,5,opt,name=command,proto3" json:"command,omitempty" class:"public"` // @gotags: `class:"public"` } @@ -926,7 +880,7 @@ type AuthenticateRequest struct { func (x *AuthenticateRequest) Reset() { *x = AuthenticateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[16] + mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -939,7 +893,7 @@ func (x *AuthenticateRequest) String() string { func (*AuthenticateRequest) ProtoMessage() {} func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[16] + mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -952,7 +906,7 @@ func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AuthenticateRequest.ProtoReflect.Descriptor instead. func (*AuthenticateRequest) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_auth_method_service_proto_rawDescGZIP(), []int{16} + return file_controller_api_services_v1_auth_method_service_proto_rawDescGZIP(), []int{15} } func (x *AuthenticateRequest) GetAuthMethodId() string { @@ -977,13 +931,48 @@ func (x *AuthenticateRequest) GetType() string { return "" } +func (m *AuthenticateRequest) GetAttrs() isAuthenticateRequest_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *AuthenticateRequest) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*AuthenticateRequest_Attributes); ok { return x.Attributes } return nil } +func (x *AuthenticateRequest) GetPasswordLoginAttributes() *PasswordLoginAttributes { + if x, ok := x.GetAttrs().(*AuthenticateRequest_PasswordLoginAttributes); ok { + return x.PasswordLoginAttributes + } + return nil +} + +func (x *AuthenticateRequest) GetOidcStartAttributes() *OidcStartAttributes { + if x, ok := x.GetAttrs().(*AuthenticateRequest_OidcStartAttributes); ok { + return x.OidcStartAttributes + } + return nil +} + +func (x *AuthenticateRequest) GetOidcAuthMethodAuthenticateCallbackRequest() *authmethods.OidcAuthMethodAuthenticateCallbackRequest { + if x, ok := x.GetAttrs().(*AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest); ok { + return x.OidcAuthMethodAuthenticateCallbackRequest + } + return nil +} + +func (x *AuthenticateRequest) GetOidcAuthMethodAuthenticateTokenRequest() *authmethods.OidcAuthMethodAuthenticateTokenRequest { + if x, ok := x.GetAttrs().(*AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest); ok { + return x.OidcAuthMethodAuthenticateTokenRequest + } + return nil +} + func (x *AuthenticateRequest) GetCommand() string { if x != nil { return x.Command @@ -991,6 +980,43 @@ func (x *AuthenticateRequest) GetCommand() string { return "" } +type isAuthenticateRequest_Attrs interface { + isAuthenticateRequest_Attrs() +} + +type AuthenticateRequest_Attributes struct { + // Attributes are passed to the Auth Method; the valid keys and values depend on the type of Auth Method as well as the command. + Attributes *structpb.Struct `protobuf:"bytes,4,opt,name=attributes,proto3,oneof"` +} + +type AuthenticateRequest_PasswordLoginAttributes struct { + // Note: these fields have a custom mapping function for transforming to and from the generic attributes, + // they do not use the standard attribute transformation. + PasswordLoginAttributes *PasswordLoginAttributes `protobuf:"bytes,7,opt,name=password_login_attributes,json=passwordLoginAttributes,proto3,oneof"` +} + +type AuthenticateRequest_OidcStartAttributes struct { + OidcStartAttributes *OidcStartAttributes `protobuf:"bytes,8,opt,name=oidc_start_attributes,json=oidcStartAttributes,proto3,oneof"` +} + +type AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest struct { + OidcAuthMethodAuthenticateCallbackRequest *authmethods.OidcAuthMethodAuthenticateCallbackRequest `protobuf:"bytes,9,opt,name=oidc_auth_method_authenticate_callback_request,json=oidcAuthMethodAuthenticateCallbackRequest,proto3,oneof"` +} + +type AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest struct { + OidcAuthMethodAuthenticateTokenRequest *authmethods.OidcAuthMethodAuthenticateTokenRequest `protobuf:"bytes,10,opt,name=oidc_auth_method_authenticate_token_request,json=oidcAuthMethodAuthenticateTokenRequest,proto3,oneof"` +} + +func (*AuthenticateRequest_Attributes) isAuthenticateRequest_Attrs() {} + +func (*AuthenticateRequest_PasswordLoginAttributes) isAuthenticateRequest_Attrs() {} + +func (*AuthenticateRequest_OidcStartAttributes) isAuthenticateRequest_Attrs() {} + +func (*AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest) isAuthenticateRequest_Attrs() {} + +func (*AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest) isAuthenticateRequest_Attrs() {} + type AuthenticateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -998,8 +1024,13 @@ type AuthenticateResponse struct { // The type of the token returned. Either "cookie" or "token". Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` - // Valid keys and values depend on the type of Auth Method as well as the command. - Attributes *structpb.Struct `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *AuthenticateResponse_Attributes + // *AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse + // *AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse + // *AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse + // *AuthenticateResponse_AuthTokenResponse + Attrs isAuthenticateResponse_Attrs `protobuf_oneof:"attrs"` // The command that was performed. Command string `protobuf:"bytes,5,opt,name=command,proto3" json:"command,omitempty" class:"public"` // @gotags: `class:"public"` } @@ -1007,7 +1038,7 @@ type AuthenticateResponse struct { func (x *AuthenticateResponse) Reset() { *x = AuthenticateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[17] + mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1020,7 +1051,7 @@ func (x *AuthenticateResponse) String() string { func (*AuthenticateResponse) ProtoMessage() {} func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[17] + mi := &file_controller_api_services_v1_auth_method_service_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1033,7 +1064,7 @@ func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AuthenticateResponse.ProtoReflect.Descriptor instead. func (*AuthenticateResponse) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_auth_method_service_proto_rawDescGZIP(), []int{17} + return file_controller_api_services_v1_auth_method_service_proto_rawDescGZIP(), []int{16} } func (x *AuthenticateResponse) GetType() string { @@ -1043,13 +1074,48 @@ func (x *AuthenticateResponse) GetType() string { return "" } +func (m *AuthenticateResponse) GetAttrs() isAuthenticateResponse_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *AuthenticateResponse) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*AuthenticateResponse_Attributes); ok { return x.Attributes } return nil } +func (x *AuthenticateResponse) GetOidcAuthMethodAuthenticateStartResponse() *authmethods.OidcAuthMethodAuthenticateStartResponse { + if x, ok := x.GetAttrs().(*AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse); ok { + return x.OidcAuthMethodAuthenticateStartResponse + } + return nil +} + +func (x *AuthenticateResponse) GetOidcAuthMethodAuthenticateCallbackResponse() *authmethods.OidcAuthMethodAuthenticateCallbackResponse { + if x, ok := x.GetAttrs().(*AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse); ok { + return x.OidcAuthMethodAuthenticateCallbackResponse + } + return nil +} + +func (x *AuthenticateResponse) GetOidcAuthMethodAuthenticateTokenResponse() *authmethods.OidcAuthMethodAuthenticateTokenResponse { + if x, ok := x.GetAttrs().(*AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse); ok { + return x.OidcAuthMethodAuthenticateTokenResponse + } + return nil +} + +func (x *AuthenticateResponse) GetAuthTokenResponse() *authtokens.AuthToken { + if x, ok := x.GetAttrs().(*AuthenticateResponse_AuthTokenResponse); ok { + return x.AuthTokenResponse + } + return nil +} + func (x *AuthenticateResponse) GetCommand() string { if x != nil { return x.Command @@ -1057,6 +1123,44 @@ func (x *AuthenticateResponse) GetCommand() string { return "" } +type isAuthenticateResponse_Attrs interface { + isAuthenticateResponse_Attrs() +} + +type AuthenticateResponse_Attributes struct { + // Valid keys and values depend on the type of Auth Method as well as the command. + Attributes *structpb.Struct `protobuf:"bytes,4,opt,name=attributes,proto3,oneof"` +} + +type AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse struct { + // Note: these fields have a custom mapping function for transforming to and from the generic attributes, + // they do not use the standard attribute transformation. + OidcAuthMethodAuthenticateStartResponse *authmethods.OidcAuthMethodAuthenticateStartResponse `protobuf:"bytes,6,opt,name=oidc_auth_method_authenticate_start_response,json=oidcAuthMethodAuthenticateStartResponse,proto3,oneof"` +} + +type AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse struct { + OidcAuthMethodAuthenticateCallbackResponse *authmethods.OidcAuthMethodAuthenticateCallbackResponse `protobuf:"bytes,7,opt,name=oidc_auth_method_authenticate_callback_response,json=oidcAuthMethodAuthenticateCallbackResponse,proto3,oneof"` +} + +type AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse struct { + OidcAuthMethodAuthenticateTokenResponse *authmethods.OidcAuthMethodAuthenticateTokenResponse `protobuf:"bytes,8,opt,name=oidc_auth_method_authenticate_token_response,json=oidcAuthMethodAuthenticateTokenResponse,proto3,oneof"` +} + +type AuthenticateResponse_AuthTokenResponse struct { + AuthTokenResponse *authtokens.AuthToken `protobuf:"bytes,9,opt,name=auth_token_response,json=authTokenResponse,proto3,oneof"` +} + +func (*AuthenticateResponse_Attributes) isAuthenticateResponse_Attrs() {} + +func (*AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse) isAuthenticateResponse_Attrs() {} + +func (*AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse) isAuthenticateResponse_Attrs() { +} + +func (*AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse) isAuthenticateResponse_Attrs() {} + +func (*AuthenticateResponse_AuthTokenResponse) isAuthenticateResponse_Attrs() {} + var File_controller_api_services_v1_auth_method_service_proto protoreflect.FileDescriptor var file_controller_api_services_v1_auth_method_service_proto_rawDesc = []byte{ @@ -1079,237 +1183,325 @@ var file_controller_api_services_v1_auth_method_service_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 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, 0x26, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x15, - 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, - 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, - 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6a, - 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, - 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, - 0x76, 0x65, 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, 0x64, 0x0a, 0x17, 0x4c, 0x69, - 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 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, - 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x22, 0x62, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x47, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x22, 0x75, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, - 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb0, 0x01, 0x0a, 0x17, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x63, - 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x36, 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, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x76, 0x31, + 0x2f, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 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, 0x26, 0x0a, 0x14, + 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6a, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, + 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 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, 0x64, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x62, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, + 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x75, 0x0a, 0x18, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 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, 0x47, 0x0a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x22, 0x29, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, - 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1a, - 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x4f, - 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x52, - 0x0a, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x24, 0x64, 0x69, - 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0xa4, 0x02, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x18, 0x04, 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, 0x0b, 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, 0x92, 0x01, 0x0a, 0x1c, - 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, - 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x4f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x18, 0x9a, 0xe3, 0x29, 0x04, 0x6f, - 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, - 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x19, 0x6f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x74, 0x65, 0x6d, 0x22, 0xb0, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 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, 0x63, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x29, 0x0a, 0x17, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x4f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x5e, 0x0a, 0x13, 0x43, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, - 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x55, 0x0a, 0x17, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, - 0x22, 0x96, 0x01, 0x0a, 0x13, 0x4f, 0x69, 0x64, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x11, 0x72, 0x6f, 0x75, 0x6e, - 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x11, 0x72, 0x6f, - 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, - 0x38, 0x0a, 0x18, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, - 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x16, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, - 0x69, 0x70, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x30, 0x0a, 0x13, 0x4f, 0x69, 0x64, - 0x63, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x64, 0x22, 0xdb, 0x01, 0x0a, 0x13, - 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, - 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x02, 0x18, 0x01, 0x52, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, - 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x52, 0x0b, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x14, 0x41, 0x75, - 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, - 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, - 0x04, 0x08, 0x02, 0x10, 0x03, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x32, 0x95, 0x0b, 0x0a, 0x11, 0x41, 0x75, 0x74, 0x68, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb8, 0x01, - 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, - 0x30, 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, - 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x92, 0x41, 0x1c, 0x12, 0x1a, 0x47, 0x65, 0x74, 0x73, 0x20, - 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x15, 0x2f, 0x76, 0x31, - 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, - 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb0, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x32, 0x2e, 0x63, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x52, 0x0a, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, + 0x65, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x24, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa4, 0x02, 0x0a, 0x12, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0a, 0x61, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 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, 0x0b, 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, 0x92, 0x01, 0x0a, 0x1c, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x63, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x42, 0x18, 0x9a, 0xe3, 0x29, 0x04, 0x6f, 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, + 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x19, 0x6f, + 0x69, 0x64, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, + 0x73, 0x22, 0x5e, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x22, 0x55, 0x0a, 0x17, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, + 0x69, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, + 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x96, 0x01, 0x0a, 0x13, 0x4f, 0x69, 0x64, + 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x45, 0x0a, 0x11, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x52, 0x11, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x38, 0x0a, 0x18, 0x63, 0x61, 0x63, 0x68, 0x65, + 0x64, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x61, 0x63, 0x68, 0x65, + 0x64, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x74, 0x72, 0x69, 0x70, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x22, 0xf4, 0x06, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, + 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, + 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 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, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x83, 0x01, 0x0a, 0x19, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, + 0x67, 0x69, 0x6e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0xfa, + 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, + 0x00, 0x52, 0x17, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x77, 0x0a, 0x15, 0x6f, 0x69, + 0x64, 0x63, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 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, 0x4f, 0x69, 0x64, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, + 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x13, + 0x6f, 0x69, 0x64, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0xc9, 0x01, 0x0a, 0x2e, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x61, 0x75, 0x74, + 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x52, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, + 0x41, 0x4c, 0x48, 0x00, 0x52, 0x29, 0x6f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0xc0, 0x01, 0x0a, 0x2b, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4f, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, + 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x26, 0x6f, 0x69, 0x64, 0x63, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, + 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x42, 0x07, 0x0a, 0x05, + 0x61, 0x74, 0x74, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x52, 0x0b, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x22, 0xf8, 0x06, 0x0a, 0x14, 0x41, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x04, 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, 0x48, 0x00, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0xc3, 0x01, 0x0a, 0x2c, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x50, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, + 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x27, 0x6f, + 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xcc, 0x01, 0x0a, 0x2f, 0x6f, 0x69, 0x64, 0x63, 0x5f, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x61, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, + 0x6b, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x53, 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, 0x61, 0x75, 0x74, 0x68, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, + 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, + 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x2a, 0x6f, 0x69, 0x64, 0x63, 0x41, + 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0xc3, 0x01, 0x0a, 0x2c, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, + 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x72, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x50, 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, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, + 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, + 0x48, 0x00, 0x52, 0x27, 0x6f, 0x69, 0x64, 0x63, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x75, 0x0a, 0x13, 0x61, + 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x10, 0xfa, 0xd2, 0xe4, + 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, + 0x11, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x42, 0x07, 0x0a, 0x05, + 0x61, 0x74, 0x74, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, + 0x03, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x32, 0x95, 0x0b, 0x0a, 0x11, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb8, 0x01, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x30, 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, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x75, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x42, 0x92, 0x41, 0x1c, 0x12, 0x1a, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, + 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb0, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, + 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x75, - 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x92, 0x41, 0x19, 0x12, 0x17, 0x4c, 0x69, 0x73, 0x74, - 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, - 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0xc5, 0x01, 0x0a, 0x10, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x1f, - 0x12, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, - 0x6c, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x12, 0xc4, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, - 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, 0x19, 0x12, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x32, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, - 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb6, 0x01, 0x0a, 0x10, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, - 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x34, 0x92, 0x41, 0x19, 0x12, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, + 0x6c, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0xc5, 0x01, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x1f, 0x12, 0x1d, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x41, + 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1e, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, + 0xc4, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x92, 0x41, 0x17, 0x12, - 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x76, - 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, - 0x69, 0x64, 0x7d, 0x12, 0xcf, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, + 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x45, 0x92, 0x41, 0x19, 0x12, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, + 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x23, 0x32, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb6, 0x01, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, + 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x92, 0x41, 0x17, 0x12, 0x15, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x2a, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, + 0xcf, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 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, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2f, 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, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x5f, 0x92, 0x41, 0x29, 0x12, 0x27, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x6e, 0x20, 0x4f, + 0x49, 0x44, 0x43, 0x20, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2d, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x12, 0xf7, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x12, 0x2f, 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, + 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x92, 0x41, 0x29, 0x12, 0x27, 0x43, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x6f, 0x66, 0x20, - 0x61, 0x6e, 0x20, 0x4f, 0x49, 0x44, 0x43, 0x20, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, - 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, - 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xf7, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, - 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x2f, 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, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, 0x01, 0x92, 0x41, 0x47, 0x12, - 0x45, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, - 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x61, 0x6e, - 0x20, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x22, 0x2e, 0x2f, 0x76, - 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, - 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x7d, 0x3a, - 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 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, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, 0x01, 0x92, 0x41, 0x47, 0x12, 0x45, 0x41, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, 0x72, + 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x20, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x20, 0x61, 0x6e, 0x64, + 0x20, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x22, 0x2e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x2d, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x2f, 0x7b, 0x61, 0x75, 0x74, 0x68, + 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 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, 0x61, 0x75, + 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1324,63 +1516,76 @@ func file_controller_api_services_v1_auth_method_service_proto_rawDescGZIP() []b return file_controller_api_services_v1_auth_method_service_proto_rawDescData } -var file_controller_api_services_v1_auth_method_service_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_controller_api_services_v1_auth_method_service_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_controller_api_services_v1_auth_method_service_proto_goTypes = []interface{}{ - (*GetAuthMethodRequest)(nil), // 0: controller.api.services.v1.GetAuthMethodRequest - (*GetAuthMethodResponse)(nil), // 1: controller.api.services.v1.GetAuthMethodResponse - (*ListAuthMethodsRequest)(nil), // 2: controller.api.services.v1.ListAuthMethodsRequest - (*ListAuthMethodsResponse)(nil), // 3: controller.api.services.v1.ListAuthMethodsResponse - (*CreateAuthMethodRequest)(nil), // 4: controller.api.services.v1.CreateAuthMethodRequest - (*CreateAuthMethodResponse)(nil), // 5: controller.api.services.v1.CreateAuthMethodResponse - (*UpdateAuthMethodRequest)(nil), // 6: controller.api.services.v1.UpdateAuthMethodRequest - (*UpdateAuthMethodResponse)(nil), // 7: controller.api.services.v1.UpdateAuthMethodResponse - (*DeleteAuthMethodRequest)(nil), // 8: controller.api.services.v1.DeleteAuthMethodRequest - (*DeleteAuthMethodResponse)(nil), // 9: controller.api.services.v1.DeleteAuthMethodResponse - (*OidcChangeStateAttributes)(nil), // 10: controller.api.services.v1.OidcChangeStateAttributes - (*ChangeStateRequest)(nil), // 11: controller.api.services.v1.ChangeStateRequest - (*ChangeStateResponse)(nil), // 12: controller.api.services.v1.ChangeStateResponse - (*PasswordLoginAttributes)(nil), // 13: controller.api.services.v1.PasswordLoginAttributes - (*OidcStartAttributes)(nil), // 14: controller.api.services.v1.OidcStartAttributes - (*OidcTokenAttributes)(nil), // 15: controller.api.services.v1.OidcTokenAttributes - (*AuthenticateRequest)(nil), // 16: controller.api.services.v1.AuthenticateRequest - (*AuthenticateResponse)(nil), // 17: controller.api.services.v1.AuthenticateResponse - (*authmethods.AuthMethod)(nil), // 18: controller.api.resources.authmethods.v1.AuthMethod - (*fieldmaskpb.FieldMask)(nil), // 19: google.protobuf.FieldMask - (*structpb.Struct)(nil), // 20: google.protobuf.Struct + (*GetAuthMethodRequest)(nil), // 0: controller.api.services.v1.GetAuthMethodRequest + (*GetAuthMethodResponse)(nil), // 1: controller.api.services.v1.GetAuthMethodResponse + (*ListAuthMethodsRequest)(nil), // 2: controller.api.services.v1.ListAuthMethodsRequest + (*ListAuthMethodsResponse)(nil), // 3: controller.api.services.v1.ListAuthMethodsResponse + (*CreateAuthMethodRequest)(nil), // 4: controller.api.services.v1.CreateAuthMethodRequest + (*CreateAuthMethodResponse)(nil), // 5: controller.api.services.v1.CreateAuthMethodResponse + (*UpdateAuthMethodRequest)(nil), // 6: controller.api.services.v1.UpdateAuthMethodRequest + (*UpdateAuthMethodResponse)(nil), // 7: controller.api.services.v1.UpdateAuthMethodResponse + (*DeleteAuthMethodRequest)(nil), // 8: controller.api.services.v1.DeleteAuthMethodRequest + (*DeleteAuthMethodResponse)(nil), // 9: controller.api.services.v1.DeleteAuthMethodResponse + (*OidcChangeStateAttributes)(nil), // 10: controller.api.services.v1.OidcChangeStateAttributes + (*ChangeStateRequest)(nil), // 11: controller.api.services.v1.ChangeStateRequest + (*ChangeStateResponse)(nil), // 12: controller.api.services.v1.ChangeStateResponse + (*PasswordLoginAttributes)(nil), // 13: controller.api.services.v1.PasswordLoginAttributes + (*OidcStartAttributes)(nil), // 14: controller.api.services.v1.OidcStartAttributes + (*AuthenticateRequest)(nil), // 15: controller.api.services.v1.AuthenticateRequest + (*AuthenticateResponse)(nil), // 16: controller.api.services.v1.AuthenticateResponse + (*authmethods.AuthMethod)(nil), // 17: controller.api.resources.authmethods.v1.AuthMethod + (*fieldmaskpb.FieldMask)(nil), // 18: google.protobuf.FieldMask + (*structpb.Struct)(nil), // 19: google.protobuf.Struct + (*authmethods.OidcAuthMethodAuthenticateCallbackRequest)(nil), // 20: controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackRequest + (*authmethods.OidcAuthMethodAuthenticateTokenRequest)(nil), // 21: controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenRequest + (*authmethods.OidcAuthMethodAuthenticateStartResponse)(nil), // 22: controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateStartResponse + (*authmethods.OidcAuthMethodAuthenticateCallbackResponse)(nil), // 23: controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackResponse + (*authmethods.OidcAuthMethodAuthenticateTokenResponse)(nil), // 24: controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenResponse + (*authtokens.AuthToken)(nil), // 25: controller.api.resources.authtokens.v1.AuthToken } var file_controller_api_services_v1_auth_method_service_proto_depIdxs = []int32{ - 18, // 0: controller.api.services.v1.GetAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 18, // 1: controller.api.services.v1.ListAuthMethodsResponse.items:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 18, // 2: controller.api.services.v1.CreateAuthMethodRequest.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 18, // 3: controller.api.services.v1.CreateAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 18, // 4: controller.api.services.v1.UpdateAuthMethodRequest.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 19, // 5: controller.api.services.v1.UpdateAuthMethodRequest.update_mask:type_name -> google.protobuf.FieldMask - 18, // 6: controller.api.services.v1.UpdateAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 20, // 7: controller.api.services.v1.ChangeStateRequest.attributes:type_name -> google.protobuf.Struct + 17, // 0: controller.api.services.v1.GetAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 17, // 1: controller.api.services.v1.ListAuthMethodsResponse.items:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 17, // 2: controller.api.services.v1.CreateAuthMethodRequest.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 17, // 3: controller.api.services.v1.CreateAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 17, // 4: controller.api.services.v1.UpdateAuthMethodRequest.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 18, // 5: controller.api.services.v1.UpdateAuthMethodRequest.update_mask:type_name -> google.protobuf.FieldMask + 17, // 6: controller.api.services.v1.UpdateAuthMethodResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 19, // 7: controller.api.services.v1.ChangeStateRequest.attributes:type_name -> google.protobuf.Struct 10, // 8: controller.api.services.v1.ChangeStateRequest.oidc_change_state_attributes:type_name -> controller.api.services.v1.OidcChangeStateAttributes - 18, // 9: controller.api.services.v1.ChangeStateResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod - 20, // 10: controller.api.services.v1.OidcStartAttributes.roundtrip_payload:type_name -> google.protobuf.Struct - 20, // 11: controller.api.services.v1.AuthenticateRequest.attributes:type_name -> google.protobuf.Struct - 20, // 12: controller.api.services.v1.AuthenticateResponse.attributes:type_name -> google.protobuf.Struct - 0, // 13: controller.api.services.v1.AuthMethodService.GetAuthMethod:input_type -> controller.api.services.v1.GetAuthMethodRequest - 2, // 14: controller.api.services.v1.AuthMethodService.ListAuthMethods:input_type -> controller.api.services.v1.ListAuthMethodsRequest - 4, // 15: controller.api.services.v1.AuthMethodService.CreateAuthMethod:input_type -> controller.api.services.v1.CreateAuthMethodRequest - 6, // 16: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:input_type -> controller.api.services.v1.UpdateAuthMethodRequest - 8, // 17: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:input_type -> controller.api.services.v1.DeleteAuthMethodRequest - 11, // 18: controller.api.services.v1.AuthMethodService.ChangeState:input_type -> controller.api.services.v1.ChangeStateRequest - 16, // 19: controller.api.services.v1.AuthMethodService.Authenticate:input_type -> controller.api.services.v1.AuthenticateRequest - 1, // 20: controller.api.services.v1.AuthMethodService.GetAuthMethod:output_type -> controller.api.services.v1.GetAuthMethodResponse - 3, // 21: controller.api.services.v1.AuthMethodService.ListAuthMethods:output_type -> controller.api.services.v1.ListAuthMethodsResponse - 5, // 22: controller.api.services.v1.AuthMethodService.CreateAuthMethod:output_type -> controller.api.services.v1.CreateAuthMethodResponse - 7, // 23: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:output_type -> controller.api.services.v1.UpdateAuthMethodResponse - 9, // 24: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:output_type -> controller.api.services.v1.DeleteAuthMethodResponse - 12, // 25: controller.api.services.v1.AuthMethodService.ChangeState:output_type -> controller.api.services.v1.ChangeStateResponse - 17, // 26: controller.api.services.v1.AuthMethodService.Authenticate:output_type -> controller.api.services.v1.AuthenticateResponse - 20, // [20:27] is the sub-list for method output_type - 13, // [13:20] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 17, // 9: controller.api.services.v1.ChangeStateResponse.item:type_name -> controller.api.resources.authmethods.v1.AuthMethod + 19, // 10: controller.api.services.v1.OidcStartAttributes.roundtrip_payload:type_name -> google.protobuf.Struct + 19, // 11: controller.api.services.v1.AuthenticateRequest.attributes:type_name -> google.protobuf.Struct + 13, // 12: controller.api.services.v1.AuthenticateRequest.password_login_attributes:type_name -> controller.api.services.v1.PasswordLoginAttributes + 14, // 13: controller.api.services.v1.AuthenticateRequest.oidc_start_attributes:type_name -> controller.api.services.v1.OidcStartAttributes + 20, // 14: controller.api.services.v1.AuthenticateRequest.oidc_auth_method_authenticate_callback_request:type_name -> controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackRequest + 21, // 15: controller.api.services.v1.AuthenticateRequest.oidc_auth_method_authenticate_token_request:type_name -> controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenRequest + 19, // 16: controller.api.services.v1.AuthenticateResponse.attributes:type_name -> google.protobuf.Struct + 22, // 17: controller.api.services.v1.AuthenticateResponse.oidc_auth_method_authenticate_start_response:type_name -> controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateStartResponse + 23, // 18: controller.api.services.v1.AuthenticateResponse.oidc_auth_method_authenticate_callback_response:type_name -> controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackResponse + 24, // 19: controller.api.services.v1.AuthenticateResponse.oidc_auth_method_authenticate_token_response:type_name -> controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenResponse + 25, // 20: controller.api.services.v1.AuthenticateResponse.auth_token_response:type_name -> controller.api.resources.authtokens.v1.AuthToken + 0, // 21: controller.api.services.v1.AuthMethodService.GetAuthMethod:input_type -> controller.api.services.v1.GetAuthMethodRequest + 2, // 22: controller.api.services.v1.AuthMethodService.ListAuthMethods:input_type -> controller.api.services.v1.ListAuthMethodsRequest + 4, // 23: controller.api.services.v1.AuthMethodService.CreateAuthMethod:input_type -> controller.api.services.v1.CreateAuthMethodRequest + 6, // 24: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:input_type -> controller.api.services.v1.UpdateAuthMethodRequest + 8, // 25: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:input_type -> controller.api.services.v1.DeleteAuthMethodRequest + 11, // 26: controller.api.services.v1.AuthMethodService.ChangeState:input_type -> controller.api.services.v1.ChangeStateRequest + 15, // 27: controller.api.services.v1.AuthMethodService.Authenticate:input_type -> controller.api.services.v1.AuthenticateRequest + 1, // 28: controller.api.services.v1.AuthMethodService.GetAuthMethod:output_type -> controller.api.services.v1.GetAuthMethodResponse + 3, // 29: controller.api.services.v1.AuthMethodService.ListAuthMethods:output_type -> controller.api.services.v1.ListAuthMethodsResponse + 5, // 30: controller.api.services.v1.AuthMethodService.CreateAuthMethod:output_type -> controller.api.services.v1.CreateAuthMethodResponse + 7, // 31: controller.api.services.v1.AuthMethodService.UpdateAuthMethod:output_type -> controller.api.services.v1.UpdateAuthMethodResponse + 9, // 32: controller.api.services.v1.AuthMethodService.DeleteAuthMethod:output_type -> controller.api.services.v1.DeleteAuthMethodResponse + 12, // 33: controller.api.services.v1.AuthMethodService.ChangeState:output_type -> controller.api.services.v1.ChangeStateResponse + 16, // 34: controller.api.services.v1.AuthMethodService.Authenticate:output_type -> controller.api.services.v1.AuthenticateResponse + 28, // [28:35] is the sub-list for method output_type + 21, // [21:28] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name } func init() { file_controller_api_services_v1_auth_method_service_proto_init() } @@ -1570,18 +1775,6 @@ func file_controller_api_services_v1_auth_method_service_proto_init() { } } file_controller_api_services_v1_auth_method_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OidcTokenAttributes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_auth_method_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AuthenticateRequest); i { case 0: return &v.state @@ -1593,7 +1786,7 @@ func file_controller_api_services_v1_auth_method_service_proto_init() { return nil } } - file_controller_api_services_v1_auth_method_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_controller_api_services_v1_auth_method_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AuthenticateResponse); i { case 0: return &v.state @@ -1610,13 +1803,27 @@ func file_controller_api_services_v1_auth_method_service_proto_init() { (*ChangeStateRequest_Attributes)(nil), (*ChangeStateRequest_OidcChangeStateAttributes)(nil), } + file_controller_api_services_v1_auth_method_service_proto_msgTypes[15].OneofWrappers = []interface{}{ + (*AuthenticateRequest_Attributes)(nil), + (*AuthenticateRequest_PasswordLoginAttributes)(nil), + (*AuthenticateRequest_OidcStartAttributes)(nil), + (*AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest)(nil), + (*AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest)(nil), + } + file_controller_api_services_v1_auth_method_service_proto_msgTypes[16].OneofWrappers = []interface{}{ + (*AuthenticateResponse_Attributes)(nil), + (*AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse)(nil), + (*AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse)(nil), + (*AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse)(nil), + (*AuthenticateResponse_AuthTokenResponse)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_controller_api_services_v1_auth_method_service_proto_rawDesc, NumEnums: 0, - NumMessages: 18, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto b/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto index b66427529..f4b6e75a9 100644 --- a/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto +++ b/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto @@ -42,9 +42,6 @@ message AuthToken { // Output only. The time this Auth Token expires. google.protobuf.Timestamp expiration_time = 110 [json_name="expiration_time"]; - // Output only. The type of this auth token. Either "cookie" or "token". - string token_type = 120 [json_name="token_type"]; - // Output only. The available actions on this resource for this user. repeated string authorized_actions = 300 [json_name="authorized_actions"]; } diff --git a/internal/proto/controller/api/services/v1/auth_method_service.proto b/internal/proto/controller/api/services/v1/auth_method_service.proto index 1e6be74fd..9be8afb27 100644 --- a/internal/proto/controller/api/services/v1/auth_method_service.proto +++ b/internal/proto/controller/api/services/v1/auth_method_service.proto @@ -10,6 +10,7 @@ import "google/api/visibility.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "controller/api/resources/authmethods/v1/auth_method.proto"; +import "controller/api/resources/authtokens/v1/authtoken.proto"; import "controller/custom_options/v1/options.proto"; option (custom_options.v1.domain) = "auth"; @@ -196,15 +197,6 @@ message OidcStartAttributes { string cached_roundtrip_payload = 2; } -// The layout of the struct for "attributes" field in AuthenticateRequest for a -// oidc type's token command. This message isn't directly referenced anywhere -// but is used here to define the expected field names and types. -message OidcTokenAttributes { - // The token id for the request. This is the token id that was returned from - // the oidc type's start command - string token_id = 1; -} - message AuthenticateRequest { // The ID of the Auth Method in the system that should be used for authentication. string auth_method_id = 1 [json_name = "auth_method_id"]; // @gotags: `class:"public"` @@ -214,8 +206,16 @@ message AuthenticateRequest { // This can be "cookie" or "token". If not provided, "token" will be used. "cookie" activates a split-cookie method where the token is split partially between http-only and regular cookies in order // to keep it safe from rogue JS in the browser. string type = 6 [json_name = "type"]; // @gotags: `class:"public"` - // Attributes are passed to the Auth Method; the valid keys and values depend on the type of Auth Method as well as the command. - google.protobuf.Struct attributes = 4 [json_name = "attributes"]; + oneof attrs { + // Attributes are passed to the Auth Method; the valid keys and values depend on the type of Auth Method as well as the command. + google.protobuf.Struct attributes = 4; + // Note: these fields have a custom mapping function for transforming to and from the generic attributes, + // they do not use the standard attribute transformation. + PasswordLoginAttributes password_login_attributes = 7 [(google.api.field_visibility).restriction = "INTERNAL"]; + OidcStartAttributes oidc_start_attributes = 8 [(google.api.field_visibility).restriction = "INTERNAL"]; + controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackRequest oidc_auth_method_authenticate_callback_request = 9 [(google.api.field_visibility).restriction = "INTERNAL"]; + controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenRequest oidc_auth_method_authenticate_token_request = 10 [(google.api.field_visibility).restriction = "INTERNAL"]; + } // The command to perform. string command = 5 [json_name = "command"]; // @gotags: `class:"public"` @@ -229,8 +229,16 @@ message AuthenticateResponse { reserved "item", "token_type"; // The type of the token returned. Either "cookie" or "token". string type = 3; // @gotags: `class:"public"` - // Valid keys and values depend on the type of Auth Method as well as the command. - google.protobuf.Struct attributes = 4 [json_name = "attributes"]; + oneof attrs { + // Valid keys and values depend on the type of Auth Method as well as the command. + google.protobuf.Struct attributes = 4 [json_name = "attributes"]; + // Note: these fields have a custom mapping function for transforming to and from the generic attributes, + // they do not use the standard attribute transformation. + controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateStartResponse oidc_auth_method_authenticate_start_response = 6 [(google.api.field_visibility).restriction = "INTERNAL"]; + controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackResponse oidc_auth_method_authenticate_callback_response = 7 [(google.api.field_visibility).restriction = "INTERNAL"]; + controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenResponse oidc_auth_method_authenticate_token_response = 8 [(google.api.field_visibility).restriction = "INTERNAL"]; + controller.api.resources.authtokens.v1.AuthToken auth_token_response = 9 [(google.api.field_visibility).restriction = "INTERNAL"]; + } // The command that was performed. string command = 5 [json_name = "command"]; // @gotags: `class:"public"` } diff --git a/internal/servers/controller/handlers/authmethods/authmethod_service.go b/internal/servers/controller/handlers/authmethods/authmethod_service.go index ec9cbca0a..134981896 100644 --- a/internal/servers/controller/handlers/authmethods/authmethod_service.go +++ b/internal/servers/controller/handlers/authmethods/authmethod_service.go @@ -32,9 +32,16 @@ import ( "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" "github.com/hashicorp/go-secure-stdlib/strutil" "google.golang.org/grpc/codes" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/wrapperspb" ) +func init() { + subtypes.RegisterRequestTransformationFunc(&pbs.AuthenticateRequest{}, transformAuthenticateRequestAttributes) + subtypes.RegisterResponseTransformationFunc(&pbs.AuthenticateResponse{}, transformAuthenticateResponseAttributes) +} + const ( // general auth method field names commandField = "command" @@ -792,7 +799,6 @@ func toAuthMethodProto(ctx context.Context, in auth.AuthMethod, opt ...handlers. OidcAuthMethodsAttributes: attrs, } } - fmt.Println("attrs", out.Attrs) return &out, nil } @@ -1194,20 +1200,117 @@ func (s Service) convertToAuthenticateResponse(ctx context.Context, req *pbs.Aut ScopeId: authResults.Scope.Id, Type: resource.AuthToken, } - tok.AuthorizedActions = authResults.FetchActionSetForId(ctx, tok.Id, authtokens.IdActions, requestauth.WithResource(res)).Strings() - retAttrs, err := handlers.ProtoToStruct(tok) - if err != nil { - return nil, err - } tokenType := req.GetType() if tokenType == "" { // Fall back to deprecated field if type is not set tokenType = req.GetTokenType() } + tok.AuthorizedActions = authResults.FetchActionSetForId(ctx, tok.Id, authtokens.IdActions, requestauth.WithResource(res)).Strings() return &pbs.AuthenticateResponse{ - Command: req.GetCommand(), - Attributes: retAttrs, - Type: tokenType, + Command: req.GetCommand(), + Attrs: &pbs.AuthenticateResponse_AuthTokenResponse{ + AuthTokenResponse: tok, + }, + Type: tokenType, }, nil } + +func transformAuthenticateRequestAttributes(msg proto.Message) error { + const op = "authmethod.transformAuthenticateRequestAttributes" + authRequest, ok := msg.(*pbs.AuthenticateRequest) + if !ok { + return fmt.Errorf("%s: message is not an AuthenticateRequest", op) + } + attrs := authRequest.GetAttributes() + if attrs == nil { + return nil + } + switch subtypes.SubtypeFromId(domain, authRequest.GetAuthMethodId()) { + case password.Subtype: + newAttrs := &pbs.PasswordLoginAttributes{} + if err := handlers.StructToProto(attrs, newAttrs); err != nil { + return err + } + authRequest.Attrs = &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: newAttrs, + } + case oidc.Subtype: + switch authRequest.GetCommand() { + case startCommand: + newAttrs := &pbs.OidcStartAttributes{} + if err := handlers.StructToProto(attrs, newAttrs); err != nil { + return err + } + authRequest.Attrs = &pbs.AuthenticateRequest_OidcStartAttributes{ + OidcStartAttributes: newAttrs, + } + case callbackCommand: + newAttrs := &pb.OidcAuthMethodAuthenticateCallbackRequest{} + if err := handlers.StructToProto(attrs, newAttrs, handlers.WithDiscardUnknownFields(true)); err != nil { + return err + } + authRequest.Attrs = &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: newAttrs, + } + case tokenCommand: + newAttrs := &pb.OidcAuthMethodAuthenticateTokenRequest{} + if err := handlers.StructToProto(attrs, newAttrs); err != nil { + return err + } + authRequest.Attrs = &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: newAttrs, + } + default: + return fmt.Errorf("%s: unknown command %q", op, authRequest.GetCommand()) + } + default: + return fmt.Errorf("%s: unknown auth method subtype in ID %q", op, authRequest.GetAuthMethodId()) + } + return nil +} + +func transformAuthenticateResponseAttributes(msg proto.Message) error { + const op = "authmethod.transformAuthenticateResponseAttributes" + authResponse, ok := msg.(*pbs.AuthenticateResponse) + if !ok { + return fmt.Errorf("%s: message is not an AuthenticateResponse", op) + } + attrs := authResponse.GetAttrs() + if attrs == nil { + return nil + } + var newAttrs *structpb.Struct + var err error + switch attrs := attrs.(type) { + case *pbs.AuthenticateResponse_Attributes: + // No transformation necessary + newAttrs = attrs.Attributes + case *pbs.AuthenticateResponse_AuthTokenResponse: + newAttrs, err = handlers.ProtoToStruct(attrs.AuthTokenResponse) + if err != nil { + return err + } + case *pbs.AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse: + newAttrs, err = handlers.ProtoToStruct(attrs.OidcAuthMethodAuthenticateStartResponse) + if err != nil { + return err + } + case *pbs.AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse: + newAttrs, err = handlers.ProtoToStruct(attrs.OidcAuthMethodAuthenticateCallbackResponse) + if err != nil { + return err + } + case *pbs.AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse: + newAttrs, err = handlers.ProtoToStruct(attrs.OidcAuthMethodAuthenticateTokenResponse) + if err != nil { + return err + } + default: + return fmt.Errorf("%s: unknown attributes type %T", op, attrs) + } + authResponse.Attrs = &pbs.AuthenticateResponse_Attributes{ + Attributes: newAttrs, + } + return nil +} diff --git a/internal/servers/controller/handlers/authmethods/authmethod_test.go b/internal/servers/controller/handlers/authmethods/authmethod_test.go new file mode 100644 index 000000000..4975da374 --- /dev/null +++ b/internal/servers/controller/handlers/authmethods/authmethod_test.go @@ -0,0 +1,396 @@ +package authmethods + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" + pba "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authtokens" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/testing/protocmp" + "google.golang.org/protobuf/types/known/structpb" +) + +func TestTransformAuthenticateRequestAttributes(t *testing.T) { + t.Parallel() + cases := []struct { + name string + input *pbs.AuthenticateRequest + expected *pbs.AuthenticateRequest + }{ + { + name: "empty-request", + input: &pbs.AuthenticateRequest{}, + expected: &pbs.AuthenticateRequest{}, + }, + { + name: "password-attributes", + input: &pbs.AuthenticateRequest{ + AuthMethodId: "apw_test", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "login_name": structpb.NewStringValue("login-name"), + "password": structpb.NewStringValue("password"), + }, + }, + }, + }, + expected: &pbs.AuthenticateRequest{ + AuthMethodId: "apw_test", + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: "login-name", + Password: "password", + }, + }, + }, + }, + { + name: "oidc-start-attributes", + input: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "start", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "roundtrip_payload": structpb.NewStructValue(&structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }), + "cached_roundtrip_payload": structpb.NewStringValue("cached-roundtrip-payload"), + }, + }, + }, + }, + expected: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "start", + Attrs: &pbs.AuthenticateRequest_OidcStartAttributes{ + OidcStartAttributes: &pbs.OidcStartAttributes{ + RoundtripPayload: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }, + CachedRoundtripPayload: "cached-roundtrip-payload", + }, + }, + }, + }, + { + name: "oidc-callback-attributes", + input: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "callback", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "code": structpb.NewStringValue("code"), + "state": structpb.NewStringValue("state"), + "error": structpb.NewStringValue("error"), + "error_description": structpb.NewStringValue("error-description"), + "error_uri": structpb.NewStringValue("error-uri"), + }, + }, + }, + }, + expected: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "callback", + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &pb.OidcAuthMethodAuthenticateCallbackRequest{ + Code: "code", + State: "state", + Error: "error", + ErrorDescription: "error-description", + ErrorUri: "error-uri", + }, + }, + }, + }, + { + name: "oidc-callback-attributes-with-extra-fields", + input: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "callback", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "code": structpb.NewStringValue("code"), + "state": structpb.NewStringValue("state"), + "non-callback-field": structpb.NewBoolValue(true), + }, + }, + }, + }, + expected: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "callback", + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &pb.OidcAuthMethodAuthenticateCallbackRequest{ + Code: "code", + State: "state", + }, + }, + }, + }, + { + name: "oidc-token-attributes", + input: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "token", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "token_id": structpb.NewStringValue("token-id"), + }, + }, + }, + }, + expected: &pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "token", + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &pb.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: "token-id", + }, + }, + }, + }, + } + + for _, c := range cases { + c := c + t.Run(c.name, func(t *testing.T) { + t.Parallel() + in := proto.Clone(c.input) + require.NoError(t, transformAuthenticateRequestAttributes(in)) + require.Empty(t, cmp.Diff(c.expected, in, protocmp.Transform())) + }) + } +} + +func TestTransformAuthenticateRequestAttributesErrors(t *testing.T) { + t.Parallel() + t.Run("not-an-authenticate-request", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateRequestAttributes(&pb.AuthMethod{})) + }) + t.Run("invalid-auth-method-id", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateRequestAttributes(&pbs.AuthenticateRequest{ + AuthMethodId: "invalid", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{}, + }, + })) + }) + t.Run("invalid-oidc-command", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateRequestAttributes(&pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "invalid", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{}, + }, + })) + }) + t.Run("invalid-password-attributes", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateRequestAttributes(&pbs.AuthenticateRequest{ + AuthMethodId: "apw_test", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }, + }, + })) + }) + t.Run("invalid-oidc-start-attributes", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateRequestAttributes(&pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "start", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }, + }, + })) + }) + t.Run("invalid-oidc-token-attributes", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateRequestAttributes(&pbs.AuthenticateRequest{ + AuthMethodId: "amoidc_test", + Command: "token", + Attrs: &pbs.AuthenticateRequest_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }, + }, + })) + }) +} + +func TestTransformAuthenticateResponseAttributes(t *testing.T) { + t.Parallel() + cases := []struct { + name string + input *pbs.AuthenticateResponse + expected *pbs.AuthenticateResponse + }{ + { + name: "empty-attributes", + input: &pbs.AuthenticateResponse{ + Command: "testcommand", + }, + expected: &pbs.AuthenticateResponse{ + Command: "testcommand", + }, + }, + { + name: "unstructured-attributes", + input: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }, + }, + }, + expected: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewBoolValue(true), + "field2": structpb.NewStringValue("value2"), + }, + }, + }, + }, + }, + { + name: "authtoken-attributes", + input: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_AuthTokenResponse{ + AuthTokenResponse: &pba.AuthToken{ + Id: "token-id", + }, + }, + }, + expected: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "id": structpb.NewStringValue("token-id"), + }, + }, + }, + }, + }, + { + name: "oidc-start-attributes", + input: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse{ + OidcAuthMethodAuthenticateStartResponse: &pb.OidcAuthMethodAuthenticateStartResponse{ + AuthUrl: "auth-url", + TokenId: "token-id", + }, + }, + }, + expected: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "auth_url": structpb.NewStringValue("auth-url"), + "token_id": structpb.NewStringValue("token-id"), + }, + }, + }, + }, + }, + { + name: "oidc-callback-attributes", + input: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse{ + OidcAuthMethodAuthenticateCallbackResponse: &pb.OidcAuthMethodAuthenticateCallbackResponse{ + FinalRedirectUrl: "final-redirect-url", + }, + }, + }, + expected: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "final_redirect_url": structpb.NewStringValue("final-redirect-url"), + }, + }, + }, + }, + }, + { + name: "oidc-token-attributes", + input: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse{ + OidcAuthMethodAuthenticateTokenResponse: &pb.OidcAuthMethodAuthenticateTokenResponse{ + Status: "status", + }, + }, + }, + expected: &pbs.AuthenticateResponse{ + Command: "testcommand", + Attrs: &pbs.AuthenticateResponse_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "status": structpb.NewStringValue("status"), + }, + }, + }, + }, + }, + } + + for _, c := range cases { + c := c + t.Run(c.name, func(t *testing.T) { + t.Parallel() + in := proto.Clone(c.input) + require.NoError(t, transformAuthenticateResponseAttributes(in)) + require.Empty(t, cmp.Diff(c.expected, in, protocmp.Transform())) + }) + } +} + +func TestTransformAuthenticateResponseAttributesErrors(t *testing.T) { + t.Parallel() + t.Run("not-an-authenticate-response", func(t *testing.T) { + t.Parallel() + require.Error(t, transformAuthenticateResponseAttributes(&pb.AuthMethod{})) + }) +} diff --git a/internal/servers/controller/handlers/authmethods/oidc.go b/internal/servers/controller/handlers/authmethods/oidc.go index 4aeabbd17..9ff63efd7 100644 --- a/internal/servers/controller/handlers/authmethods/oidc.go +++ b/internal/servers/controller/handlers/authmethods/oidc.go @@ -17,7 +17,6 @@ import ( "github.com/hashicorp/boundary/internal/types/action" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" "google.golang.org/grpc/codes" - "google.golang.org/protobuf/types/known/structpb" ) const ( @@ -159,7 +158,7 @@ func (s Service) authenticateOidc(ctx context.Context, req *pbs.AuthenticateRequ return s.authenticateOidcToken(ctx, req, authResults) } - return &pbs.AuthenticateResponse{Command: req.GetCommand(), Attributes: nil}, nil + return &pbs.AuthenticateResponse{Command: req.GetCommand()}, nil } func (s Service) authenticateOidcStart(ctx context.Context, req *pbs.AuthenticateRequest) (*pbs.AuthenticateResponse, error) { @@ -169,10 +168,7 @@ func (s Service) authenticateOidcStart(ctx context.Context, req *pbs.Authenticat } var opts []oidc.Option - attrs := new(pbs.OidcStartAttributes) - if err := handlers.StructToProto(req.GetAttributes(), attrs); err != nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "Error parsing request attributes.", errors.WithWrap(err)) - } + attrs := req.GetOidcStartAttributes() if attrs.GetCachedRoundtripPayload() != "" { opts = append(opts, oidc.WithRoundtripPayload(attrs.GetCachedRoundtripPayload())) } @@ -185,15 +181,15 @@ func (s Service) authenticateOidcStart(ctx context.Context, req *pbs.Authenticat return nil, errors.New(ctx, errors.Internal, op, "Error generating parameters for starting the OIDC flow. See the controller's log for more information.") } - respAttrs := &pb.OidcAuthMethodAuthenticateStartResponse{ - AuthUrl: authUrl.String(), - TokenId: tokenId, - } - resp := &pbs.AuthenticateResponse{Command: req.GetCommand()} - if resp.Attributes, err = handlers.ProtoToStruct(respAttrs); err != nil { - return nil, errors.New(ctx, errors.Internal, op, "Error marshaling parameters.", errors.WithWrap(err)) - } - return resp, nil + return &pbs.AuthenticateResponse{ + Command: req.GetCommand(), + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateStartResponse{ + OidcAuthMethodAuthenticateStartResponse: &pb.OidcAuthMethodAuthenticateStartResponse{ + AuthUrl: authUrl.String(), + TokenId: tokenId, + }, + }, + }, nil } // authenticateOidcCallback behaves differently than other service methods. @@ -236,20 +232,17 @@ func (s Service) authenticateOidcCallback(ctx context.Context, req *pbs.Authenti } u.Add("error", string(out)) errRedirect := fmt.Sprintf("%s?%s", errRedirectBase, u.Encode()) - respAttrs, err := handlers.ProtoToStruct(&pb.OidcAuthMethodAuthenticateCallbackResponse{ - FinalRedirectUrl: errRedirect, - }) - if err != nil { - return nil, errors.Wrap(ctx, err, op, errors.WithMsg("failed creating error redirect response")) - } - return &pbs.AuthenticateResponse{Command: callbackCommand, Attributes: respAttrs}, nil + return &pbs.AuthenticateResponse{ + Command: callbackCommand, + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse{ + OidcAuthMethodAuthenticateCallbackResponse: &pb.OidcAuthMethodAuthenticateCallbackResponse{ + FinalRedirectUrl: errRedirect, + }, + }, + }, nil } - attrs := new(pb.OidcAuthMethodAuthenticateCallbackRequest) - // Note that this conversion has already happened in the validate call so we don't expect errors here. - if err := handlers.StructToProto(req.GetAttributes(), attrs, handlers.WithDiscardUnknownFields(true)); err != nil { - return errResponse(err) - } + attrs := req.GetOidcAuthMethodAuthenticateCallbackRequest() var finalRedirectUrl string if attrs.GetError() != "" { @@ -268,14 +261,14 @@ func (s Service) authenticateOidcCallback(ctx context.Context, req *pbs.Authenti return errResponse(errors.New(ctx, errors.InvalidParameter, op, "Callback validation failed.", errors.WithWrap(err))) } - respAttrs, err := handlers.ProtoToStruct(&pb.OidcAuthMethodAuthenticateCallbackResponse{ - FinalRedirectUrl: finalRedirectUrl, - }) - if err != nil { - return errResponse(errors.New(ctx, errors.Internal, op, "Error marshaling parameters after successful callback", errors.WithWrap(err))) - } - - return &pbs.AuthenticateResponse{Command: req.GetCommand(), Attributes: respAttrs}, nil + return &pbs.AuthenticateResponse{ + Command: req.GetCommand(), + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse{ + OidcAuthMethodAuthenticateCallbackResponse: &pb.OidcAuthMethodAuthenticateCallbackResponse{ + FinalRedirectUrl: finalRedirectUrl, + }, + }, + }, nil } func (s Service) authenticateOidcToken(ctx context.Context, req *pbs.AuthenticateRequest, authResults *auth.VerifyResults) (*pbs.AuthenticateResponse, error) { @@ -286,14 +279,11 @@ func (s Service) authenticateOidcToken(ctx context.Context, req *pbs.Authenticat if authResults == nil { return nil, errors.New(ctx, errors.InvalidParameter, op, "Nil auth results.") } - if req.GetAttributes() == nil { + if req.GetOidcAuthMethodAuthenticateTokenRequest() == nil { return nil, errors.New(ctx, errors.InvalidParameter, op, "Nil request attributes.") } - attrs := new(pb.OidcAuthMethodAuthenticateTokenRequest) - if err := handlers.StructToProto(req.GetAttributes(), attrs); err != nil { - return nil, errors.New(ctx, errors.InvalidParameter, op, "Error parsing request attributes.", errors.WithWrap(err)) - } + attrs := req.GetOidcAuthMethodAuthenticateTokenRequest() if attrs.TokenId == "" { return nil, errors.New(ctx, errors.InvalidParameter, op, "Empty token ID in request attributes.") } @@ -313,15 +303,16 @@ func (s Service) authenticateOidcToken(ctx context.Context, req *pbs.Authenticat } } if token == nil { - attrs, err := structpb.NewStruct(map[string]interface{}{ - statusField: "unknown", - }) if err != nil { return nil, errors.New(ctx, errors.Internal, op, "Error generating response attributes.", errors.WithWrap(err)) } return &pbs.AuthenticateResponse{ - Command: req.Command, - Attributes: attrs, + Command: req.Command, + Attrs: &pbs.AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse{ + OidcAuthMethodAuthenticateTokenResponse: &pb.OidcAuthMethodAuthenticateTokenResponse{ + Status: "unknown", + }, + }, }, nil } @@ -340,12 +331,8 @@ func validateAuthenticateOidcRequest(req *pbs.AuthenticateRequest) error { switch req.GetCommand() { case startCommand: - if req.GetAttributes() != nil { - attrs := new(pbs.OidcStartAttributes) - if err := handlers.StructToProto(req.GetAttributes(), attrs); err != nil { - badFields[attributesField] = "Could not be parsed, or contains invalid fields." - break - } + if req.GetOidcStartAttributes() != nil { + attrs := req.GetOidcStartAttributes() // Ensure we pay no attention to cache information provided by the client attrs.CachedRoundtripPayload = "" @@ -362,23 +349,10 @@ func validateAuthenticateOidcRequest(req *pbs.AuthenticateRequest) error { } else { // Cache for later attrs.CachedRoundtripPayload = string(m) - req.Attributes, err = handlers.ProtoToStruct(attrs) - if err != nil { - return fmt.Errorf("unable to convert map back to proto") - } } } case callbackCommand: - if req.GetAttributes() == nil { - badFields[attributesField] = "No callback attributes provided." - break - } - - attrs := new(pb.OidcAuthMethodAuthenticateCallbackRequest) - if err := handlers.StructToProto(req.GetAttributes(), attrs, handlers.WithDiscardUnknownFields(true)); err != nil { - badFields[attributesField] = "Unable to parse callback request attributes." - break - } + attrs := req.GetOidcAuthMethodAuthenticateCallbackRequest() if attrs.GetCode() == "" && attrs.GetError() == "" { badFields[codeField] = "Code field not supplied in callback request." diff --git a/internal/servers/controller/handlers/authmethods/oidc_test.go b/internal/servers/controller/handlers/authmethods/oidc_test.go index c067a0fd7..142d0a5ae 100644 --- a/internal/servers/controller/handlers/authmethods/oidc_test.go +++ b/internal/servers/controller/handlers/authmethods/oidc_test.go @@ -1404,12 +1404,13 @@ func TestChangeState_OIDC(t *testing.T) { }, { name: "Make Complete Private", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: oidcam.GetVersion(), Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ - OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ - State: "active-private", + req: &pbs.ChangeStateRequest{ + Id: oidcam.GetPublicId(), Version: oidcam.GetVersion(), Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-private", + }, }, }, - }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) am.GetOidcAuthMethodsAttributes().State = "active-private" @@ -1419,12 +1420,13 @@ func TestChangeState_OIDC(t *testing.T) { }, { name: "Make Complete Public", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: 2, Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ - OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ - State: "active-public", + req: &pbs.ChangeStateRequest{ + Id: oidcam.GetPublicId(), Version: 2, Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "active-public", + }, }, }, - }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) am.GetOidcAuthMethodsAttributes().State = "active-public" @@ -1434,12 +1436,13 @@ func TestChangeState_OIDC(t *testing.T) { }, { name: "Make Complete Inactive", - req: &pbs.ChangeStateRequest{Id: oidcam.GetPublicId(), Version: 3, Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ - OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ - State: "inactive", + req: &pbs.ChangeStateRequest{ + Id: oidcam.GetPublicId(), Version: 3, Attrs: &pbs.ChangeStateRequest_OidcChangeStateAttributes{ + OidcChangeStateAttributes: &pbs.OidcChangeStateAttributes{ + State: "inactive", + }, }, }, - }, res: &pbs.ChangeStateResponse{Item: func() *pb.AuthMethod { am := proto.Clone(wantTemplate).(*pb.AuthMethod) am.GetOidcAuthMethodsAttributes().State = "inactive" @@ -1529,16 +1532,18 @@ func TestAuthenticate_OIDC_Start(t *testing.T) { request: &pbs.AuthenticateRequest{ Command: "start", AuthMethodId: s.authMethod.GetPublicId(), - Attributes: func() *structpb.Struct { - ret, err := structpb.NewStruct(map[string]interface{}{ - "roundtrip_payload": map[string]interface{}{ - "foo": "bar", - "baz": true, - }, - }) - require.NoError(t, err) - return ret - }(), + Attrs: &pbs.AuthenticateRequest_OidcStartAttributes{ + OidcStartAttributes: &pbs.OidcStartAttributes{ + RoundtripPayload: func() *structpb.Struct { + ret, err := structpb.NewStruct(map[string]interface{}{ + "foo": "bar", + "baz": true, + }) + require.NoError(t, err) + return ret + }(), + }, + }, }, }, } @@ -1556,13 +1561,10 @@ func TestAuthenticate_OIDC_Start(t *testing.T) { require.Equal(got.GetCommand(), "start") // We can't really compare directly as a lot of the values contain // random data, so just verify existence - require.NotNil(got.GetAttributes()) - m := got.GetAttributes().AsMap() - require.NotNil(m) - require.Contains(m, "auth_url") - require.NotEmpty(m["auth_url"]) - require.Contains(m, "token_id") - require.NotEmpty(m["token_id"]) + got.GetAuthTokenResponse() + require.NotNil(got.GetOidcAuthMethodAuthenticateStartResponse()) + require.NotEmpty(got.GetOidcAuthMethodAuthenticateStartResponse().GetAuthUrl()) + require.NotEmpty(got.GetOidcAuthMethodAuthenticateStartResponse().GetTokenId()) }) } } @@ -1623,18 +1625,16 @@ func TestAuthenticate_OIDC_Token(t *testing.T) { request: &pbs.AuthenticateRequest{ Command: "token", AuthMethodId: s.authMethod.GetPublicId(), - Attributes: func() *structpb.Struct { - ret, err := structpb.NewStruct(map[string]interface{}{ - "token_id": func() string { + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &pb.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: func() string { tokenPublicId, err := authtoken.NewAuthTokenId() require.NoError(t, err) oidc.TestPendingToken(t, testAtRepo, testUser, testAcct, tokenPublicId) return oidc.TestTokenRequestId(t, s.authMethod, s.kmsCache, 200*time.Second, tokenPublicId) }(), - }) - require.NoError(t, err) - return ret - }(), + }, + }, }, }, { @@ -1642,18 +1642,16 @@ func TestAuthenticate_OIDC_Token(t *testing.T) { request: &pbs.AuthenticateRequest{ Command: "token", AuthMethodId: s.authMethod.GetPublicId(), - Attributes: func() *structpb.Struct { - ret, err := structpb.NewStruct(map[string]interface{}{ - "token_id": func() string { + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &pb.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: func() string { tokenPublicId, err := authtoken.NewAuthTokenId() require.NoError(t, err) oidc.TestPendingToken(t, testAtRepo, testUser, testAcct, tokenPublicId) return oidc.TestTokenRequestId(t, s.authMethod, s.kmsCache, -20*time.Second, tokenPublicId) }(), - }) - require.NoError(t, err) - return ret - }(), + }, + }, }, wantErrMatch: errors.T(errors.AuthAttemptExpired), }, @@ -1662,13 +1660,11 @@ func TestAuthenticate_OIDC_Token(t *testing.T) { request: &pbs.AuthenticateRequest{ Command: "token", AuthMethodId: s.authMethod.GetPublicId(), - Attributes: func() *structpb.Struct { - ret, err := structpb.NewStruct(map[string]interface{}{ - "token_id": "bad-token-id", - }) - require.NoError(t, err) - return ret - }(), + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &pb.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: "bad-token-id", + }, + }, }, wantErrMatch: errors.T(errors.Unknown), }, @@ -1689,11 +1685,8 @@ func TestAuthenticate_OIDC_Token(t *testing.T) { } require.NoError(err) require.Equal(got.GetCommand(), "token") - require.NotNil(got.GetAttributes()) - m := got.GetAttributes().AsMap() - require.NotNil(m) - require.Contains(m, "token") - require.NotEmpty(m["token"]) + require.NotNil(got.GetAuthTokenResponse()) + require.NotEmpty(got.GetAuthTokenResponse().GetToken()) }) } } @@ -1710,27 +1703,23 @@ func TestAuthenticate_OIDC_Callback_ErrorRedirect(t *testing.T) { req: &pbs.AuthenticateRequest{ AuthMethodId: s.authMethod.GetPublicId(), Command: "callback", - Attributes: func() *structpb.Struct { - st, err := handlers.ProtoToStruct(&pb.OidcAuthMethodAuthenticateCallbackRequest{ + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &pb.OidcAuthMethodAuthenticateCallbackRequest{ State: "anything", - }) - require.NoError(t, err) - return st - }(), + }, + }, }, }, { name: "No Auth Method Id", req: &pbs.AuthenticateRequest{ Command: "callback", - Attributes: func() *structpb.Struct { - st, err := handlers.ProtoToStruct(&pb.OidcAuthMethodAuthenticateCallbackRequest{ + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &pb.OidcAuthMethodAuthenticateCallbackRequest{ Code: "anythingworks", State: "anything", - }) - require.NoError(t, err) - return st - }(), + }, + }, }, }, { @@ -1738,13 +1727,11 @@ func TestAuthenticate_OIDC_Callback_ErrorRedirect(t *testing.T) { req: &pbs.AuthenticateRequest{ AuthMethodId: s.authMethod.GetPublicId(), Command: "callback", - Attributes: func() *structpb.Struct { - st, err := handlers.ProtoToStruct(&pb.OidcAuthMethodAuthenticateCallbackRequest{ + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &pb.OidcAuthMethodAuthenticateCallbackRequest{ Code: "anythingworks", - }) - require.NoError(t, err) - return st - }(), + }, + }, }, }, } @@ -1784,16 +1771,13 @@ func TestAuthenticate_OIDC_Callback_ErrorRedirect(t *testing.T) { &pbs.AuthenticateRequest{ AuthMethodId: s.authMethod.GetPublicId(), Command: "callback", - Attributes: func() *structpb.Struct { - st, err := handlers.ProtoToStruct(tc.attrs) - require.NoError(t, err) - return st - }(), + Attrs: &pbs.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: tc.attrs, + }, }) require.NoError(t, err) - respAttrs := &pb.OidcAuthMethodAuthenticateCallbackResponse{} - require.NoError(t, handlers.StructToProto(got.GetAttributes(), respAttrs)) + respAttrs := got.GetOidcAuthMethodAuthenticateCallbackResponse() assert.Contains(t, respAttrs.FinalRedirectUrl, fmt.Sprintf("%s/authentication-error?", s.authMethod.GetApiUrl())) u, err := url.Parse(respAttrs.GetFinalRedirectUrl()) require.NoError(t, err) diff --git a/internal/servers/controller/handlers/authmethods/password.go b/internal/servers/controller/handlers/authmethods/password.go index fc6824113..98914c3b0 100644 --- a/internal/servers/controller/handlers/authmethods/password.go +++ b/internal/servers/controller/handlers/authmethods/password.go @@ -88,8 +88,8 @@ func (s Service) updatePwInRepo(ctx context.Context, scopeId, id string, mask [] } func (s Service) authenticatePassword(ctx context.Context, req *pbs.AuthenticateRequest, authResults *auth.VerifyResults) (*pbs.AuthenticateResponse, error) { - reqAttrs := req.GetAttributes().GetFields() - tok, err := s.authenticateWithPwRepo(ctx, authResults.Scope.GetId(), req.GetAuthMethodId(), reqAttrs[loginNameField].GetStringValue(), reqAttrs[passwordField].GetStringValue()) + reqAttrs := req.GetPasswordLoginAttributes() + tok, err := s.authenticateWithPwRepo(ctx, authResults.Scope.GetId(), req.GetAuthMethodId(), reqAttrs.LoginName, reqAttrs.Password) if err != nil { return nil, err } @@ -136,17 +136,11 @@ func (s Service) authenticateWithPwRepo(ctx context.Context, scopeId, authMethod func validateAuthenticatePasswordRequest(req *pbs.AuthenticateRequest) error { badFields := make(map[string]string) - if req.GetAttributes() == nil || req.GetAttributes().GetFields() == nil { - badFields["attributes"] = "This is a required field." - // Return early because we need non-nil values in the rest of the check. - return handlers.InvalidArgumentErrorf("Invalid fields provided in request.", badFields) - } - - attrs := req.GetAttributes().GetFields() - if _, ok := attrs[loginNameField]; !ok { + attrs := req.GetPasswordLoginAttributes() + if attrs.LoginName == "" { badFields["attributes.login_name"] = "This is a required field." } - if _, ok := attrs[passwordField]; !ok { + if attrs.Password == "" { badFields["attributes.password"] = "This is a required field." } if req.GetCommand() == "" { diff --git a/internal/servers/controller/handlers/authmethods/password_test.go b/internal/servers/controller/handlers/authmethods/password_test.go index 4321ed225..9ee65aee2 100644 --- a/internal/servers/controller/handlers/authmethods/password_test.go +++ b/internal/servers/controller/handlers/authmethods/password_test.go @@ -19,14 +19,12 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers/authmethods" "github.com/hashicorp/boundary/internal/types/scope" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" - authtokenpb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authtokens" scopepb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/codes" "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" ) @@ -510,13 +508,12 @@ func TestAuthenticate_Password(t *testing.T) { request: &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), TokenType: "token", - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: testPassword, + }, + }, }, wantType: "token", }, @@ -525,13 +522,12 @@ func TestAuthenticate_Password(t *testing.T) { request: &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), TokenType: "cookie", - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: testPassword, + }, + }, }, wantType: "cookie", }, @@ -539,13 +535,12 @@ func TestAuthenticate_Password(t *testing.T) { name: "no-token-type", request: &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: testPassword, + }, + }, }, }, { @@ -553,26 +548,24 @@ func TestAuthenticate_Password(t *testing.T) { request: &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), TokenType: "email", - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: testPassword, + }, + }, }, wantErr: handlers.ApiErrorWithCode(codes.InvalidArgument), }, { name: "no-authmethod", request: &pbs.AuthenticateRequest{ - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: testPassword, + }, + }, }, wantErr: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -581,13 +574,12 @@ func TestAuthenticate_Password(t *testing.T) { request: &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), TokenType: "token", - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: "wrong"}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: "wrong", + }, + }, }, wantErr: handlers.ApiErrorWithCode(codes.Unauthenticated), }, @@ -596,13 +588,12 @@ func TestAuthenticate_Password(t *testing.T) { request: &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), TokenType: "token", - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: "wrong"}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: "wrong", + Password: testPassword, + }, + }, }, wantErr: handlers.ApiErrorWithCode(codes.Unauthenticated), }, @@ -621,8 +612,8 @@ func TestAuthenticate_Password(t *testing.T) { return } require.NoError(err) - aToken := &authtokenpb.AuthToken{} - require.NoError(handlers.StructToProto(resp.GetAttributes(), aToken, handlers.WithDiscardUnknownFields(true))) + + aToken := resp.GetAuthTokenResponse() assert.NotEmpty(aToken.GetId()) assert.NotEmpty(aToken.GetToken()) assert.True(strings.HasPrefix(aToken.GetToken(), aToken.GetId())) @@ -678,18 +669,16 @@ func TestAuthenticate_AuthAccountConnectedToIamUser_Password(t *testing.T) { require.NoError(err) resp, err := s.Authenticate(auth.DisabledAuthTestContext(iamRepoFn, o.GetPublicId()), &pbs.AuthenticateRequest{ AuthMethodId: am.GetPublicId(), - Attributes: func() *structpb.Struct { - creds := map[string]*structpb.Value{ - "login_name": {Kind: &structpb.Value_StringValue{StringValue: testLoginName}}, - "password": {Kind: &structpb.Value_StringValue{StringValue: testPassword}}, - } - return &structpb.Struct{Fields: creds} - }(), + Attrs: &pbs.AuthenticateRequest_PasswordLoginAttributes{ + PasswordLoginAttributes: &pbs.PasswordLoginAttributes{ + LoginName: testLoginName, + Password: testPassword, + }, + }, }) require.NoError(err) - aToken := &authtokenpb.AuthToken{} - require.NoError(handlers.StructToProto(resp.GetAttributes(), aToken, handlers.WithDiscardUnknownFields(true))) + aToken := resp.GetAuthTokenResponse() assert.Equal(iamUser.GetPublicId(), aToken.GetUserId()) assert.Equal(am.GetPublicId(), aToken.GetAuthMethodId()) assert.Equal(acct.GetPublicId(), aToken.GetAccountId()) diff --git a/internal/servers/controller/handlers/outgoing_response_filter_test.go b/internal/servers/controller/handlers/outgoing_response_filter_test.go index 478c1c452..e6fbff269 100644 --- a/internal/servers/controller/handlers/outgoing_response_filter_test.go +++ b/internal/servers/controller/handlers/outgoing_response_filter_test.go @@ -10,7 +10,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" - pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authtokens" + pba "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authtokens" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/metadata" @@ -19,9 +19,9 @@ import ( func TestOutgoingSplitCookie(t *testing.T) { rec := httptest.NewRecorder() - attrs, err := ProtoToStruct(&pb.AuthToken{Token: "t_abc_1234567890"}) + attrs, err := ProtoToStruct(&pba.AuthToken{Token: "t_abc_1234567890"}) require.NoError(t, err) - require.NoError(t, OutgoingResponseFilter(context.Background(), rec, &pbs.AuthenticateResponse{Attributes: attrs, Type: "cookie"})) + require.NoError(t, OutgoingResponseFilter(context.Background(), rec, &pbs.AuthenticateResponse{Attrs: &pbs.AuthenticateResponse_Attributes{Attributes: attrs}, Type: "cookie"})) assert.ElementsMatch(t, rec.Result().Cookies(), []*http.Cookie{ {Name: HttpOnlyCookieName, Value: "34567890", HttpOnly: true, Raw: "wt-http-token-cookie=34567890; HttpOnly"}, {Name: JsVisibleCookieName, Value: "t_abc_12", Raw: "wt-js-token-cookie=t_abc_12"}, diff --git a/internal/tests/api/authmethods/authenticate_test.go b/internal/tests/api/authmethods/authenticate_test.go index 85323a1be..4e84761a8 100644 --- a/internal/tests/api/authmethods/authenticate_test.go +++ b/internal/tests/api/authmethods/authenticate_test.go @@ -84,11 +84,13 @@ func TestAuthenticate(t *testing.T) { // TODO(johanbrandhorst): revert this when classification is done for auth methods reqDetails := tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["attributes"], "password", "login_name") + tests_api.AssertRedactedValues(t, reqDetails["Attrs"]) + tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["PasswordLoginAttributes"], "password", "login_name") respDetails := tests_api.GetEventDetails(t, got, "response") tests_api.AssertRedactedValues(t, respDetails) - tests_api.AssertRedactedValues(t, respDetails["attributes"], "token", "approximate_last_used_time", "expiration_time", "token_type", "updated_time", "user_id", "account_id", "auth_method_id", "authorized_actions", "created_time", "id") + tests_api.AssertRedactedValues(t, respDetails["Attrs"]) + tests_api.AssertRedactedValues(t, respDetails["Attrs"].(map[string]interface{})["AuthTokenResponse"], "token", "token_type", "user_id", "account_id", "auth_method_id", "authorized_actions", "id", "scope_id") _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls tok, err = methods.Authenticate(tc.Context(), tc.Server().DevPasswordAuthMethodId, "login", map[string]interface{}{"login_name": "user", "password": "bad-pass"}) @@ -98,5 +100,6 @@ func TestAuthenticate(t *testing.T) { reqDetails = tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["attributes"], "password", "login_name") + tests_api.AssertRedactedValues(t, reqDetails["Attrs"]) + tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["PasswordLoginAttributes"], "password", "login_name") } diff --git a/internal/tests/api/authmethods/authmethod_test.go b/internal/tests/api/authmethods/authmethod_test.go index 1c409141a..0e5f73e99 100644 --- a/internal/tests/api/authmethods/authmethod_test.go +++ b/internal/tests/api/authmethods/authmethod_test.go @@ -187,9 +187,16 @@ func TestList(t *testing.T) { result, err = amClient.List(tc.Context(), global) require.NoError(err) require.Len(result.Items, 3) - assert.Empty(cmp.Diff(genOIDCAM, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) - assert.Empty(cmp.Diff(genPWAM, result.Items[1], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) - assert.Empty(cmp.Diff(pwAM.Item, result.Items[2], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty( + cmp.Diff( + result.Items, + []*authmethods.AuthMethod{genOIDCAM, genPWAM, pwAM.Item}, + cmpopts.IgnoreUnexported(authmethods.AuthMethod{}), + cmpopts.SortSlices(func(a, b *authmethods.AuthMethod) bool { + return a.Name < b.Name + }), + ), + ) oidcAM, err := amClient.Create(tc.Context(), "oidc", global, authmethods.WithName("foo"), @@ -206,10 +213,16 @@ func TestList(t *testing.T) { result, err = amClient.List(tc.Context(), global) require.NoError(err) require.Len(result.Items, 4) - assert.Empty(cmp.Diff(genOIDCAM, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) - assert.Empty(cmp.Diff(oidcAM.Item, result.Items[1], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) - assert.Empty(cmp.Diff(genPWAM, result.Items[2], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) - assert.Empty(cmp.Diff(pwAM.Item, result.Items[3], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty( + cmp.Diff( + result.Items, + []*authmethods.AuthMethod{genOIDCAM, genPWAM, pwAM.Item, oidcAM.Item}, + cmpopts.IgnoreUnexported(authmethods.AuthMethod{}), + cmpopts.SortSlices(func(a, b *authmethods.AuthMethod) bool { + return a.Name < b.Name + }), + ), + ) result, err = amClient.List(tc.Context(), global, authmethods.WithFilter(`"/item/attributes/client_id"=="client-id"`)) @@ -221,8 +234,16 @@ func TestList(t *testing.T) { authmethods.WithFilter(`"/item/attributes/min_login_name_length"==3`)) require.NoError(err) require.Len(result.Items, 2) - assert.Empty(cmp.Diff(genPWAM, result.Items[0], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) - assert.Empty(cmp.Diff(pwAM.Item, result.Items[1], cmpopts.IgnoreUnexported(authmethods.AuthMethod{}))) + assert.Empty( + cmp.Diff( + result.Items, + []*authmethods.AuthMethod{genPWAM, pwAM.Item}, + cmpopts.IgnoreUnexported(authmethods.AuthMethod{}), + cmpopts.SortSlices(func(a, b *authmethods.AuthMethod) bool { + return a.Name < b.Name + }), + ), + ) result, err = amClient.List(tc.Context(), global, authmethods.WithFilter(`"/item/attributes/min_password_length"==10`)) diff --git a/internal/tests/api/authmethods/service_classification_test.go b/internal/tests/api/authmethods/service_classification_test.go index 87b2d2253..dd00a3c6c 100644 --- a/internal/tests/api/authmethods/service_classification_test.go +++ b/internal/tests/api/authmethods/service_classification_test.go @@ -8,12 +8,15 @@ import ( "github.com/hashicorp/boundary/internal/gen/controller/api/services" "github.com/hashicorp/boundary/sdk/pbs/controller/api" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authtokens" + "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" - structpb "google.golang.org/protobuf/types/known/structpb" + "google.golang.org/protobuf/types/known/timestamppb" ) // TestAuthenticate_Tags will test that the response filtering aligns with the @@ -38,26 +41,31 @@ func TestAuthenticate_Tags(t *testing.T) { CreatedAt: now, Payload: &services.AuthenticateResponse{ Command: "public-command", - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "account_id": structpb.NewStringValue("public-account_id"), - "approximate_last_used_time": structpb.NewStringValue("public-approximate_last_used_time"), - "auth_method_id": structpb.NewStringValue("public-auth_method_id"), - "authorized_actions": structpb.NewStringValue("public-authorized_actions"), - "created_time": structpb.NewStringValue("public-created_time"), - "expiration_time": structpb.NewStringValue("public-expiration_time"), - "id": structpb.NewStringValue("public-id"), - "scope": structpb.NewStringValue("public-scope"), - "type": structpb.NewStringValue("public-type"), - "updated_time": structpb.NewStringValue("public-updated_time"), - "user_id": structpb.NewStringValue("public-user_id"), - "status": structpb.NewStringValue("public-status"), - "auth_url": structpb.NewStringValue("public-auth_url"), - "token_id": structpb.NewStringValue("public-token_id"), - "final_redirect_url": structpb.NewStringValue("public-final_redirect_url"), - "token": structpb.NewStringValue("secret-token"), + Attrs: &services.AuthenticateResponse_AuthTokenResponse{ + AuthTokenResponse: &authtokens.AuthToken{ + AccountId: "public-account_id", + ApproximateLastUsedTime: timestamppb.New(now), + AuthMethodId: "public-auth_method_id", + AuthorizedActions: []string{ + "public-authorized_actions", + }, + CreatedTime: timestamppb.New(now), + ExpirationTime: timestamppb.New(now), + Id: "public-id", + ScopeId: "public-scope_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", + }, + UpdatedTime: timestamppb.New(now), + UserId: "public-user_id", + Token: "secret-type", }, }, + Type: "public-type", }, }, wantEvent: &eventlogger.Event{ @@ -66,26 +74,31 @@ func TestAuthenticate_Tags(t *testing.T) { Payload: &services.AuthenticateResponse{ Command: "public-command", // TODO(johanbrandhorst): update redaction once typed attributes are available - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "account_id": structpb.NewStringValue(encrypt.RedactedData), - "approximate_last_used_time": structpb.NewStringValue(encrypt.RedactedData), - "auth_method_id": structpb.NewStringValue(encrypt.RedactedData), - "authorized_actions": structpb.NewStringValue(encrypt.RedactedData), - "created_time": structpb.NewStringValue(encrypt.RedactedData), - "expiration_time": structpb.NewStringValue(encrypt.RedactedData), - "id": structpb.NewStringValue(encrypt.RedactedData), - "scope": structpb.NewStringValue(encrypt.RedactedData), - "type": structpb.NewStringValue(encrypt.RedactedData), - "updated_time": structpb.NewStringValue(encrypt.RedactedData), - "user_id": structpb.NewStringValue(encrypt.RedactedData), - "status": structpb.NewStringValue(encrypt.RedactedData), - "auth_url": structpb.NewStringValue(encrypt.RedactedData), - "token_id": structpb.NewStringValue(encrypt.RedactedData), - "final_redirect_url": structpb.NewStringValue(encrypt.RedactedData), - "token": structpb.NewStringValue(encrypt.RedactedData), + Attrs: &services.AuthenticateResponse_AuthTokenResponse{ + AuthTokenResponse: &authtokens.AuthToken{ + AccountId: encrypt.RedactedData, + ApproximateLastUsedTime: timestamppb.New(now), + AuthMethodId: encrypt.RedactedData, + AuthorizedActions: []string{ + encrypt.RedactedData, + }, + CreatedTime: timestamppb.New(now), + ExpirationTime: timestamppb.New(now), + Id: encrypt.RedactedData, + ScopeId: encrypt.RedactedData, + Scope: &scopes.ScopeInfo{ + Id: "public-scope_id", + Type: "public-scope_type", + Name: "public-scope_name", + Description: "public-scope_description", + ParentScopeId: "public-parent_scope_id", + }, + UpdatedTime: timestamppb.New(now), + UserId: encrypt.RedactedData, + Token: encrypt.RedactedData, }, }, + Type: "public-type", }, }, }, @@ -98,14 +111,9 @@ func TestAuthenticate_Tags(t *testing.T) { AuthMethodId: "public-auth-method-id", TokenType: "public-token-type", Command: "public-command", - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "login_name": structpb.NewStringValue("public-login_name"), - "auth_url": structpb.NewStringValue("public-auth_url"), - "token_id": structpb.NewStringValue("public-token_id"), - "state": structpb.NewStringValue("public-state"), - "password": structpb.NewStringValue("secret-password"), - "code": structpb.NewStringValue("secret-code"), + Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &authmethods.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: "public-token-id", }, }, }, @@ -118,14 +126,9 @@ func TestAuthenticate_Tags(t *testing.T) { TokenType: "public-token-type", Command: "public-command", // TODO(johanbrandhorst): update redaction once typed attributes are available - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "login_name": structpb.NewStringValue(encrypt.RedactedData), - "auth_url": structpb.NewStringValue(encrypt.RedactedData), - "token_id": structpb.NewStringValue(encrypt.RedactedData), - "state": structpb.NewStringValue(encrypt.RedactedData), - "password": structpb.NewStringValue(encrypt.RedactedData), - "code": structpb.NewStringValue(encrypt.RedactedData), + Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &authmethods.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: encrypt.RedactedData, }, }, }, diff --git a/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go b/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go index 4a4251f10..34a4903ee 100644 --- a/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go +++ b/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go @@ -50,8 +50,6 @@ type AuthToken struct { ApproximateLastUsedTime *timestamppb.Timestamp `protobuf:"bytes,100,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty"` // Output only. The time this Auth Token expires. ExpirationTime *timestamppb.Timestamp `protobuf:"bytes,110,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"` - // Output only. The type of this auth token. Either "cookie" or "token". - TokenType string `protobuf:"bytes,120,opt,name=token_type,proto3" json:"token_type,omitempty"` // 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"` } @@ -165,13 +163,6 @@ func (x *AuthToken) GetExpirationTime() *timestamppb.Timestamp { return nil } -func (x *AuthToken) GetTokenType() string { - if x != nil { - return x.TokenType - } - return "" -} - func (x *AuthToken) GetAuthorizedActions() []string { if x != nil { return x.AuthorizedActions @@ -193,7 +184,7 @@ var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte 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, 0x22, 0xe7, 0x04, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x6f, 0x22, 0xc7, 0x04, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, @@ -226,9 +217,7 @@ var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x6e, 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, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x78, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 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, 0x56, 0x5a, 0x54, 0x67, From 6b95d5f1fb15d4b06e342f636173b06c14b2caf9 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 12 Apr 2022 17:03:26 -0400 Subject: [PATCH 25/45] doc(classification): Add initial rubric --- internal/adding-a-new-field-readme.md | 81 ++++++++++++++++----------- internal/classification-rubric.md | 31 ++++++++++ 2 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 internal/classification-rubric.md diff --git a/internal/adding-a-new-field-readme.md b/internal/adding-a-new-field-readme.md index eff6e2934..a314e323d 100644 --- a/internal/adding-a-new-field-readme.md +++ b/internal/adding-a-new-field-readme.md @@ -1,60 +1,75 @@ # Extending Boundary: adding additional field to an existing API -A very high level list of things to-do when you're adding an additional field to an existing API and corresponding CLI command. +A very high level list of things to do +when you're adding an additional field to an existing API and corresponding CLI command. ## Add the new field to a repository -Once you've figured out that you need an additional field in Boundary's domain model, then you need to build in support for your new field from the bottom up starting with a repository's database schema. + +Once you've figured out that you need an additional field in Boundary's domain model, +then you need to build in support for your new field from the bottom up starting with a repository's database schema. * Make schema changes: * Define the new column and provide for the migration of existing data - * Create a new migration under `internal/db/schema/migrations/oss/postgres` -* Add the new field to the storage protobuf +* Add the new field to the storage protobuf + * storage protobufs are under: `internal/proto/controller/storage` - - * Define a gorm tag for the new field via `@gotags` (`@inject_tag` has been deprecated) - - * Define a `custom_options.v1.mask_mapping` for the field which maps the storage `this` field to the API `that` field (yes, it's the opposite of how it's defined for the API protobuf) - + * Define a gorm tag for the new field via `@gotags` + (`@inject_tag` has been deprecated) + * Define a `custom_options.v1.mask_mapping` for the field + which maps the storage `this` field to the API `that` field + (yes, it's the opposite of how it's defined for the API protobuf) * Run `make proto` after modifying storage protobuf -* Extend the existing repository function for Updating the resource to incorporate the new field. This could/may entail defining new options for the Update function. - -* Check the repository's Create function for the resource, since you may need to incorporate the new field here as well. +* Extend the existing repository function for Updating the resource to incorporate the new field. + This could/may entail defining new options for the Update function. +* Check the repository's Create function for the resource, + since you may need to incorporate the new field here as well. ## Add new fields to the API/SDK resource protobufs -Now that the repository supports the new field, you can move on to adding this new field to Boundary's API layer and the generated SDK. The first step in the process is to add it to the API/SDK protobufs. + +Now that the repository supports the new field, +you can move on to adding this new field to Boundary's API layer and the generated SDK. +The first step in the process is to add it to the API/SDK protobufs. * API protobufs are under: `internal/proto/controller/api/resources` - -* Define a `custom_options.v1.mask_mapping` tag for the field which maps the API `this` field to the storage `that` field (yes, it's the opposite of how it's defined for a storage protobuf) - +* Define a `custom_options.v1.mask_mapping` tag for the field + which maps the API `this` field to the storage `that` field + (yes, it's the opposite of how it's defined for a storage protobuf) * Define a `custom_options.v1.generate_sdk_option` tag for the SDK +* Define a data classification/filter tag for the field via `@gotags` + which specifies how sensitive/secret/public data + will be handled for the API's audit events. + See the [classification rubric](./classification-rubric.md) + for guidelines on classification. + Please write unit tests to verify the audit event is properly "redacted" + (see the unit tests of `TestAuthMethod_Tags` for [examples][test example]). -* Define a data classification/filter tag for the field via `@gotags` or the - `encrypt.Taggable` interface which specifies how sensitive/secret/public data - will be handled for the API's audit events. Please write unit tests to verify - the audit event is properly "redacted" (see the unit tests of - `TestAuthenticate_Tags` and `TestAuthenticate` for examples). +* Run `make proto` and `make api` after modifying the API/SDK protobufs -* Run `make proto` and `make api` after modifying the API/SDK protobufs +## Update the API handler service -## Update the API handler service -Now that the API protobufs have been updated, you can move on to adding this new field to the API service handler. +Now that the API protobufs have been updated, +you can move on to adding this new field to the API service handler. * Service handlers are under: `internal/servers/controller/handlers` - -* Incorporate the new field into the handlers `updateInRepo` func. You'll need to incorporate the inbound protobuf's field with the repository's update function. This could include adding repository options to the Update function call or passing the new field as a parameter to the call. This work will be based on how you extended the repository in the previous steps. - +* Incorporate the new field into the handlers `updateInRepo` func. + You'll need to incorporate the inbound protobuf's field with the repository's update function. + This could include adding repository options to the Update function call + or passing the new field as a parameter to the call. + This work will be based on how you extended the repository in the previous steps. * Incorporate the new field into the handler's `ToProto` function. - -## Update the CLI's command for updating the resource -At this point, the new field is available via Boundary's API. All that's left is to incorporate it into Boundary's CLI for the appropriate command. +## Update the CLI's command for updating the resource + +At this point, the new field is available via Boundary's API. +All that's left is to incorporate it into Boundary's CLI for the appropriate command. * CLI commands are under: `internal/cmd/commands` - -* Incorporate the new fields to the command's `funcs.go`. Just a suggestion here: you may want to define a const for the new field name and reuse it everywhere it's required (which is several places) - +* Incorporate the new fields to the command's `funcs.go`. + Just a suggestion here: you may want to define a const for the new field name + and reuse it everywhere it's required (which is several places) * Run `make cli` and `make install`, before attempting to test cli changes + +[test example]: tests/api/authmethods/classification_test.go diff --git a/internal/classification-rubric.md b/internal/classification-rubric.md new file mode 100644 index 000000000..737354ebc --- /dev/null +++ b/internal/classification-rubric.md @@ -0,0 +1,31 @@ +# Classification Rubric + +This is an initial set of guidelines to use +when deciding on the classification of +[fields for API/SDK resources](./adding-a-new-field-readme.md#add-new-fields-to-the-apisdk-resource-protobufs). +The classification is used when generating audit events +and will impact the content of the events. + +Fields can be classified as `secret`, `sensitive`, or `public`. +If a field is not classified, it is treated as `secret`. +The classification is used by the +[filters/encrypt][encrypt] library +along with a configurable filter operation. +By default +fields classified as `secret` will be redacted, +fields classified as `sensitive` will be encrypted, +and fields classified as `public` will be left un-modified. +See the [filters/encrypt][encrypt] package for more details. + +* **secret**: This classification should be used for any field that contains + information like tokens, keys, passwords. +* **sensitive**: This classification should be used for any field that contains + information like [personally identifiable information (PII)][PII], such as + names of people, email addresses, etc. +* **public**: This classification should be use for any field that is not + sensitive or secret. + +Tag `@jimlambrt` and `@jefferai` in your PR if you are unsure about how to classify a field. + +[encrypt]: https://github.com/hashicorp/go-eventlogger/tree/main/filters/encrypt#encrypt-package- +[PII]: https://en.wikipedia.org/wiki/Personal_data From 5440195cce4500de98956095f247748062fddcd1 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Wed, 13 Apr 2022 12:56:31 -0400 Subject: [PATCH 26/45] 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() { From 8fa3e8dee068d2dd59667dae825c28e1e5cfa4dd Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Wed, 13 Apr 2022 12:58:19 -0400 Subject: [PATCH 27/45] feat(hostcatalogs): Classify all proto fields --- Makefile | 2 + .../api/services/host_catalog_service.pb.go | 266 +++++++++--------- .../host/plugin/repository_host_catalog.go | 4 +- .../plugin/repository_host_catalog_test.go | 4 +- .../hostcatalogs/v1/host_catalog.proto | 30 +- .../services/v1/host_catalog_service.proto | 19 +- .../host_catalogs/host_catalog_service.go | 32 ++- .../host_catalog_service_test.go | 8 +- .../api/hostcatalogs/classification_test.go | 157 +++++++++++ .../resources/hostcatalogs/host_catalog.pb.go | 123 ++++---- .../hostcatalogs/host_catalog_taggable.go | 20 ++ 11 files changed, 446 insertions(+), 219 deletions(-) create mode 100644 internal/tests/api/hostcatalogs/classification_test.go create mode 100644 sdk/pbs/controller/api/resources/hostcatalogs/host_catalog_taggable.go diff --git a/Makefile b/Makefile index 25199b57d..2acaed99e 100644 --- a/Makefile +++ b/Makefile @@ -161,6 +161,8 @@ protobuild: @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 + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_catalog_service.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_catalog_service.pb.go b/internal/gen/controller/api/services/host_catalog_service.pb.go index 52144a667..52c228875 100644 --- a/internal/gen/controller/api/services/host_catalog_service.pb.go +++ b/internal/gen/controller/api/services/host_catalog_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" hostcatalogs "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostcatalogs" + _ "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 GetHostCatalogRequest 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 *GetHostCatalogRequest) Reset() { @@ -123,9 +124,9 @@ type ListHostCatalogsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListHostCatalogsRequest) Reset() { @@ -236,7 +237,7 @@ type CreateHostCatalogRequest struct { Item *hostcatalogs.HostCatalog `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` // As an alternative to providing the plugin id in the provided HostCatalog, // this field can be used to lookup the plugin using its name. - PluginName string `protobuf:"bytes,2,opt,name=plugin_name,proto3" json:"plugin_name,omitempty"` + PluginName string `protobuf:"bytes,2,opt,name=plugin_name,proto3" json:"plugin_name,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *CreateHostCatalogRequest) Reset() { @@ -290,7 +291,7 @@ type CreateHostCatalogResponse 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 *hostcatalogs.HostCatalog `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -345,7 +346,7 @@ type UpdateHostCatalogRequest 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 *hostcatalogs.HostCatalog `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,3,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` } @@ -455,7 +456,7 @@ type DeleteHostCatalogRequest 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 *DeleteHostCatalogRequest) Reset() { @@ -554,135 +555,138 @@ var file_controller_api_services_v1_host_catalog_service_proto_rawDesc = []byte{ 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x27, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x63, 0x0a, 0x16, 0x47, 0x65, 0x74, - 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, - 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, - 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6b, - 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, - 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, - 0x69, 0x76, 0x65, 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, 0x67, 0x0a, 0x18, 0x4c, - 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, - 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x20, 0x0a, 0x0b, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x78, - 0x0a, 0x19, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, - 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x49, 0x0a, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, + 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, 0x27, 0x0a, 0x15, + 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x63, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, + 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6b, 0x0a, 0x17, 0x4c, 0x69, + 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x14, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 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, 0x67, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, + 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, + 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x22, 0x87, 0x01, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x49, 0x0a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb2, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, - 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, - 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x66, 0x0a, - 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, + 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x78, 0x0a, 0x19, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb2, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x22, 0x1b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xde, - 0x07, 0x0a, 0x12, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xbd, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, - 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x44, 0x92, 0x41, 0x1d, 0x12, 0x1b, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, - 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, - 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, - 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xba, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, - 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x1f, 0x12, 0x1d, 0x47, 0x65, 0x74, 0x73, - 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, - 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x73, 0x12, 0xc2, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, - 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x92, 0x41, 0x18, 0x12, 0x16, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, - 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xc7, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, 0x18, 0x12, - 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x32, 0x16, 0x2f, - 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, - 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x12, 0xbb, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, - 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x64, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x3b, 0x0a, 0x0b, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x66, 0x0a, 0x19, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, + 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x22, 0x2a, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1b, 0x0a, + 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xde, 0x07, 0x0a, 0x12, 0x48, + 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0xbd, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x39, 0x92, 0x41, 0x18, 0x12, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, - 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 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, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x92, 0x41, 0x1d, + 0x12, 0x1b, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, + 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1e, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x12, 0xba, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, + 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x3b, 0x92, 0x41, 0x1f, 0x12, 0x1d, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x6c, + 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, + 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0xc2, + 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, + 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x40, 0x92, 0x41, 0x18, 0x12, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, + 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, + 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x12, 0xc7, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, + 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, + 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, 0x18, 0x12, 0x16, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x32, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, + 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xbb, 0x01, + 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, + 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x39, 0x92, 0x41, 0x18, 0x12, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, + 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x63, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 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/plugin/repository_host_catalog.go b/internal/host/plugin/repository_host_catalog.go index 2302521f6..d591cf825 100644 --- a/internal/host/plugin/repository_host_catalog.go +++ b/internal/host/plugin/repository_host_catalog.go @@ -714,7 +714,9 @@ func toPluginCatalog(ctx context.Context, in *HostCatalog) (*pb.HostCatalog, err if err := proto.Unmarshal(in.GetAttributes(), attrs); err != nil { return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to unmarshal attributes")) } - hc.Attributes = attrs + hc.Attrs = &pb.HostCatalog_Attributes{ + Attributes: attrs, + } } if in.Secrets != nil { hc.Secrets = in.Secrets diff --git a/internal/host/plugin/repository_host_catalog_test.go b/internal/host/plugin/repository_host_catalog_test.go index ba6cba4c8..e1b58e167 100644 --- a/internal/host/plugin/repository_host_catalog_test.go +++ b/internal/host/plugin/repository_host_catalog_test.go @@ -687,7 +687,7 @@ func TestRepository_UpdateCatalog(t *testing.T) { return func(t *testing.T, ctx context.Context) { t.Helper() assert := assert.New(t) - assert.Empty(cmp.Diff(mustStruct(want), gotOnUpdateCatalogRequest.CurrentCatalog.Attributes, protocmp.Transform())) + assert.Empty(cmp.Diff(mustStruct(want), gotOnUpdateCatalogRequest.CurrentCatalog.GetAttributes(), protocmp.Transform())) } } @@ -695,7 +695,7 @@ func TestRepository_UpdateCatalog(t *testing.T) { return func(t *testing.T, ctx context.Context) { t.Helper() assert := assert.New(t) - assert.Empty(cmp.Diff(mustStruct(want), gotOnUpdateCatalogRequest.NewCatalog.Attributes, protocmp.Transform())) + assert.Empty(cmp.Diff(mustStruct(want), gotOnUpdateCatalogRequest.NewCatalog.GetAttributes(), protocmp.Transform())) } } diff --git a/internal/proto/controller/api/resources/hostcatalogs/v1/host_catalog.proto b/internal/proto/controller/api/resources/hostcatalogs/v1/host_catalog.proto index 603dd86d6..baa2338ee 100644 --- a/internal/proto/controller/api/resources/hostcatalogs/v1/host_catalog.proto +++ b/internal/proto/controller/api/resources/hostcatalogs/v1/host_catalog.proto @@ -14,51 +14,53 @@ import "controller/custom_options/v1/options.proto"; // HostCatalog manages Hosts and Host Sets message HostCatalog { // Output only. The ID of the host. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The ID of the Scope of which this Host Catalog is a part. - string scope_id = 20 [json_name="scope_id"]; + string scope_id = 20 [json_name="scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; // The ID of the plugin of which this catalog is created. - string plugin_id = 34 [json_name="plugin_id", (custom_options.v1.generate_sdk_option) = true]; + string plugin_id = 34 [json_name="plugin_id", (custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"` // Output only. Plugin information for this resource. resources.plugins.v1.PluginInfo plugin = 35; // Optional name for identification purposes. - google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}]; + 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 Host Catalog. - string type = 90; + string type = 90; // @gotags: `class:"public"` - // Attributes specific to the catalog type. - google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // Attributes specific to the catalog type. + google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "default"]; + } // Secrets specific to the catalog type. These are never output. google.protobuf.Struct secrets = 110 [(custom_options.v1.generate_sdk_option) = true]; // Output only. The HMAC of the last secrets supplied via the API, if any. - string secrets_hmac = 120; + string secrets_hmac = 120; // @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"` // Output only. The authorized actions for the scope's collections. - map authorized_collection_actions = 310 [json_name="authorized_collection_actions"]; + map authorized_collection_actions = 310 [json_name="authorized_collection_actions"]; // classified as public via taggable implementation } diff --git a/internal/proto/controller/api/services/v1/host_catalog_service.proto b/internal/proto/controller/api/services/v1/host_catalog_service.proto index db8057d9e..74be4be54 100644 --- a/internal/proto/controller/api/services/v1/host_catalog_service.proto +++ b/internal/proto/controller/api/services/v1/host_catalog_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/hostcatalogs/v1/host_catalog.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "host"; service HostCatalogService { @@ -84,7 +87,7 @@ service HostCatalogService { } message GetHostCatalogRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetHostCatalogResponse { @@ -92,9 +95,9 @@ message GetHostCatalogResponse { } message ListHostCatalogsRequest { - string scope_id = 1 [json_name="scope_id"]; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1 [json_name="scope_id"]; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListHostCatalogsResponse { @@ -105,16 +108,16 @@ message CreateHostCatalogRequest { api.resources.hostcatalogs.v1.HostCatalog item = 1; // As an alternative to providing the plugin id in the provided HostCatalog, // this field can be used to lookup the plugin using its name. - string plugin_name = 2 [json_name="plugin_name"]; + string plugin_name = 2 [json_name="plugin_name"]; // @gotags: `class:"public"` } message CreateHostCatalogResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` api.resources.hostcatalogs.v1.HostCatalog item = 2; } message UpdateHostCatalogRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` api.resources.hostcatalogs.v1.HostCatalog item = 2; google.protobuf.FieldMask update_mask = 3; } @@ -124,7 +127,7 @@ message UpdateHostCatalogResponse { } message DeleteHostCatalogRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteHostCatalogResponse {} 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 128f5d6b7..c83fb1518 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service.go @@ -68,6 +68,8 @@ var ( } ) +const domain = "host" + func init() { var err error if staticMaskManager, err = handlers.NewMaskManager(handlers.MaskDestination{&store.HostCatalog{}}, handlers.MaskSource{&pb.HostCatalog{}}); err != nil { @@ -197,7 +199,13 @@ func (s Service) ListHostCatalogs(ctx context.Context, req *pbs.ListHostCatalogs 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) } } @@ -396,7 +404,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 subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -518,7 +526,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 subtypes.SubtypeFromType("host", req.GetItem().GetType()) { + switch subtypes.SubtypeFromType(domain, req.GetItem().GetType()) { case static.Subtype: hc, err = s.createStaticInRepo(ctx, projId, req.GetItem()) default: @@ -582,7 +590,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 subtypes.SubtypeFromId("host", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case static.Subtype: hc, err = s.updateStaticInRepo(ctx, projId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) case plugin.Subtype: @@ -594,7 +602,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 subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -640,7 +648,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. return res } default: - switch subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -757,7 +765,9 @@ func toProto(ctx context.Context, in host.Catalog, opt ...handlers.Option) (*pb. return nil, errors.Wrap(ctx, err, op) } if len(attrs.GetFields()) > 0 { - out.Attributes = attrs + out.Attrs = &pb.HostCatalog_Attributes{ + Attributes: attrs, + } } } } @@ -822,7 +832,7 @@ func validateCreateRequest(req *pbs.CreateHostCatalogRequest) error { if req.GetItem().GetSecretsHmac() != "" { badFields[globals.SecretsHmacField] = "This is a read only field." } - switch subtypes.SubtypeFromType("host", req.GetItem().GetType()) { + switch subtypes.SubtypeFromType(domain, req.GetItem().GetType()) { case static.Subtype: case plugin.Subtype: if req.GetItem().GetPlugin() != nil { @@ -849,16 +859,16 @@ func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest) error { if req.GetItem().GetSecretsHmac() != "" { badFields[globals.SecretsHmacField] = "This is a read only field." } - switch subtypes.SubtypeFromId("host", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case static.Subtype: - if req.GetItem().GetType() != "" && subtypes.SubtypeFromType("host", req.GetItem().GetType()) != static.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, 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() != "" && subtypes.SubtypeFromType("host", req.GetItem().GetType()) != plugin.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, 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_catalogs/host_catalog_service_test.go b/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go index 6e62c68d9..7d490cb4b 100644 --- a/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go +++ b/internal/servers/controller/handlers/host_catalogs/host_catalog_service_test.go @@ -1388,7 +1388,9 @@ func TestUpdate_Plugin(t *testing.T) { Name: wrapperspb.String("default"), Description: wrapperspb.String("default"), Type: "plugin", - Attributes: attr, + Attrs: &pb.HostCatalog_Attributes{ + Attributes: attr, + }, }}) require.NoError(t, err) id := resp.GetItem().GetId() @@ -1422,7 +1424,9 @@ func TestUpdate_Plugin(t *testing.T) { } updateAttrs := func(i *structpb.Struct) updateFn { return func(c *pb.HostCatalog) { - c.Attributes = i + c.Attrs = &pb.HostCatalog_Attributes{ + Attributes: i, + } } } updateSecrets := func(i *structpb.Struct) updateFn { diff --git a/internal/tests/api/hostcatalogs/classification_test.go b/internal/tests/api/hostcatalogs/classification_test.go new file mode 100644 index 000000000..b4986557e --- /dev/null +++ b/internal/tests/api/hostcatalogs/classification_test.go @@ -0,0 +1,157 @@ +package hostcatalogs_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/hostcatalogs" + 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/structpb" + "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.HostCatalog{ + Id: "public-id", + ScopeId: "public-scope_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", + }, + PluginId: "public-plugin_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.HostCatalog_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "public-attr_key": structpb.NewStringValue("sensitive-attr_value"), + }, + }, + }, + Secrets: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "public-secret_key": structpb.NewStringValue("public-secret_value"), + }, + }, + SecretsHmac: "public-hmac", + AuthorizedActions: []string{ + "public-action", + }, + AuthorizedCollectionActions: map[string]*structpb.ListValue{ + "public-collection_action": { + Values: []*structpb.Value{ + structpb.NewStringValue("public-collection_action_value"), + }, + }, + }, + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.HostCatalog{ + Id: "public-id", + ScopeId: "public-scope_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", + }, + PluginId: "public-plugin_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.HostCatalog_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "public-attr_key": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + Secrets: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "public-secret_key": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + SecretsHmac: "public-hmac", + AuthorizedActions: []string{ + "public-action", + }, + AuthorizedCollectionActions: map[string]*structpb.ListValue{ + "public-collection_action": { + Values: []*structpb.Value{ + structpb.NewStringValue("public-collection_action_value"), + }, + }, + }, + }, + }, + }, + } + 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/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go index e892afedc..0b2d55036 100644 --- a/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go +++ b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go @@ -33,38 +33,39 @@ type HostCatalog 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 ID of the Scope of which this Host Catalog is a part. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_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"` // The ID of the plugin of which this catalog is created. - PluginId string `protobuf:"bytes,34,opt,name=plugin_id,proto3" json:"plugin_id,omitempty"` + PluginId string `protobuf:"bytes,34,opt,name=plugin_id,proto3" json:"plugin_id,omitempty" class:"public"` // @gotags: `class:"public"` // 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 Host Catalog. - Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty"` - // Attributes specific to the catalog type. - Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` + // Types that are assignable to Attrs: + // *HostCatalog_Attributes + Attrs isHostCatalog_Attrs `protobuf_oneof:"attrs"` // Secrets specific to the catalog type. These are never output. Secrets *structpb.Struct `protobuf:"bytes,110,opt,name=secrets,proto3" json:"secrets,omitempty"` // Output only. The HMAC of the last secrets supplied via the API, if any. - SecretsHmac string `protobuf:"bytes,120,opt,name=secrets_hmac,json=secretsHmac,proto3" json:"secrets_hmac,omitempty"` + SecretsHmac string `protobuf:"bytes,120,opt,name=secrets_hmac,json=secretsHmac,proto3" json:"secrets_hmac,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"` // Output only. The authorized actions for the scope's collections. - AuthorizedCollectionActions map[string]*structpb.ListValue `protobuf:"bytes,310,rep,name=authorized_collection_actions,proto3" json:"authorized_collection_actions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AuthorizedCollectionActions map[string]*structpb.ListValue `protobuf:"bytes,310,rep,name=authorized_collection_actions,proto3" json:"authorized_collection_actions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // classified as public via taggable implementation } func (x *HostCatalog) Reset() { @@ -176,8 +177,15 @@ func (x *HostCatalog) GetType() string { return "" } +func (m *HostCatalog) GetAttrs() isHostCatalog_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *HostCatalog) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*HostCatalog_Attributes); ok { return x.Attributes } return nil @@ -211,6 +219,17 @@ func (x *HostCatalog) GetAuthorizedCollectionActions() map[string]*structpb.List return nil } +type isHostCatalog_Attrs interface { + isHostCatalog_Attrs() +} + +type HostCatalog_Attributes struct { + // Attributes specific to the catalog type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3,oneof"` +} + +func (*HostCatalog_Attributes) isHostCatalog_Attrs() {} + var File_controller_api_resources_hostcatalogs_v1_host_catalog_proto protoreflect.FileDescriptor var file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_rawDesc = []byte{ @@ -235,7 +254,7 @@ var file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_rawDesc = [ 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, 0x9d, 0x08, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x08, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, @@ -271,43 +290,44 @@ var file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_rawDesc = [ 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x0a, + 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x07, 0x73, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x73, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x5f, - 0x68, 0x6d, 0x61, 0x63, 0x18, 0x78, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x73, 0x48, 0x6d, 0x61, 0x63, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, - 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x1d, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb6, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x56, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, - 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, - 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 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, 0x37, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x73, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, + 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x5f, 0x68, 0x6d, 0x61, + 0x63, 0x18, 0x78, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, + 0x48, 0x6d, 0x61, 0x63, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x9d, 0x01, 0x0a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb6, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x56, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x42, 0x5a, 0x5a, 0x58, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x42, 0x5a, 0x5a, 0x58, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, + 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, + 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, + 0x74, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x63, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -370,6 +390,9 @@ func file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_init() { } } } + file_controller_api_resources_hostcatalogs_v1_host_catalog_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*HostCatalog_Attributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog_taggable.go b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog_taggable.go new file mode 100644 index 000000000..891cc5b5d --- /dev/null +++ b/sdk/pbs/controller/api/resources/hostcatalogs/host_catalog_taggable.go @@ -0,0 +1,20 @@ +package hostcatalogs + +import ( + "fmt" + + "github.com/hashicorp/eventlogger/filters/encrypt" +) + +// Tags implements the encrypt.Taggable interface which allows +// HostCatalog map fields to be classified for the encrypt filter. +func (req *HostCatalog) Tags() ([]encrypt.PointerTag, error) { + tags := make([]encrypt.PointerTag, 0, len(req.AuthorizedCollectionActions)) + for k := range req.AuthorizedCollectionActions { + tags = append(tags, encrypt.PointerTag{ + Pointer: fmt.Sprintf("/AuthorizedCollectionActions/%s", k), + Classification: encrypt.PublicClassification, + }) + } + return tags, nil +} From d51ce41db8b527ac405b03d81a5d4bdf5385ff37 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Wed, 13 Apr 2022 12:58:33 -0400 Subject: [PATCH 28/45] feat(hostsets): Classify all proto fields --- Makefile | 2 + .../api/services/host_set_service.pb.go | 386 +++++++++--------- internal/host/plugin/loopback_test.go | 24 +- internal/host/plugin/repository_host_set.go | 4 +- .../host/plugin/repository_host_set_test.go | 4 +- .../api/resources/hostsets/v1/host_set.proto | 30 +- .../api/services/v1/host_set_service.proto | 33 +- .../handlers/host_sets/host_set_service.go | 46 ++- .../host_sets/host_set_service_test.go | 24 +- .../tests/api/hostsets/classification_test.go | 135 ++++++ .../api/resources/hostsets/host_set.pb.go | 80 ++-- 11 files changed, 483 insertions(+), 285 deletions(-) create mode 100644 internal/tests/api/hostsets/classification_test.go diff --git a/Makefile b/Makefile index 2acaed99e..6c5213d8f 100644 --- a/Makefile +++ b/Makefile @@ -163,6 +163,8 @@ protobuild: @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/plugins/plugin.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hostcatalogs/host_catalog.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_catalog_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hostsets/host_set.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_set_service.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_set_service.pb.go b/internal/gen/controller/api/services/host_set_service.pb.go index 9bf42d3ac..16e17e494 100644 --- a/internal/gen/controller/api/services/host_set_service.pb.go +++ b/internal/gen/controller/api/services/host_set_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" hostsets "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/hostsets" + _ "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 GetHostSetRequest 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 *GetHostSetRequest) Reset() { @@ -123,8 +124,8 @@ type ListHostSetsRequest 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 *ListHostSetsRequest) Reset() { @@ -272,7 +273,7 @@ type CreateHostSetResponse 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 *hostsets.HostSet `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -327,7 +328,7 @@ type UpdateHostSetRequest 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 *hostsets.HostSet `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 DeleteHostSetRequest 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 *DeleteHostSetRequest) Reset() { @@ -522,12 +523,12 @@ type AddHostSetHostsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // A list of Host IDs which will be added to this Host Set. Each Host referenced here must be a child of the same Host Catalog of which this Host Set is a child. - HostIds []string `protobuf:"bytes,3,rep,name=host_ids,proto3" json:"host_ids,omitempty"` + HostIds []string `protobuf:"bytes,3,rep,name=host_ids,proto3" json:"host_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddHostSetHostsRequest) Reset() { @@ -635,12 +636,12 @@ type SetHostSetHostsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // A list of Host IDs which will be set on this Host Set. Each Host referenced here must be a child of the same Host Catalog of which this Host Set is a child. - HostIds []string `protobuf:"bytes,3,rep,name=host_ids,proto3" json:"host_ids,omitempty"` + HostIds []string `protobuf:"bytes,3,rep,name=host_ids,proto3" json:"host_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetHostSetHostsRequest) Reset() { @@ -748,12 +749,12 @@ type RemoveHostSetHostsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // A list of Host IDs which will be removed from this Host Set. - HostIds []string `protobuf:"bytes,3,rep,name=host_ids,proto3" json:"host_ids,omitempty"` + HostIds []string `protobuf:"bytes,3,rep,name=host_ids,proto3" json:"host_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveHostSetHostsRequest) Reset() { @@ -874,197 +875,200 @@ var file_controller_api_services_v1_host_set_service_proto_rawDesc = []byte{ 0x33, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x65, 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, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, - 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x57, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, - 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, 0x5b, 0x0a, 0x14, 0x4c, - 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, - 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, 0x68, 0x6f, - 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, - 0x74, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x59, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 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, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x57, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, + 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x57, + 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x22, 0x59, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, + 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x41, 0x0a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, + 0x6c, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x18, 0x02, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa7, 0x01, + 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, + 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, + 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, + 0x53, 0x65, 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, 0x5a, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x22, 0x6c, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, - 0x74, 0x53, 0x65, 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, 0x41, - 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x22, 0xa7, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, - 0x53, 0x65, 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, 0x41, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x02, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x5a, 0x0a, 0x15, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, - 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, - 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, - 0x17, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x48, - 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x17, 0x41, 0x64, 0x64, 0x48, - 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, - 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, - 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5e, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, - 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, - 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, - 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, + 0x74, 0x65, 0x6d, 0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, + 0x74, 0x53, 0x65, 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, 0x17, 0x0a, 0x15, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x53, + 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x17, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x53, + 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x22, 0x5e, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x22, 0x61, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, + 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x73, 0x22, 0x5f, 0x0a, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x22, 0x61, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, 0x6f, - 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x68, - 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x68, - 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5f, 0x0a, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x68, - 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0x8a, 0x0c, 0x0a, 0x0e, 0x48, 0x6f, 0x73, - 0x74, 0x53, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa8, 0x01, 0x0a, 0x0a, - 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x65, 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, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x18, 0x12, 0x16, - 0x47, 0x65, 0x74, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, - 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x12, 0x2f, 0x76, - 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xbb, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x48, - 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x2f, 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, 0x53, 0x65, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x53, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0x92, 0x41, 0x30, 0x12, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, - 0x65, 0x74, 0x73, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, - 0x73, 0x65, 0x74, 0x73, 0x12, 0xae, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, - 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x69, 0x74, 0x65, 0x6d, 0x32, 0x8a, 0x0c, 0x0a, 0x0e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa8, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x53, 0x65, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, - 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x92, 0x41, 0x14, - 0x12, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, - 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, - 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xb3, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x30, 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, 0x53, - 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 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, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x18, 0x12, 0x16, 0x47, 0x65, 0x74, 0x20, + 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, + 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, + 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x12, 0xbb, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, + 0x65, 0x74, 0x73, 0x12, 0x2f, 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, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0x92, 0x41, 0x30, 0x12, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, + 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x63, 0x20, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0f, 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, + 0x12, 0xae, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, + 0x65, 0x74, 0x12, 0x30, 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, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x92, 0x41, 0x14, 0x12, 0x12, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, + 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x12, 0xb3, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, + 0x53, 0x65, 0x74, 0x12, 0x30, 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, 0x53, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, 0x92, 0x41, 0x14, 0x12, 0x12, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x32, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, + 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa7, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x30, 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, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3d, 0x92, 0x41, - 0x14, 0x12, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, - 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x32, 0x12, 0x2f, 0x76, 0x31, - 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa7, 0x01, 0x0a, 0x0d, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x30, 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, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x31, 0x92, 0x41, 0x14, 0x12, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, - 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, - 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xd0, 0x01, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x73, - 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x6f, 0x73, + 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, + 0x92, 0x41, 0x14, 0x12, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x61, 0x20, 0x48, 0x6f, + 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, + 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x12, 0xd0, 0x01, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, - 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x48, 0x6f, - 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x54, 0x92, 0x41, 0x24, 0x12, 0x22, 0x41, 0x64, 0x64, 0x73, 0x20, 0x65, 0x78, - 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x61, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x27, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, - 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, - 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xcd, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x74, - 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x32, 0x2e, 0x63, + 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x54, + 0x92, 0x41, 0x24, 0x12, 0x22, 0x41, 0x64, 0x64, 0x73, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, + 0x6e, 0x67, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x48, 0x6f, + 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x1c, 0x2f, + 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xcd, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, + 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, - 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, - 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x51, 0x92, 0x41, 0x21, 0x12, 0x1f, 0x53, 0x65, 0x74, 0x73, - 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x27, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, - 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, - 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xda, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, - 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, - 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, - 0x92, 0x41, 0x22, 0x12, 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x48, 0x6f, 0x73, - 0x74, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, - 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, - 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, - 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 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, + 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x51, 0x92, 0x41, 0x21, 0x12, 0x1f, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, + 0x20, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, + 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x1c, 0x2f, + 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xda, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x35, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x36, 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, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x48, 0x6f, 0x73, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x92, 0x41, 0x22, 0x12, + 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x73, 0x20, 0x66, + 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x22, 0x1f, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, + 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, + 0x6d, 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/plugin/loopback_test.go b/internal/host/plugin/loopback_test.go index 691a79736..2723e2355 100644 --- a/internal/host/plugin/loopback_test.go +++ b/internal/host/plugin/loopback_test.go @@ -75,8 +75,10 @@ func TestLoopbackPlugin(t *testing.T) { require.NoError(err) _, err = plg.OnCreateSet(ctx, &plgpb.OnCreateSetRequest{ Set: &hostsets.HostSet{ - Id: "set1", - Attributes: attrs, + Id: "set1", + Attrs: &hostsets.HostSet_Attributes{ + Attributes: attrs, + }, }, }) require.NoError(err) @@ -92,8 +94,10 @@ func TestLoopbackPlugin(t *testing.T) { require.NoError(err) _, err = plg.OnCreateSet(ctx, &plgpb.OnCreateSetRequest{ Set: &hostsets.HostSet{ - Id: "set2", - Attributes: attrs, + Id: "set2", + Attrs: &hostsets.HostSet_Attributes{ + Attributes: attrs, + }, }, }) require.NoError(err) @@ -249,8 +253,10 @@ func TestLoopbackPluginArrays(t *testing.T) { require.NoError(err) _, err = plg.OnCreateSet(ctx, &plgpb.OnCreateSetRequest{ Set: &hostsets.HostSet{ - Id: "set1", - Attributes: attrs, + Id: "set1", + Attrs: &hostsets.HostSet_Attributes{ + Attributes: attrs, + }, }, }) require.NoError(err) @@ -274,8 +280,10 @@ func TestLoopbackPluginArrays(t *testing.T) { require.NoError(err) _, err = plg.OnCreateSet(ctx, &plgpb.OnCreateSetRequest{ Set: &hostsets.HostSet{ - Id: "set2", - Attributes: attrs, + Id: "set2", + Attrs: &hostsets.HostSet_Attributes{ + Attributes: attrs, + }, }, }) require.NoError(err) diff --git a/internal/host/plugin/repository_host_set.go b/internal/host/plugin/repository_host_set.go index 1d905d149..aa21622a3 100644 --- a/internal/host/plugin/repository_host_set.go +++ b/internal/host/plugin/repository_host_set.go @@ -725,7 +725,9 @@ func toPluginSet(ctx context.Context, in *HostSet) (*pb.HostSet, error) { if err := proto.Unmarshal(in.GetAttributes(), attrs); err != nil { return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to marshal attributes")) } - hs.Attributes = attrs + hs.Attrs = &pb.HostSet_Attributes{ + Attributes: attrs, + } } return hs, nil } diff --git a/internal/host/plugin/repository_host_set_test.go b/internal/host/plugin/repository_host_set_test.go index 3fbbf7fa0..9093a52b0 100644 --- a/internal/host/plugin/repository_host_set_test.go +++ b/internal/host/plugin/repository_host_set_test.go @@ -648,14 +648,14 @@ func TestRepository_UpdateSet(t *testing.T) { checkUpdateSetRequestCurrentAttributes := func(want map[string]interface{}) checkPluginReqFunc { return func(t *testing.T, got *plgpb.OnUpdateSetRequest) { t.Helper() - assert.Empty(t, cmp.Diff(mustStruct(want), got.CurrentSet.Attributes, protocmp.Transform()), "checkUpdateSetRequestCurrentAttributes") + assert.Empty(t, cmp.Diff(mustStruct(want), got.CurrentSet.GetAttributes(), protocmp.Transform()), "checkUpdateSetRequestCurrentAttributes") } } checkUpdateSetRequestNewAttributes := func(want map[string]interface{}) checkPluginReqFunc { return func(t *testing.T, got *plgpb.OnUpdateSetRequest) { t.Helper() - assert.Empty(t, cmp.Diff(mustStruct(want), got.NewSet.Attributes, protocmp.Transform()), "checkUpdateSetRequestNewAttributes") + assert.Empty(t, cmp.Diff(mustStruct(want), got.NewSet.GetAttributes(), protocmp.Transform()), "checkUpdateSetRequestNewAttributes") } } diff --git a/internal/proto/controller/api/resources/hostsets/v1/host_set.proto b/internal/proto/controller/api/resources/hostsets/v1/host_set.proto index 952ece673..fc9f7311a 100644 --- a/internal/proto/controller/api/resources/hostsets/v1/host_set.proto +++ b/internal/proto/controller/api/resources/hostsets/v1/host_set.proto @@ -14,10 +14,10 @@ import "controller/custom_options/v1/options.proto"; // HostSet is a collection of Hosts created and managed by a Host Catalog message HostSet { // Output only. The ID of the Host Set. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The Host Catalog of which this Host Set is a part. - string host_catalog_id = 20 [json_name="host_catalog_id"]; + string host_catalog_id = 20 [json_name="host_catalog_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; @@ -26,26 +26,26 @@ message HostSet { 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 Host Set. - string type = 90; + string type = 90; // @gotags: `class:"public"` // Output only. A list of Hosts in this Host Set. - repeated string host_ids = 100 [json_name="host_ids"]; + repeated string host_ids = 100 [json_name="host_ids"]; // @gotags: `class:"public"` // multiple possible endpoints for a host. Preferences are specified by // "cidr:" or "dns:", specifying which IP @@ -53,7 +53,7 @@ message HostSet { // preferred. If no preferences are specified, a value will be chosen from // among all avialable values using a built-in priority order. May not be // valid for all plugin types. - repeated string preferred_endpoints = 101 [json_name="preferred_endpoints", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"preferred_endpoints" that: "PreferredEndpoints"}]; + repeated string preferred_endpoints = 101 [json_name="preferred_endpoints", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"preferred_endpoints" that: "PreferredEndpoints"}]; // @gotags: `class:"public"` // An interger number of seconds indicating the amount of time that should // elapse between syncs of the host set. The interval will be applied to the @@ -61,11 +61,13 @@ message HostSet { // disable syncing for that host set; setting to zero will cause the set to // use Boundary's default. The default may change between releases. May not // be valid for all plugin types. - google.protobuf.Int32Value sync_interval_seconds = 102 [json_name="sync_interval_seconds", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"sync_interval_seconds" that: "SyncIntervalSeconds"}]; + google.protobuf.Int32Value sync_interval_seconds = 102 [json_name="sync_interval_seconds", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"sync_interval_seconds" that: "SyncIntervalSeconds"}]; // @gotags: `class:"public"` - // The attributes that are applicable for the specific Host Set type. - google.protobuf.Struct attributes = 110 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific Host Set type. + google.protobuf.Struct attributes = 110 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.subtype) = "default"]; + } // 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"` } diff --git a/internal/proto/controller/api/services/v1/host_set_service.proto b/internal/proto/controller/api/services/v1/host_set_service.proto index fa8a77fb2..4ed50a385 100644 --- a/internal/proto/controller/api/services/v1/host_set_service.proto +++ b/internal/proto/controller/api/services/v1/host_set_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/hostsets/v1/host_set.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "host"; service HostSetService { // GetHostSet returns a stored Host Set if present. The provided request @@ -135,7 +138,7 @@ service HostSetService { } message GetHostSetRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetHostSetResponse { @@ -143,8 +146,8 @@ message GetHostSetResponse { } message ListHostSetsRequest { - 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 ListHostSetsResponse { @@ -156,12 +159,12 @@ message CreateHostSetRequest { } message CreateHostSetResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` api.resources.hostsets.v1.HostSet item = 2; } message UpdateHostSetRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` api.resources.hostsets.v1.HostSet item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -171,19 +174,19 @@ message UpdateHostSetResponse { } message DeleteHostSetRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteHostSetResponse {} message AddHostSetHostsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; + uint32 version = 2; // @gotags: `class:"public"` // A list of Host IDs which will be added to this Host Set. Each Host referenced here must be a child of the same Host Catalog of which this Host Set is a child. - repeated string host_ids = 3 [json_name="host_ids"]; + repeated string host_ids = 3 [json_name="host_ids"]; // @gotags: `class:"public"` } message AddHostSetHostsResponse { @@ -191,13 +194,13 @@ message AddHostSetHostsResponse { } message SetHostSetHostsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; + uint32 version = 2; // @gotags: `class:"public"` // A list of Host IDs which will be set on this Host Set. Each Host referenced here must be a child of the same Host Catalog of which this Host Set is a child. - repeated string host_ids = 3 [json_name="host_ids"]; + repeated string host_ids = 3 [json_name="host_ids"]; // @gotags: `class:"public"` } message SetHostSetHostsResponse { @@ -205,13 +208,13 @@ message SetHostSetHostsResponse { } message RemoveHostSetHostsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; + uint32 version = 2; // @gotags: `class:"public"` // A list of Host IDs which will be removed from this Host Set. - repeated string host_ids = 3 [json_name="host_ids"]; + repeated string host_ids = 3 [json_name="host_ids"]; // @gotags: `class:"public"` } message RemoveHostSetHostsResponse { 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 9af2cdc82..1a6c73a4c 100644 --- a/internal/servers/controller/handlers/host_sets/host_set_service.go +++ b/internal/servers/controller/handlers/host_sets/host_set_service.go @@ -62,6 +62,8 @@ var ( } ) +const domain = "host" + func init() { var err error if maskManager[static.Subtype], err = handlers.NewMaskManager(handlers.MaskDestination{&staticstore.HostSet{}, &staticstore.UnimplementedSetFields{}}, handlers.MaskSource{&pb.HostSet{}}); err != nil { @@ -127,7 +129,7 @@ func (s Service) ListHostSetsWithOptions(ctx context.Context, req *pbs.ListHostS } for _, item := range hl { res.Id = item.GetPublicId() - idActions := idActionsTypeMap[subtypes.SubtypeFromId("host", 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 @@ -151,7 +153,13 @@ func (s Service) ListHostSetsWithOptions(ctx context.Context, req *pbs.ListHostS 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) } } @@ -185,7 +193,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[subtypes.SubtypeFromId("host", req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } if plg != nil { @@ -227,7 +235,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[subtypes.SubtypeFromId("host", req.GetItem().GetHostCatalogId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetItem().GetHostCatalogId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } if plg != nil { @@ -275,7 +283,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[subtypes.SubtypeFromId("host", req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -330,7 +338,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[subtypes.SubtypeFromId("host", req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -368,7 +376,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[subtypes.SubtypeFromId("host", req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -407,7 +415,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[subtypes.SubtypeFromId("host", req.GetId())] + idActions := idActionsTypeMap[subtypes.SubtypeFromId(domain, req.GetId())] outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, hs.GetPublicId(), idActions).Strings())) } @@ -423,7 +431,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 subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -473,7 +481,7 @@ func (s Service) createInRepo(ctx context.Context, scopeId, catalogId string, it } var hSet host.Set var plg *plugins.PluginInfo - switch subtypes.SubtypeFromId("host", catalogId) { + switch subtypes.SubtypeFromId(domain, catalogId) { case static.Subtype: h, err := toStorageStaticSet(ctx, catalogId, item) if err != nil { @@ -577,7 +585,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 subtypes.SubtypeFromId("host", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case static.Subtype: hs, hosts, err = s.updateStaticInRepo(ctx, scopeId, catalogId, req) case plugin.Subtype: @@ -589,7 +597,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 subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -616,7 +624,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 subtypes.SubtypeFromId("host", catalogId) { + switch subtypes.SubtypeFromId(domain, catalogId) { case static.Subtype: repo, err := s.staticRepoFn() if err != nil { @@ -740,7 +748,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty parentId = id default: var set host.Set - switch subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: ss, _, err := staticRepo.LookupSet(ctx, id) if err != nil { @@ -769,7 +777,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } var cat host.Catalog - switch subtypes.SubtypeFromId("host", id) { + switch subtypes.SubtypeFromId(domain, id) { case static.Subtype: cs, err := staticRepo.LookupCatalog(ctx, parentId) if err != nil { @@ -876,7 +884,9 @@ func toProto(ctx context.Context, in host.Set, hosts []host.Host, opt ...handler return nil, errors.Wrap(ctx, err, op) } if len(attrs.GetFields()) > 0 { - out.Attributes = attrs + out.Attrs = &pb.HostSet_Attributes{ + Attributes: attrs, + } } } } @@ -948,7 +958,7 @@ func validateCreateRequest(ctx context.Context, req *pbs.CreateHostSetRequest) e badFields[globals.PreferredEndpointsField] = fmt.Errorf("Error parsing preferred endpoints: %w.", err).Error() } } - switch subtypes.SubtypeFromId("host", 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." @@ -979,7 +989,7 @@ func validateUpdateRequest(ctx context.Context, req *pbs.UpdateHostSetRequest) e badFields[globals.PreferredEndpointsField] = fmt.Errorf("Error parsing preferred endpoints: %w.", err).Error() } } - switch subtypes.SubtypeFromId("host", 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." diff --git a/internal/servers/controller/handlers/host_sets/host_set_service_test.go b/internal/servers/controller/handlers/host_sets/host_set_service_test.go index 29a8cd64b..dd73aa7df 100644 --- a/internal/servers/controller/handlers/host_sets/host_set_service_test.go +++ b/internal/servers/controller/handlers/host_sets/host_set_service_test.go @@ -903,7 +903,9 @@ func TestCreate_Plugin(t *testing.T) { Description: &wrappers.StringValue{Value: "desc"}, Type: plugin.Subtype.String(), SyncIntervalSeconds: &wrapperspb.Int32Value{Value: 90}, - Attributes: testInputAttrs, + Attrs: &pb.HostSet_Attributes{ + Attributes: testInputAttrs, + }, }}, res: &pbs.CreateHostSetResponse{ Uri: fmt.Sprintf("host-sets/%s_", plugin.HostSetPrefix), @@ -920,7 +922,9 @@ func TestCreate_Plugin(t *testing.T) { Type: plugin.Subtype.String(), SyncIntervalSeconds: &wrapperspb.Int32Value{Value: 90}, AuthorizedActions: testAuthorizedActions[plugin.Subtype], - Attributes: testOutputAttrs, + Attrs: &pb.HostSet_Attributes{ + Attributes: testOutputAttrs, + }, }, }, }, @@ -1480,11 +1484,13 @@ func TestUpdate_Plugin(t *testing.T) { }) require.NoError(t, err) resp, err := tested.CreateHostSet(ctx, &pbs.CreateHostSetRequest{Item: &pb.HostSet{ - HostCatalogId: hc.GetPublicId(), - Name: wrapperspb.String("default"), - Description: wrapperspb.String("default"), - Type: plugin.Subtype.String(), - Attributes: attr, + HostCatalogId: hc.GetPublicId(), + Name: wrapperspb.String("default"), + Description: wrapperspb.String("default"), + Type: plugin.Subtype.String(), + Attrs: &pb.HostSet_Attributes{ + Attributes: attr, + }, PreferredEndpoints: []string{"dns:default"}, }}) require.NoError(t, err) @@ -1528,7 +1534,9 @@ func TestUpdate_Plugin(t *testing.T) { } updateAttrs := func(i *structpb.Struct) updateFn { return func(c *pb.HostSet) { - c.Attributes = i + c.Attrs = &pb.HostSet_Attributes{ + Attributes: i, + } } } diff --git a/internal/tests/api/hostsets/classification_test.go b/internal/tests/api/hostsets/classification_test.go new file mode 100644 index 000000000..5817eb7b7 --- /dev/null +++ b/internal/tests/api/hostsets/classification_test.go @@ -0,0 +1,135 @@ +package hostsets_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/hostsets" + 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/structpb" + "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.HostSet{ + 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.HostSet_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "public-attr_key": structpb.NewStringValue("public-attr_value"), + }, + }, + }, + AuthorizedActions: []string{ + "public-action", + }, + HostCatalogId: "public-host_catalog_id", + HostIds: []string{"public-host_id"}, + PreferredEndpoints: []string{"public-preferred_endpoint"}, + SyncIntervalSeconds: wrapperspb.Int32(60), + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.HostSet{ + 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.HostSet_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "public-attr_key": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + AuthorizedActions: []string{ + "public-action", + }, + HostCatalogId: "public-host_catalog_id", + HostIds: []string{"public-host_id"}, + PreferredEndpoints: []string{"public-preferred_endpoint"}, + SyncIntervalSeconds: wrapperspb.Int32(60), + }, + }, + }, + } + 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/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go b/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go index 01e1eee20..fcd327ccc 100644 --- a/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go +++ b/sdk/pbs/controller/api/resources/hostsets/host_set.pb.go @@ -33,46 +33,47 @@ type HostSet struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Host Set. - 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 Set 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 Host Set. - 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 Hosts in this Host Set. - HostIds []string `protobuf:"bytes,100,rep,name=host_ids,proto3" json:"host_ids,omitempty"` + HostIds []string `protobuf:"bytes,100,rep,name=host_ids,proto3" json:"host_ids,omitempty" class:"public"` // @gotags: `class:"public"` // multiple possible endpoints for a host. Preferences are specified by // "cidr:" or "dns:", specifying which IP // address or DNS name out of a host's available possibilities should be // preferred. If no preferences are specified, a value will be chosen from // among all avialable values using a built-in priority order. May not be // valid for all plugin types. - PreferredEndpoints []string `protobuf:"bytes,101,rep,name=preferred_endpoints,proto3" json:"preferred_endpoints,omitempty"` + PreferredEndpoints []string `protobuf:"bytes,101,rep,name=preferred_endpoints,proto3" json:"preferred_endpoints,omitempty" class:"public"` // @gotags: `class:"public"` // An interger number of seconds indicating the amount of time that should // elapse between syncs of the host set. The interval will be applied to the // end of the previous sync operation, not the start. Setting to -1 will // disable syncing for that host set; setting to zero will cause the set to // use Boundary's default. The default may change between releases. May not // be valid for all plugin types. - SyncIntervalSeconds *wrapperspb.Int32Value `protobuf:"bytes,102,opt,name=sync_interval_seconds,proto3" json:"sync_interval_seconds,omitempty"` - // The attributes that are applicable for the specific Host Set type. - Attributes *structpb.Struct `protobuf:"bytes,110,opt,name=attributes,proto3" json:"attributes,omitempty"` + SyncIntervalSeconds *wrapperspb.Int32Value `protobuf:"bytes,102,opt,name=sync_interval_seconds,proto3" json:"sync_interval_seconds,omitempty" class:"public"` // @gotags: `class:"public"` + // Types that are assignable to Attrs: + // *HostSet_Attributes + Attrs isHostSet_Attrs `protobuf_oneof:"attrs"` // 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 *HostSet) Reset() { @@ -198,8 +199,15 @@ func (x *HostSet) GetSyncIntervalSeconds() *wrapperspb.Int32Value { return nil } +func (m *HostSet) GetAttrs() isHostSet_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *HostSet) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*HostSet_Attributes); ok { return x.Attributes } return nil @@ -212,6 +220,17 @@ func (x *HostSet) GetAuthorizedActions() []string { return nil } +type isHostSet_Attrs interface { + isHostSet_Attrs() +} + +type HostSet_Attributes struct { + // The attributes that are applicable for the specific Host Set type. + Attributes *structpb.Struct `protobuf:"bytes,110,opt,name=attributes,proto3,oneof"` +} + +func (*HostSet_Attributes) isHostSet_Attrs() {} + var File_controller_api_resources_hostsets_v1_host_set_proto protoreflect.FileDescriptor var file_controller_api_resources_hostsets_v1_host_set_proto_rawDesc = []byte{ @@ -235,7 +254,7 @@ var file_controller_api_resources_hostsets_v1_host_set_proto_rawDesc = []byte{ 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, 0xa6, 0x07, 0x0a, 0x07, 0x48, 0x6f, 0x73, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbc, 0x07, 0x0a, 0x07, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x68, @@ -287,19 +306,21 @@ var file_controller_api_resources_hostsets_v1_host_set_proto_rawDesc = []byte{ 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x13, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x15, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, - 0x73, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, + 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, 0x04, - 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, - 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, - 0x74, 0x73, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 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, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, + 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, + 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, + 0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -359,6 +380,9 @@ func file_controller_api_resources_hostsets_v1_host_set_proto_init() { } } } + file_controller_api_resources_hostsets_v1_host_set_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*HostSet_Attributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ From fc6cddfc7f59ef21be919fbc53d632b00d095ef1 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Wed, 13 Apr 2022 15:46:10 -0400 Subject: [PATCH 29/45] feat(authtokens): Add classification to all fields (#1996) --- Makefile | 2 + .../api/services/authtokens_service.pb.go | 10 +- .../resources/authtokens/v1/authtoken.proto | 22 ++-- .../api/services/v1/authtokens_service.proto | 12 +-- .../api/authmethods/authenticate_test.go | 6 +- .../service_classification_test.go | 12 +-- .../api/authtokens/classification_test.go | 102 ++++++++++++++++++ .../api/resources/authtokens/authtoken.pb.go | 22 ++-- 8 files changed, 144 insertions(+), 44 deletions(-) create mode 100644 internal/tests/api/authtokens/classification_test.go diff --git a/Makefile b/Makefile index 6c5213d8f..eea8ce25a 100644 --- a/Makefile +++ b/Makefile @@ -165,6 +165,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_catalog_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/hostsets/host_set.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_set_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/authtokens_service.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/authtokens_service.pb.go b/internal/gen/controller/api/services/authtokens_service.pb.go index 21504de96..66f919c8c 100644 --- a/internal/gen/controller/api/services/authtokens_service.pb.go +++ b/internal/gen/controller/api/services/authtokens_service.pb.go @@ -28,7 +28,7 @@ type GetAuthTokenRequest 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 *GetAuthTokenRequest) Reset() { @@ -122,9 +122,9 @@ type ListAuthTokensRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListAuthTokensRequest) Reset() { @@ -232,7 +232,7 @@ type DeleteAuthTokenRequest 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 *DeleteAuthTokenRequest) Reset() { diff --git a/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto b/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto index f4b6e75a9..4f31098ac 100644 --- a/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto +++ b/internal/proto/controller/api/resources/authtokens/v1/authtoken.proto @@ -10,38 +10,38 @@ import "controller/api/resources/scopes/v1/scope.proto"; // AuthToken contains all fields related to an Auth Token resource message AuthToken { // Output only. The ID of the Auth Token. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The Scope in which this Auth Token was generated. - string scope_id = 20 [json_name="scope_id"]; + string scope_id = 20 [json_name="scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; // Output only. The token value, which will only be populated after authentication and is only ever visible to the end user whose login request resulted in this Auth Token being created. - string token = 40; + string token = 40; // @gotags: `class:"secret"` // Output only. The ID of the User associated with this Auth Token. - string user_id = 50 [json_name="user_id"]; + string user_id = 50 [json_name="user_id"]; // @gotags: `class:"public"` // Output only. The ID of the Auth Method associated with this Auth Token. - string auth_method_id = 60 [json_name="auth_method_id"]; + string auth_method_id = 60 [json_name="auth_method_id"]; // @gotags: `class:"public"` // Output only. The ID of the Account associated with this Auth Token. - string account_id = 70 [json_name="account_id"]; + string account_id = 70 [json_name="account_id"]; // @gotags: `class:"public"` // Output only. The time this resource was created. - google.protobuf.Timestamp created_time = 80 [json_name="created_time"]; + google.protobuf.Timestamp created_time = 80 [json_name="created_time"]; // @gotags: `class:"public"` // Output only. The time this resource was last updated. - google.protobuf.Timestamp updated_time = 90 [json_name="updated_time"]; + google.protobuf.Timestamp updated_time = 90 [json_name="updated_time"]; // @gotags: `class:"public"` // Output only. The approximate time this Auth Token was last used. - google.protobuf.Timestamp approximate_last_used_time = 100 [json_name = "approximate_last_used_time"]; + google.protobuf.Timestamp approximate_last_used_time = 100 [json_name = "approximate_last_used_time"]; // @gotags: `class:"public"` // Output only. The time this Auth Token expires. - google.protobuf.Timestamp expiration_time = 110 [json_name="expiration_time"]; + google.protobuf.Timestamp expiration_time = 110 [json_name="expiration_time"]; // @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"` } diff --git a/internal/proto/controller/api/services/v1/authtokens_service.proto b/internal/proto/controller/api/services/v1/authtokens_service.proto index a76588cd7..d03626d65 100644 --- a/internal/proto/controller/api/services/v1/authtokens_service.proto +++ b/internal/proto/controller/api/services/v1/authtokens_service.proto @@ -49,7 +49,7 @@ service AuthTokenService { } message GetAuthTokenRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetAuthTokenResponse { @@ -57,9 +57,9 @@ message GetAuthTokenResponse { } message ListAuthTokensRequest { - string scope_id = 1 [json_name="scope_id"]; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1 [json_name="scope_id"]; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListAuthTokensResponse { @@ -67,7 +67,7 @@ message ListAuthTokensResponse { } message DeleteAuthTokenRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } -message DeleteAuthTokenResponse {} \ No newline at end of file +message DeleteAuthTokenResponse {} diff --git a/internal/tests/api/authmethods/authenticate_test.go b/internal/tests/api/authmethods/authenticate_test.go index 4e84761a8..a75d3efa0 100644 --- a/internal/tests/api/authmethods/authenticate_test.go +++ b/internal/tests/api/authmethods/authenticate_test.go @@ -81,16 +81,13 @@ func TestAuthenticate(t *testing.T) { got := tests_api.CloudEventFromFile(t, eventConfig.AuditEvents.Name()) // All attribute fields are classified for now. - // TODO(johanbrandhorst): revert this when classification is done for auth methods reqDetails := tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["Attrs"]) tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["PasswordLoginAttributes"], "password", "login_name") respDetails := tests_api.GetEventDetails(t, got, "response") tests_api.AssertRedactedValues(t, respDetails) - tests_api.AssertRedactedValues(t, respDetails["Attrs"]) - tests_api.AssertRedactedValues(t, respDetails["Attrs"].(map[string]interface{})["AuthTokenResponse"], "token", "token_type", "user_id", "account_id", "auth_method_id", "authorized_actions", "id", "scope_id") + tests_api.AssertRedactedValues(t, respDetails["Attrs"].(map[string]interface{})["AuthTokenResponse"], "token") _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls tok, err = methods.Authenticate(tc.Context(), tc.Server().DevPasswordAuthMethodId, "login", map[string]interface{}{"login_name": "user", "password": "bad-pass"}) @@ -100,6 +97,5 @@ func TestAuthenticate(t *testing.T) { reqDetails = tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) - tests_api.AssertRedactedValues(t, reqDetails["Attrs"]) tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["PasswordLoginAttributes"], "password", "login_name") } diff --git a/internal/tests/api/authmethods/service_classification_test.go b/internal/tests/api/authmethods/service_classification_test.go index dd00a3c6c..f227c562b 100644 --- a/internal/tests/api/authmethods/service_classification_test.go +++ b/internal/tests/api/authmethods/service_classification_test.go @@ -76,16 +76,16 @@ func TestAuthenticate_Tags(t *testing.T) { // TODO(johanbrandhorst): update redaction once typed attributes are available Attrs: &services.AuthenticateResponse_AuthTokenResponse{ AuthTokenResponse: &authtokens.AuthToken{ - AccountId: encrypt.RedactedData, + AccountId: "public-account_id", ApproximateLastUsedTime: timestamppb.New(now), - AuthMethodId: encrypt.RedactedData, + AuthMethodId: "public-auth_method_id", AuthorizedActions: []string{ - encrypt.RedactedData, + "public-authorized_actions", }, CreatedTime: timestamppb.New(now), ExpirationTime: timestamppb.New(now), - Id: encrypt.RedactedData, - ScopeId: encrypt.RedactedData, + Id: "public-id", + ScopeId: "public-scope_id", Scope: &scopes.ScopeInfo{ Id: "public-scope_id", Type: "public-scope_type", @@ -94,7 +94,7 @@ func TestAuthenticate_Tags(t *testing.T) { ParentScopeId: "public-parent_scope_id", }, UpdatedTime: timestamppb.New(now), - UserId: encrypt.RedactedData, + UserId: "public-user_id", Token: encrypt.RedactedData, }, }, diff --git a/internal/tests/api/authtokens/classification_test.go b/internal/tests/api/authtokens/classification_test.go new file mode 100644 index 000000000..39f52a51c --- /dev/null +++ b/internal/tests/api/authtokens/classification_test.go @@ -0,0 +1,102 @@ +package authtokens_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/authtokens" + "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" +) + +func TestAuthtokenClassification(t *testing.T) { + ctx := context.Background() + now := time.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + tests := []struct { + name string + testEvent *eventlogger.Event + wantEvent *eventlogger.Event + }{ + { + name: "validate-authtoken-filtering", + testEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.AuthToken{ + AccountId: "public-account_id", + ApproximateLastUsedTime: timestamppb.New(now), + AuthMethodId: "public-auth_method_id", + AuthorizedActions: []string{ + "public-authorized_actions", + }, + CreatedTime: timestamppb.New(now), + ExpirationTime: timestamppb.New(now), + Id: "public-id", + ScopeId: "public-scope_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", + }, + UpdatedTime: timestamppb.New(now), + UserId: "public-user_id", + Token: "secret-token", + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.AuthToken{ + AccountId: "public-account_id", + ApproximateLastUsedTime: timestamppb.New(now), + AuthMethodId: "public-auth_method_id", + AuthorizedActions: []string{ + "public-authorized_actions", + }, + CreatedTime: timestamppb.New(now), + ExpirationTime: timestamppb.New(now), + Id: "public-id", + ScopeId: "public-scope_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", + }, + UpdatedTime: timestamppb.New(now), + UserId: "public-user_id", + Token: encrypt.RedactedData, + }, + }, + }, + } + 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/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go b/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go index 34a4903ee..e7ccc8aeb 100644 --- a/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go +++ b/sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go @@ -29,29 +29,29 @@ type AuthToken struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Auth Token. - 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 Scope in which this Auth Token was generated. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_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. The token value, which will only be populated after authentication and is only ever visible to the end user whose login request resulted in this Auth Token being created. - Token string `protobuf:"bytes,40,opt,name=token,proto3" json:"token,omitempty"` + Token string `protobuf:"bytes,40,opt,name=token,proto3" json:"token,omitempty" class:"secret"` // @gotags: `class:"secret"` // Output only. The ID of the User associated with this Auth Token. - UserId string `protobuf:"bytes,50,opt,name=user_id,proto3" json:"user_id,omitempty"` + UserId string `protobuf:"bytes,50,opt,name=user_id,proto3" json:"user_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The ID of the Auth Method associated with this Auth Token. - AuthMethodId string `protobuf:"bytes,60,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` + AuthMethodId string `protobuf:"bytes,60,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The ID of the Account associated with this Auth Token. - AccountId string `protobuf:"bytes,70,opt,name=account_id,proto3" json:"account_id,omitempty"` + AccountId string `protobuf:"bytes,70,opt,name=account_id,proto3" json:"account_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The time this resource was created. - CreatedTime *timestamppb.Timestamp `protobuf:"bytes,80,opt,name=created_time,proto3" json:"created_time,omitempty"` + CreatedTime *timestamppb.Timestamp `protobuf:"bytes,80,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,90,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,90,opt,name=updated_time,proto3" json:"updated_time,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The approximate time this Auth Token was last used. - ApproximateLastUsedTime *timestamppb.Timestamp `protobuf:"bytes,100,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty"` + ApproximateLastUsedTime *timestamppb.Timestamp `protobuf:"bytes,100,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The time this Auth Token expires. - ExpirationTime *timestamppb.Timestamp `protobuf:"bytes,110,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"` + ExpirationTime *timestamppb.Timestamp `protobuf:"bytes,110,opt,name=expiration_time,proto3" json:"expiration_time,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 *AuthToken) Reset() { From 9643f7af760388420c260428d4e873757c295d55 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 12 Apr 2022 15:56:11 -0400 Subject: [PATCH 30/45] test(managedgroups): Add api tests for managed-groups endpoints --- .../api/managedgroups/managedgroups_test.go | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 internal/tests/api/managedgroups/managedgroups_test.go diff --git a/internal/tests/api/managedgroups/managedgroups_test.go b/internal/tests/api/managedgroups/managedgroups_test.go new file mode 100644 index 000000000..528bce8bd --- /dev/null +++ b/internal/tests/api/managedgroups/managedgroups_test.go @@ -0,0 +1,222 @@ +package managedgroups_test + +import ( + "fmt" + "net/http" + "testing" + + "github.com/hashicorp/boundary/api" + "github.com/hashicorp/boundary/api/authmethods" + "github.com/hashicorp/boundary/api/managedgroups" + "github.com/hashicorp/boundary/internal/iam" + "github.com/hashicorp/boundary/internal/intglobals" + "github.com/hashicorp/boundary/internal/servers/controller" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestListOidc(t *testing.T) { + assert, require := assert.New(t), require.New(t) + tc := controller.NewTestController(t, nil) + defer tc.Shutdown() + + client := tc.Client() + require.NotNil(client) + token := tc.Token() + require.NotNil(token) + client.SetToken(token.Token) + org := iam.TestOrg(t, tc.IamRepo(), iam.WithUserId(token.UserId)) + amClient := authmethods.NewClient(client) + + amResult, err := amClient.Create(tc.Context(), "oidc", org.PublicId, + authmethods.WithName("foo"), + authmethods.WithOidcAuthMethodApiUrlPrefix("https://api.com"), + authmethods.WithOidcAuthMethodIssuer("https://example.com"), + authmethods.WithOidcAuthMethodClientSecret("secret"), + authmethods.WithOidcAuthMethodClientId("client-id")) + require.NoError(err) + require.NotNil(amResult) + am := amResult.Item + + managedgroupClient := managedgroups.NewClient(client) + + lr, err := managedgroupClient.List(tc.Context(), am.Id) + require.NoError(err) + expected := lr.Items + assert.Len(expected, 0) + + cr, err := managedgroupClient.Create(tc.Context(), am.Id, + managedgroups.WithOidcManagedGroupFilter("subject==subject0")) + require.NoError(err) + expected = append(expected, cr.Item) + + ulResult, err := managedgroupClient.List(tc.Context(), am.Id) + require.NoError(err) + assert.ElementsMatch(comparableSlice(expected[:1]), comparableSlice(ulResult.Items)) + + for i := 1; i < 10; i++ { + newManagedGroupResult, err := managedgroupClient.Create(tc.Context(), am.Id, + managedgroups.WithOidcManagedGroupFilter(fmt.Sprintf("subject==subject%d", i))) + require.NoError(err) + expected = append(expected, newManagedGroupResult.Item) + } + ulResult, err = managedgroupClient.List(tc.Context(), am.Id) + require.NoError(err) + assert.ElementsMatch(comparableSlice(expected), comparableSlice(ulResult.Items)) + + filterItem := expected[3] + ulResult, err = managedgroupClient.List(tc.Context(), am.Id, + managedgroups.WithFilter(fmt.Sprintf(`"/item/attributes/filter"==%q`, filterItem.Attributes["filter"]))) + require.NoError(err) + require.Len(ulResult.Items, 1) + assert.Equal(filterItem.Id, ulResult.Items[0].Id) +} + +func comparableSlice(in []*managedgroups.ManagedGroup) []managedgroups.ManagedGroup { + var filtered []managedgroups.ManagedGroup + for _, i := range in { + p := managedgroups.ManagedGroup{ + Id: i.Id, + Name: i.Name, + Description: i.Description, + CreatedTime: i.CreatedTime, + UpdatedTime: i.UpdatedTime, + Attributes: i.Attributes, + } + filtered = append(filtered, p) + } + return filtered +} + +func TestCrudOidc(t *testing.T) { + assert, require := assert.New(t), require.New(t) + tc := controller.NewTestController(t, nil) + defer tc.Shutdown() + + client := tc.Client() + token := tc.Token() + client.SetToken(token.Token) + amClient := authmethods.NewClient(client) + amResult, err := amClient.Create(tc.Context(), "oidc", "global", + authmethods.WithName("foo"), + authmethods.WithOidcAuthMethodApiUrlPrefix("https://api.com"), + authmethods.WithOidcAuthMethodIssuer("https://example.com"), + authmethods.WithOidcAuthMethodClientSecret("secret"), + authmethods.WithOidcAuthMethodClientId("client-id")) + require.NoError(err) + require.NotNil(amResult) + amId := amResult.Item.Id + + managedgroupClient := managedgroups.NewClient(client) + + checkmanagedgroup := func(step string, u *managedgroups.ManagedGroup, err error, wantedName string, wantedVersion uint32) { + assert.NoError(err, step) + require.NotNil(u, "returned no resource", step) + gotName := "" + if u.Name != "" { + gotName = u.Name + } + assert.Equal(wantedName, gotName, step) + assert.EqualValues(wantedVersion, u.Version) + } + + u, err := managedgroupClient.Create(tc.Context(), amId, managedgroups.WithName("foo"), + managedgroups.WithOidcManagedGroupFilter("subject==subject0")) + checkmanagedgroup("create", u.Item, err, "foo", 1) + + u, err = managedgroupClient.Read(tc.Context(), u.Item.Id) + checkmanagedgroup("read", u.Item, err, "foo", 1) + + u, err = managedgroupClient.Update(tc.Context(), u.Item.Id, u.Item.Version, managedgroups.WithName("bar")) + checkmanagedgroup("update", u.Item, err, "bar", 2) + + u, err = managedgroupClient.Update(tc.Context(), u.Item.Id, u.Item.Version, managedgroups.DefaultName()) + checkmanagedgroup("update", u.Item, err, "", 3) + + _, err = managedgroupClient.Delete(tc.Context(), u.Item.Id) + require.NoError(err) +} + +func TestErrors(t *testing.T) { + assert, require := assert.New(t), require.New(t) + tc := controller.NewTestController(t, nil) + defer tc.Shutdown() + + client := tc.Client() + token := tc.Token() + client.SetToken(token.Token) + amId := token.AuthMethodId + managedgroupClient := managedgroups.NewClient(client) + + // amIs is a password authmethod, password does not have managed groups + _, err := managedgroupClient.Create(tc.Context(), amId) + require.Error(err) + + _, err = managedgroupClient.Read(tc.Context(), "invalid id") + require.Error(err) + apiErr := api.AsServerError(err) + require.NotNil(apiErr) + assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode()) +} + +func TestErrorsOidc(t *testing.T) { + assert, require := assert.New(t), require.New(t) + tc := controller.NewTestController(t, nil) + defer tc.Shutdown() + + client := tc.Client() + token := tc.Token() + client.SetToken(token.Token) + + amClient := authmethods.NewClient(client) + amResult, err := amClient.Create(tc.Context(), "oidc", "global", + authmethods.WithName("foo"), + authmethods.WithOidcAuthMethodApiUrlPrefix("https://api.com"), + authmethods.WithOidcAuthMethodIssuer("https://example.com"), + authmethods.WithOidcAuthMethodClientSecret("secret"), + authmethods.WithOidcAuthMethodClientId("client-id")) + require.NoError(err) + require.NotNil(amResult) + amId := amResult.Item.Id + + managedgroupClient := managedgroups.NewClient(client) + + u, err := managedgroupClient.Create(tc.Context(), amId, + managedgroups.WithName("foo"), + managedgroups.WithOidcManagedGroupFilter("subject==subject1")) + require.NoError(err) + assert.NotNil(u) + + // Updating the wrong version should fail. + _, err = managedgroupClient.Update(tc.Context(), u.Item.Id, 73, managedgroups.WithName("anything")) + require.Error(err) + apiErr := api.AsServerError(err) + require.NotNil(apiErr) + assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode()) + + // Create another resource with the same name. + _, err = managedgroupClient.Create(tc.Context(), amId, + managedgroups.WithName("foo"), + managedgroups.WithOidcManagedGroupFilter("subject==subject1")) + require.Error(err) + apiErr = api.AsServerError(err) + require.NotNil(apiErr) + + _, err = managedgroupClient.Read(tc.Context(), intglobals.OidcManagedGroupPrefix+"_doesntexis") + require.Error(err) + apiErr = api.AsServerError(err) + require.NotNil(apiErr) + assert.EqualValues(http.StatusNotFound, apiErr.Response().StatusCode()) + + _, err = managedgroupClient.Read(tc.Context(), "invalid id") + require.Error(err) + apiErr = api.AsServerError(err) + require.NotNil(apiErr) + assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode()) + + _, err = managedgroupClient.Update(tc.Context(), u.Item.Id, u.Item.Version) + require.Error(err) + apiErr = api.AsServerError(err) + require.NotNil(apiErr) + assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode()) +} From 5d6cb0009dfb9951bc580b14e6ef9d621163f884 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 8 Apr 2022 16:09:52 -0400 Subject: [PATCH 31/45] refact(managed-groups): Switch subtype attributes to oneof This updates the credential store resources to use a oneof for attributes. This allows requests to the credential store service to leverage the new subtypes.AttributeTransformerInterceptor so that attributes are strongly typed prior to the service handler. --- .../api/services/managed_group_service.pb.go | 250 +++++++++--------- .../managedgroups/v1/managed_group.proto | 17 +- .../services/v1/managed_group_service.proto | 5 +- .../managed_groups/managed_group_service.go | 40 +-- .../managed_group_service_test.go | 170 +++++++----- .../handlers/managed_groups/validate_test.go | 39 ++- .../managedgroups/managed_group.pb.go | 183 ++++++++----- 7 files changed, 393 insertions(+), 311 deletions(-) diff --git a/internal/gen/controller/api/services/managed_group_service.pb.go b/internal/gen/controller/api/services/managed_group_service.pb.go index 8a12c7f9c..0ddbccf1e 100644 --- a/internal/gen/controller/api/services/managed_group_service.pb.go +++ b/internal/gen/controller/api/services/managed_group_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" managedgroups "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/managedgroups" + _ "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" @@ -536,138 +537,141 @@ var file_controller_api_services_v1_managed_group_service_proto_rawDesc = []byte 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x66, 0x0a, - 0x17, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x18, 0x01, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5a, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x6a, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, - 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x68, 0x0a, - 0x19, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x02, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x7b, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 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, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x02, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x22, 0xb6, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 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, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 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, 0x69, 0x0a, - 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 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, + 0x28, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x66, 0x0a, 0x17, 0x47, 0x65, 0x74, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 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, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x22, 0x5a, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, + 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 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, 0x6a, 0x0a, + 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x05, 0x69, 0x74, + 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x32, 0xae, 0x08, 0x0a, 0x13, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc1, 0x01, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, - 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, 0x1d, 0x12, 0x1b, 0x47, - 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, - 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, - 0xd3, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, + 0x75, 0x70, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x68, 0x0a, 0x19, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, + 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, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x22, 0x7b, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 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, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 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, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x22, 0xb6, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x4b, + 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 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, 0x69, 0x0a, 0x1a, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xae, 0x08, 0x0a, 0x13, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xc1, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x51, 0x92, 0x41, 0x34, 0x12, 0x32, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, - 0x6c, 0x6c, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x41, - 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x14, 0x12, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0xea, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x36, 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, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x65, 0x92, 0x41, 0x3c, - 0x12, 0x3a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, - 0x6c, 0x65, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, - 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, - 0x41, 0x75, 0x74, 0x68, 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x20, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x12, 0xcc, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x36, 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, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x47, 0x92, 0x41, 0x19, 0x12, 0x17, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x32, 0x17, 0x2f, 0x76, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x92, 0x41, 0x1d, 0x12, 0x1b, 0x47, 0x65, 0x74, 0x73, 0x20, + 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x12, 0xc0, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, + 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xd3, 0x01, 0x0a, 0x11, + 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x51, + 0x92, 0x41, 0x34, 0x12, 0x32, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x20, 0x69, 0x6e, 0x20, + 0x61, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x41, 0x75, 0x74, 0x68, 0x20, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, + 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, + 0x73, 0x12, 0xea, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 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, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x19, 0x12, 0x17, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f, 0x76, 0x31, - 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 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, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x65, 0x92, 0x41, 0x3c, 0x12, 0x3a, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x41, 0x75, 0x74, 0x68, + 0x20, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x22, 0x12, + 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xcc, + 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 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, + 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x47, 0x92, 0x41, 0x19, 0x12, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x73, 0x20, 0x61, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x32, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xc0, 0x01, + 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 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, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x3b, 0x92, 0x41, 0x19, 0x12, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x73, 0x20, 0x61, 0x20, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x2d, 0x67, 0x72, 0x6f, 0x75, 0x70, 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, 0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto b/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto index d334eb3a9..80f09fdca 100644 --- a/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto +++ b/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; @@ -40,8 +41,18 @@ message ManagedGroup { // The ID of the Auth Method that is associated with this ManagedGroup. string auth_method_id = 90 [json_name="auth_method_id"]; - // The attributes that are applicable for the specific ManagedGroup type. - google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific ManagedGroup type. + google.protobuf.Struct attributes = 100 [ + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "default" + ]; + OidcManagedGroupAttributes oidc_managed_group_attributes = 101 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "oidc" + ]; + } // Output only. The IDs of the current set of members (accounts) that are associated with this ManagedGroup. repeated string member_ids = 110 [json_name="member_ids"]; @@ -54,4 +65,4 @@ message ManagedGroup { message OidcManagedGroupAttributes { // The boolean expression filter to use to determine membership. string filter = 10 [json_name="filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.filter" that: "Filter"}]; -} \ No newline at end of file +} diff --git a/internal/proto/controller/api/services/v1/managed_group_service.proto b/internal/proto/controller/api/services/v1/managed_group_service.proto index f06f2a31a..3dd1091e0 100644 --- a/internal/proto/controller/api/services/v1/managed_group_service.proto +++ b/internal/proto/controller/api/services/v1/managed_group_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/managedgroups/v1/managed_group.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "auth"; service ManagedGroupService { @@ -125,4 +128,4 @@ message DeleteManagedGroupRequest { string id = 1; } -message DeleteManagedGroupResponse {} \ No newline at end of file +message DeleteManagedGroupResponse {} diff --git a/internal/servers/controller/handlers/managed_groups/managed_group_service.go b/internal/servers/controller/handlers/managed_groups/managed_group_service.go index c8abe8a8c..398fbd0c2 100644 --- a/internal/servers/controller/handlers/managed_groups/managed_group_service.go +++ b/internal/servers/controller/handlers/managed_groups/managed_group_service.go @@ -129,7 +129,11 @@ func (s Service) ListManagedGroups(ctx context.Context, req *pbs.ListManagedGrou // This comes last so that we can use item fields in the filter after // the allowed fields are populated above - if filter.Match(item) { + filterable, err := subtypes.Filterable(item) + if err != nil { + return nil, err + } + if filter.Match(filterable) { finalItems = append(finalItems, item) } } @@ -317,11 +321,7 @@ func (s Service) createOidcInRepo(ctx context.Context, am auth.AuthMethod, item if item.GetDescription() != nil { opts = append(opts, oidc.WithDescription(item.GetDescription().GetValue())) } - attrs := &pb.OidcManagedGroupAttributes{} - if err := handlers.StructToProto(item.GetAttributes(), attrs); err != nil { - return nil, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{"attributes": "Attribute fields do not match the expected format."}) - } + attrs := item.GetOidcManagedGroupAttributes() mg, err := oidc.NewManagedGroup(ctx, am.GetPublicId(), attrs.GetFilter(), opts...) if err != nil { return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "Unable to build user for creation: %v.", err) @@ -374,15 +374,8 @@ func (s Service) updateOidcInRepo(ctx context.Context, scopeId, amId, id string, if item.GetDescription() != nil { mg.Description = item.GetDescription().GetValue() } - if apiAttr := item.GetAttributes(); apiAttr != nil { - attrs := &pb.OidcManagedGroupAttributes{} - if err := handlers.StructToProto(apiAttr, attrs); err != nil { - return nil, handlers.InvalidArgumentErrorf("Error in provided request.", - map[string]string{globals.AttributesField: "Attribute fields do not match the expected format."}) - } - // Set this regardless; it'll only take effect if the masks contain the value - mg.Filter = attrs.Filter - } + // Set this regardless; it'll only take effect if the masks contain the value + mg.Filter = item.GetOidcManagedGroupAttributes().GetFilter() version := item.GetVersion() @@ -568,11 +561,9 @@ func toProto(ctx context.Context, in auth.ManagedGroup, opt ...handlers.Option) attrs := &pb.OidcManagedGroupAttributes{ Filter: i.GetFilter(), } - st, err := handlers.ProtoToStruct(attrs) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building oidc attribute struct: %v", err) + out.Attrs = &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: attrs, } - out.Attributes = st } return &out, nil } @@ -605,9 +596,9 @@ func validateCreateRequest(req *pbs.CreateManagedGroupRequest) error { if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[globals.TypeField] = "Doesn't match the parent resource's type." } - attrs := &pb.OidcManagedGroupAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = "Attribute fields do not match the expected format." + attrs := req.GetItem().GetOidcManagedGroupAttributes() + if attrs == nil { + badFields[globals.AttributesField] = "Attribute fields is required." } if attrs.Filter == "" { badFields[attrFilterField] = "This field is required." @@ -635,10 +626,7 @@ func validateUpdateRequest(req *pbs.UpdateManagedGroupRequest) error { if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[globals.TypeField] = "Cannot modify the resource type." } - attrs := &pb.OidcManagedGroupAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = "Attribute fields do not match the expected format." - } + attrs := req.GetItem().GetOidcManagedGroupAttributes() if handlers.MaskContains(req.GetUpdateMask().GetPaths(), attrFilterField) { if attrs.Filter == "" { badFields[attrFilterField] = "Field cannot be empty." diff --git a/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go b/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go index 1ca2cda25..71f8c7698 100644 --- a/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go +++ b/internal/servers/controller/handlers/managed_groups/managed_group_service_test.go @@ -32,7 +32,6 @@ import ( "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc/codes" "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" ) @@ -124,14 +123,18 @@ func TestGet(t *testing.T) { require.NoError(t, err) oidcWireManagedGroup := pb.ManagedGroup{ - Id: omg.GetPublicId(), - AuthMethodId: omg.GetAuthMethodId(), - CreatedTime: omg.GetCreateTime().GetTimestamp(), - UpdatedTime: currMg.GetUpdateTime().GetTimestamp(), - Scope: &scopepb.ScopeInfo{Id: org.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, - Version: currMg.Version, - Type: "oidc", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{"filter": structpb.NewStringValue(omg.GetFilter())}}, + Id: omg.GetPublicId(), + AuthMethodId: omg.GetAuthMethodId(), + CreatedTime: omg.GetCreateTime().GetTimestamp(), + UpdatedTime: currMg.GetUpdateTime().GetTimestamp(), + Scope: &scopepb.ScopeInfo{Id: org.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, + Version: currMg.Version, + Type: "oidc", + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: omg.GetFilter(), + }, + }, AuthorizedActions: oidcAuthorizedActions, MemberIds: []string{oidcA.GetPublicId()}, } @@ -216,9 +219,11 @@ func TestListOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(oidc.TestFakeManagedGroupFilter), - }}, + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, AuthorizedActions: oidcAuthorizedActions, }) } @@ -235,9 +240,11 @@ func TestListOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(oidc.TestFakeManagedGroupFilter), - }}, + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, AuthorizedActions: oidcAuthorizedActions, }) } @@ -320,7 +327,7 @@ func TestListOidc(t *testing.T) { require.NoError(gErr) assert.Len(got.Items, len(tc.res.Items)) for _, g := range got.GetItems() { - assert.Nil(g.Attributes) + assert.Nil(g.Attrs) assert.Nil(g.CreatedTime) assert.Nil(g.UpdatedTime) assert.Empty(g.Version) @@ -467,13 +474,6 @@ func TestCreateOidc(t *testing.T) { oidc.WithApiUrl(oidc.TestConvertToUrls(t, "https://www.alice.com/callback")[0]), ) - createAttr := func() *structpb.Struct { - attr := &pb.OidcManagedGroupAttributes{Filter: oidc.TestFakeManagedGroupFilter} - ret, err := handlers.ProtoToStruct(attr) - require.NoError(t, err, "Error converting proto to struct.") - return ret - } - cases := []struct { name string req *pbs.CreateManagedGroupRequest @@ -488,7 +488,11 @@ func TestCreateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: oidc.Subtype.String(), - Attributes: createAttr(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, }, }, res: &pbs.CreateManagedGroupResponse{ @@ -500,11 +504,11 @@ func TestCreateOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr() - a.Fields["filter"] = structpb.NewStringValue(oidc.TestFakeManagedGroupFilter) - return a - }(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, AuthorizedActions: oidcAuthorizedActions, }, }, @@ -514,7 +518,11 @@ func TestCreateOidc(t *testing.T) { req: &pbs.CreateManagedGroupRequest{ Item: &pb.ManagedGroup{ AuthMethodId: am.GetPublicId(), - Attributes: createAttr(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, }, }, res: &pbs.CreateManagedGroupResponse{ @@ -524,11 +532,11 @@ func TestCreateOidc(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String(), ParentScopeId: scope.Global.String()}, Version: 1, Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr() - a.Fields["filter"] = structpb.NewStringValue(oidc.TestFakeManagedGroupFilter) - return a - }(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, AuthorizedActions: oidcAuthorizedActions, }, }, @@ -539,7 +547,11 @@ func TestCreateOidc(t *testing.T) { Item: &pb.ManagedGroup{ AuthMethodId: am.GetPublicId(), Type: password.Subtype.String(), - Attributes: createAttr(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, }, }, res: nil, @@ -552,7 +564,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), Id: intglobals.OidcManagedGroupPrefix + "_notallowed", Type: oidc.Subtype.String(), - Attributes: createAttr(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, }, }, res: nil, @@ -565,7 +581,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), CreatedTime: timestamppb.Now(), Type: oidc.Subtype.String(), - Attributes: createAttr(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, }, }, res: nil, @@ -578,7 +598,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), UpdatedTime: timestamppb.Now(), Type: oidc.Subtype.String(), - Attributes: createAttr(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + }, }, }, res: nil, @@ -591,11 +615,11 @@ func TestCreateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), UpdatedTime: timestamppb.Now(), Type: oidc.Subtype.String(), - Attributes: func() *structpb.Struct { - a := createAttr() - a.Fields["filter"] = structpb.NewStringValue("foobar") - return a - }(), + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: "foobar", + }, + }, }, }, res: nil, @@ -653,19 +677,23 @@ func TestUpdateOidc(t *testing.T) { require.NoError(t, err, "Error when getting new managed_groups service.") defaultScopeInfo := &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: o.GetType(), ParentScopeId: scope.Global.String()} - defaultAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(oidc.TestFakeManagedGroupFilter), - }} + defaultAttributes := &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: oidc.TestFakeManagedGroupFilter, + }, + } - modifiedFilter := `"/token/zip" == "zap"` - modifiedAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(modifiedFilter), - }} + modifiedAttributes := &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: `"/token/zip" == "zap"`, + }, + } - badFilter := `"foobar"` - badAttributes := &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(badFilter), - }} + badAttributes := &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: `"foobar"`, + }, + } freshManagedGroup := func(t *testing.T) (*oidc.ManagedGroup, func()) { t.Helper() @@ -704,7 +732,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -728,7 +756,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "new"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -740,7 +768,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.ManagedGroup{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -765,19 +793,19 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.ManagedGroup{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, { - name: "Only non-existant paths in Mask", + name: "Only non-existent paths in Mask", req: &pbs.UpdateManagedGroupRequest{ UpdateMask: &field_mask.FieldMask{Paths: []string{"nonexistant_field"}}, Item: &pb.ManagedGroup{ Name: &wrapperspb.StringValue{Value: "updated name"}, Description: &wrapperspb.StringValue{Value: "updated desc"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -790,7 +818,7 @@ func TestUpdateOidc(t *testing.T) { }, Item: &pb.ManagedGroup{ Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateManagedGroupResponse{ @@ -798,7 +826,7 @@ func TestUpdateOidc(t *testing.T) { AuthMethodId: am.GetPublicId(), Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -813,7 +841,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.ManagedGroup{ Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "ignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateManagedGroupResponse{ @@ -822,7 +850,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "updated"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -837,7 +865,7 @@ func TestUpdateOidc(t *testing.T) { Item: &pb.ManagedGroup{ Name: &wrapperspb.StringValue{Value: "ignored"}, Description: &wrapperspb.StringValue{Value: "notignored"}, - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateManagedGroupResponse{ @@ -846,7 +874,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "notignored"}, Type: oidc.Subtype.String(), - Attributes: defaultAttributes, + Attrs: defaultAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -927,7 +955,7 @@ func TestUpdateOidc(t *testing.T) { Paths: []string{"attributes.filter"}, }, Item: &pb.ManagedGroup{ - Attributes: badAttributes, + Attrs: badAttributes, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -939,7 +967,7 @@ func TestUpdateOidc(t *testing.T) { Paths: []string{"attributes.filter"}, }, Item: &pb.ManagedGroup{ - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, }, }, res: &pbs.UpdateManagedGroupResponse{ @@ -948,7 +976,7 @@ func TestUpdateOidc(t *testing.T) { Name: &wrapperspb.StringValue{Value: "default"}, Description: &wrapperspb.StringValue{Value: "default"}, Type: oidc.Subtype.String(), - Attributes: modifiedAttributes, + Attrs: modifiedAttributes, Scope: defaultScopeInfo, AuthorizedActions: oidcAuthorizedActions, }, @@ -976,6 +1004,8 @@ func TestUpdateOidc(t *testing.T) { if tc.err != nil { require.Error(gErr) assert.True(errors.Is(gErr, tc.err), "UpdateManagedGroup(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) + } else { + require.NoError(gErr) } if tc.res == nil { diff --git a/internal/servers/controller/handlers/managed_groups/validate_test.go b/internal/servers/controller/handlers/managed_groups/validate_test.go index 2baef9c73..5590fb681 100644 --- a/internal/servers/controller/handlers/managed_groups/validate_test.go +++ b/internal/servers/controller/handlers/managed_groups/validate_test.go @@ -14,7 +14,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" - "google.golang.org/protobuf/types/known/structpb" ) func fieldError(field, details string) string { @@ -48,7 +47,7 @@ func TestValidateCreateRequest(t *testing.T) { item: &pb.ManagedGroup{ Type: oidc.Subtype.String(), AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{}}, + Attrs: nil, }, errContains: fieldError(attrFilterField, "This field is required."), }, @@ -57,9 +56,11 @@ func TestValidateCreateRequest(t *testing.T) { item: &pb.ManagedGroup{ Type: oidc.Subtype.String(), AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue("foobar"), - }}, + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: "foobar", + }, + }, }, errContains: "Error evaluating submitted filter", }, @@ -68,9 +69,11 @@ func TestValidateCreateRequest(t *testing.T) { item: &pb.ManagedGroup{ Type: oidc.Subtype.String(), AuthMethodId: oidc.AuthMethodPrefix + "_1234567890", - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(`"/foo/bar" == "zipzap"`), - }}, + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: `"/foo/bar" == "zipzap"`, + }, + }, }, }, } @@ -106,18 +109,6 @@ func TestValidateUpdateRequest(t *testing.T) { }, errContains: fieldError(globals.TypeField, "Cannot modify the resource type."), }, - { - name: "oidc bad attributes", - req: &pbs.UpdateManagedGroupRequest{ - Id: intglobals.OidcManagedGroupPrefix + "_1234567890", - Item: &pb.ManagedGroup{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "test": structpb.NewStringValue("something"), - }}, - }, - }, - errContains: fieldError(globals.AttributesField, "Attribute fields do not match the expected format."), - }, { name: "no error", req: &pbs.UpdateManagedGroupRequest{ @@ -125,9 +116,11 @@ func TestValidateUpdateRequest(t *testing.T) { UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{}}, Item: &pb.ManagedGroup{ Version: 1, - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "filter": structpb.NewStringValue(`"/foo/bar" == "zipzap"`), - }}, + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: `"/foo/bar" == "zipzap"`, + }, + }, }, }, }, diff --git a/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go b/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go index 045d0038e..54374af72 100644 --- a/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go +++ b/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go @@ -9,6 +9,7 @@ package managedgroups import ( 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" @@ -50,8 +51,10 @@ type ManagedGroup struct { Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"` // The ID of the Auth Method that is associated with this ManagedGroup. AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` - // The attributes that are applicable for the specific ManagedGroup type. - Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *ManagedGroup_Attributes + // *ManagedGroup_OidcManagedGroupAttributes + Attrs isManagedGroup_Attrs `protobuf_oneof:"attrs"` // Output only. The IDs of the current set of members (accounts) that are associated with this ManagedGroup. MemberIds []string `protobuf:"bytes,110,rep,name=member_ids,proto3" json:"member_ids,omitempty"` // Output only. The available actions on this resource for this user. @@ -153,13 +156,27 @@ func (x *ManagedGroup) GetAuthMethodId() string { return "" } +func (m *ManagedGroup) GetAttrs() isManagedGroup_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *ManagedGroup) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*ManagedGroup_Attributes); ok { return x.Attributes } return nil } +func (x *ManagedGroup) GetOidcManagedGroupAttributes() *OidcManagedGroupAttributes { + if x, ok := x.GetAttrs().(*ManagedGroup_OidcManagedGroupAttributes); ok { + return x.OidcManagedGroupAttributes + } + return nil +} + func (x *ManagedGroup) GetMemberIds() []string { if x != nil { return x.MemberIds @@ -174,6 +191,23 @@ func (x *ManagedGroup) GetAuthorizedActions() []string { return nil } +type isManagedGroup_Attrs interface { + isManagedGroup_Attrs() +} + +type ManagedGroup_Attributes struct { + // The attributes that are applicable for the specific ManagedGroup type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3,oneof"` +} + +type ManagedGroup_OidcManagedGroupAttributes struct { + OidcManagedGroupAttributes *OidcManagedGroupAttributes `protobuf:"bytes,101,opt,name=oidc_managed_group_attributes,json=oidcManagedGroupAttributes,proto3,oneof"` +} + +func (*ManagedGroup_Attributes) isManagedGroup_Attrs() {} + +func (*ManagedGroup_OidcManagedGroupAttributes) isManagedGroup_Attrs() {} + // Attributes associated only with ManagedGroups with type "oidc". type OidcManagedGroupAttributes struct { state protoimpl.MessageState @@ -238,64 +272,78 @@ var file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc = 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, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf5, 0x04, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, - 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x1e, 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, 0x4e, 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, 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, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x44, - 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, 0x32, 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, 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, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, - 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x3d, 0x0a, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, - 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x12, + 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 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, 0xb6, 0x06, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x1e, 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, 0x4e, 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, + 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, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x44, 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, 0x32, 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, 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, + 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0xa8, 0x01, 0x0a, 0x1d, 0x6f, 0x69, 0x64, 0x63, 0x5f, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, + 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x4d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1c, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x04, 0x6f, + 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x1a, 0x6f, 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, + 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 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, 0x59, 0x0a, - 0x1a, 0x4f, 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x66, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x23, 0xa0, 0xda, 0x29, - 0x01, 0xc2, 0xdd, 0x29, 0x1b, 0x0a, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x5c, 0x5a, 0x5a, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x59, 0x0a, 0x1a, 0x4f, + 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x23, 0xa0, 0xda, 0x29, 0x01, 0xc2, + 0xdd, 0x29, 0x1b, 0x0a, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, + 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x5c, 0x5a, 0x5a, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -326,11 +374,12 @@ var file_controller_api_resources_managedgroups_v1_managed_group_proto_depIdxs = 4, // 3: controller.api.resources.managedgroups.v1.ManagedGroup.created_time:type_name -> google.protobuf.Timestamp 4, // 4: controller.api.resources.managedgroups.v1.ManagedGroup.updated_time:type_name -> google.protobuf.Timestamp 5, // 5: controller.api.resources.managedgroups.v1.ManagedGroup.attributes:type_name -> google.protobuf.Struct - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 1, // 6: controller.api.resources.managedgroups.v1.ManagedGroup.oidc_managed_group_attributes:type_name -> controller.api.resources.managedgroups.v1.OidcManagedGroupAttributes + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_controller_api_resources_managedgroups_v1_managed_group_proto_init() } @@ -364,6 +413,10 @@ func file_controller_api_resources_managedgroups_v1_managed_group_proto_init() { } } } + file_controller_api_resources_managedgroups_v1_managed_group_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*ManagedGroup_Attributes)(nil), + (*ManagedGroup_OidcManagedGroupAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ From e2eca03d26023f58cec9d32780b28d5e180b67ac Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 12 Apr 2022 16:09:40 -0400 Subject: [PATCH 32/45] feat(managedgroups): Classify resources for audit events --- Makefile | 2 + .../api/services/managed_group_service.pb.go | 12 +- .../managedgroups/v1/managed_group.proto | 22 ++-- .../services/v1/managed_group_service.proto | 12 +- .../managed_groups/managed_group_service.go | 28 ++--- .../api/managedgroups/classification_test.go | 107 ++++++++++++++++++ .../managedgroups/managed_group.pb.go | 97 ++++++++-------- 7 files changed, 196 insertions(+), 84 deletions(-) create mode 100644 internal/tests/api/managedgroups/classification_test.go diff --git a/Makefile b/Makefile index eea8ce25a..8bb69acad 100644 --- a/Makefile +++ b/Makefile @@ -167,6 +167,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/host_set_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/authtokens/authtoken.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/authtokens_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/managed_group_service.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/managed_group_service.pb.go b/internal/gen/controller/api/services/managed_group_service.pb.go index 0ddbccf1e..dbce75ea4 100644 --- a/internal/gen/controller/api/services/managed_group_service.pb.go +++ b/internal/gen/controller/api/services/managed_group_service.pb.go @@ -30,7 +30,7 @@ type GetManagedGroupRequest 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 *GetManagedGroupRequest) Reset() { @@ -124,8 +124,8 @@ type ListManagedGroupsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AuthMethodId string `protobuf:"bytes,1,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + AuthMethodId string `protobuf:"bytes,1,opt,name=auth_method_id,proto3" json:"auth_method_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 *ListManagedGroupsRequest) Reset() { @@ -273,7 +273,7 @@ type CreateManagedGroupResponse 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 *managedgroups.ManagedGroup `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -328,7 +328,7 @@ type UpdateManagedGroupRequest 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 *managedgroups.ManagedGroup `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"` } @@ -438,7 +438,7 @@ type DeleteManagedGroupRequest 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 *DeleteManagedGroupRequest) Reset() { diff --git a/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto b/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto index 80f09fdca..874c185d6 100644 --- a/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto +++ b/internal/proto/controller/api/resources/managedgroups/v1/managed_group.proto @@ -14,32 +14,32 @@ import "controller/custom_options/v1/options.proto"; // ManagedGroup contains all fields related to an ManagedGroup resource message ManagedGroup { // Output only. The ID of the ManagedGroup. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. Scope information for the ManagedGroup. resources.scopes.v1.ScopeInfo scope = 20; // Optional name for identification purposes. - google.protobuf.StringValue name = 30 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "Name"}]; + google.protobuf.StringValue name = 30 [(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 = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "Description"}]; + google.protobuf.StringValue description = 40 [(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 = 50 [json_name="created_time"]; + google.protobuf.Timestamp created_time = 50 [json_name="created_time"]; // @gotags: `class:"public"` // Output only. The time this resource was last updated. - google.protobuf.Timestamp updated_time = 60 [json_name="updated_time"]; + google.protobuf.Timestamp updated_time = 60 [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 = 70; + uint32 version = 70; // @gotags: `class:"public"` // The type of this ManagedGroup. - string type = 80; + string type = 80; // @gotags: `class:"public"` // The ID of the Auth Method that is associated with this ManagedGroup. - string auth_method_id = 90 [json_name="auth_method_id"]; + string auth_method_id = 90 [json_name="auth_method_id", (custom_options.v1.subtype_source_id) = true]; // @gotags: `class:"public"` oneof attrs { // The attributes that are applicable for the specific ManagedGroup type. @@ -55,14 +55,14 @@ message ManagedGroup { } // Output only. The IDs of the current set of members (accounts) that are associated with this ManagedGroup. - repeated string member_ids = 110 [json_name="member_ids"]; + repeated string member_ids = 110 [json_name="member_ids"]; // @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"` } // Attributes associated only with ManagedGroups with type "oidc". message OidcManagedGroupAttributes { // The boolean expression filter to use to determine membership. - string filter = 10 [json_name="filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.filter" that: "Filter"}]; + string filter = 10 [json_name="filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.filter" that: "Filter"}]; // @gotags: `class:"public"` } diff --git a/internal/proto/controller/api/services/v1/managed_group_service.proto b/internal/proto/controller/api/services/v1/managed_group_service.proto index 3dd1091e0..110bf0ed9 100644 --- a/internal/proto/controller/api/services/v1/managed_group_service.proto +++ b/internal/proto/controller/api/services/v1/managed_group_service.proto @@ -89,7 +89,7 @@ service ManagedGroupService { } message GetManagedGroupRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetManagedGroupResponse { @@ -97,8 +97,8 @@ message GetManagedGroupResponse { } message ListManagedGroupsRequest { - string auth_method_id = 1 [json_name="auth_method_id"]; - string filter = 30 [json_name="filter"]; + string auth_method_id = 1 [json_name="auth_method_id"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListManagedGroupsResponse { @@ -110,12 +110,12 @@ message CreateManagedGroupRequest { } message CreateManagedGroupResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.managedgroups.v1.ManagedGroup item = 2; } message UpdateManagedGroupRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.managedgroups.v1.ManagedGroup item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -125,7 +125,7 @@ message UpdateManagedGroupResponse { } message DeleteManagedGroupRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteManagedGroupResponse {} diff --git a/internal/servers/controller/handlers/managed_groups/managed_group_service.go b/internal/servers/controller/handlers/managed_groups/managed_group_service.go index 398fbd0c2..1c5ecd3f4 100644 --- a/internal/servers/controller/handlers/managed_groups/managed_group_service.go +++ b/internal/servers/controller/handlers/managed_groups/managed_group_service.go @@ -28,6 +28,8 @@ import ( const ( // oidc field names attrFilterField = "attributes.filter" + + domain = "auth" ) var ( @@ -107,7 +109,7 @@ func (s Service) ListManagedGroups(ctx context.Context, req *pbs.ListManagedGrou } for _, mg := range ul { res.Id = mg.GetPublicId() - authorizedActions := authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())], requestauth.WithResource(&res)).Strings() + authorizedActions := authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, mg.GetPublicId())], requestauth.WithResource(&res)).Strings() if len(authorizedActions) == 0 { continue } @@ -168,7 +170,7 @@ func (s Service) GetManagedGroup(ctx context.Context, req *pbs.GetManagedGroupRe outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, mg.GetPublicId())]).Strings())) } if outputFields.Has(globals.MemberIdsField) { outputOpts = append(outputOpts, handlers.WithMemberIds(memberIds)) @@ -210,7 +212,7 @@ func (s Service) CreateManagedGroup(ctx context.Context, req *pbs.CreateManagedG outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, mg.GetPublicId())]).Strings())) } item, err := toProto(ctx, mg, outputOpts...) @@ -249,7 +251,7 @@ func (s Service) UpdateManagedGroup(ctx context.Context, req *pbs.UpdateManagedG outputOpts = append(outputOpts, handlers.WithScope(authResults.Scope)) } if outputFields.Has(globals.AuthorizedActionsField) { - outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId("auth", mg.GetPublicId())]).Strings())) + outputOpts = append(outputOpts, handlers.WithAuthorizedActions(authResults.FetchActionSetForId(ctx, mg.GetPublicId(), IdActions[subtypes.SubtypeFromId(domain, mg.GetPublicId())]).Strings())) } item, err := toProto(ctx, mg, outputOpts...) @@ -279,7 +281,7 @@ func (s Service) DeleteManagedGroup(ctx context.Context, req *pbs.DeleteManagedG func (s Service) getFromRepo(ctx context.Context, id string) (auth.ManagedGroup, []string, error) { var out auth.ManagedGroup var memberIds []string - switch subtypes.SubtypeFromId("auth", id) { + switch subtypes.SubtypeFromId(domain, id) { case oidc.Subtype: repo, err := s.oidcRepoFn() if err != nil { @@ -347,7 +349,7 @@ func (s Service) createInRepo(ctx context.Context, am auth.AuthMethod, item *pb. return nil, errors.New(ctx, errors.InvalidParameter, op, "missing item") } var out auth.ManagedGroup - switch subtypes.SubtypeFromId("auth", am.GetPublicId()) { + switch subtypes.SubtypeFromId(domain, am.GetPublicId()) { case oidc.Subtype: am, err := s.createOidcInRepo(ctx, am, item) if err != nil { @@ -400,7 +402,7 @@ func (s Service) updateOidcInRepo(ctx context.Context, scopeId, amId, id string, func (s Service) updateInRepo(ctx context.Context, scopeId, authMethodId string, req *pbs.UpdateManagedGroupRequest) (auth.ManagedGroup, error) { const op = "managed_groups.(Service).updateInRepo" var out auth.ManagedGroup - switch subtypes.SubtypeFromId("auth", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case oidc.Subtype: mg, err := s.updateOidcInRepo(ctx, scopeId, authMethodId, req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem()) if err != nil { @@ -418,7 +420,7 @@ func (s Service) deleteFromRepo(ctx context.Context, scopeId, id string) (bool, const op = "managed_groups.(Service).deleteFromRepo" var rows int var err error - switch subtypes.SubtypeFromId("auth", id) { + switch subtypes.SubtypeFromId(domain, id) { case oidc.Subtype: repo, iErr := s.oidcRepoFn() if iErr != nil { @@ -439,7 +441,7 @@ func (s Service) listFromRepo(ctx context.Context, authMethodId string) ([]auth. const op = "managed_groups.(Service).listFromRepo" var outUl []auth.ManagedGroup - switch subtypes.SubtypeFromId("auth", authMethodId) { + switch subtypes.SubtypeFromId(domain, authMethodId) { case oidc.Subtype: oidcRepo, err := s.oidcRepoFn() if err != nil { @@ -471,7 +473,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty case action.List, action.Create: parentId = id default: - switch subtypes.SubtypeFromId("auth", id) { + switch subtypes.SubtypeFromId(domain, id) { case oidc.Subtype: acct, err := oidcRepo.LookupManagedGroup(ctx, id) if err != nil { @@ -491,7 +493,7 @@ func (s Service) parentAndAuthResult(ctx context.Context, id string, a action.Ty } var authMeth auth.AuthMethod - switch subtypes.SubtypeFromId("auth", parentId) { + switch subtypes.SubtypeFromId(domain, parentId) { case oidc.Subtype: am, err := oidcRepo.LookupAuthMethod(ctx, parentId) if err != nil { @@ -591,7 +593,7 @@ func validateCreateRequest(req *pbs.CreateManagedGroupRequest) error { if req.GetItem().GetAuthMethodId() == "" { badFields[globals.AuthMethodIdField] = "This field is required." } - switch subtypes.SubtypeFromId("auth", req.GetItem().GetAuthMethodId()) { + switch subtypes.SubtypeFromId(domain, req.GetItem().GetAuthMethodId()) { case oidc.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[globals.TypeField] = "Doesn't match the parent resource's type." @@ -621,7 +623,7 @@ func validateUpdateRequest(req *pbs.UpdateManagedGroupRequest) error { } return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch subtypes.SubtypeFromId("auth", req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case oidc.Subtype: if req.GetItem().GetType() != "" && req.GetItem().GetType() != oidc.Subtype.String() { badFields[globals.TypeField] = "Cannot modify the resource type." diff --git a/internal/tests/api/managedgroups/classification_test.go b/internal/tests/api/managedgroups/classification_test.go new file mode 100644 index 000000000..ff9a624a1 --- /dev/null +++ b/internal/tests/api/managedgroups/classification_test.go @@ -0,0 +1,107 @@ +package managedgroups_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/managedgroups" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + "github.com/hashicorp/boundary/sdk/wrapper" + "github.com/hashicorp/eventlogger" + "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 TestGroupsClassification(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + cases := []struct { + name string + in *eventlogger.Event + want *eventlogger.Event + }{ + { + name: "validate-group-filtering", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.ManagedGroup{ + Id: "id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "descrption"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + Type: "oidc", + AuthMethodId: "auth-method-id", + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: "filter", + }, + }, + MemberIds: []string{"member-id-1", "member-id-2"}, + AuthorizedActions: []string{"action1", "action2"}, + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.ManagedGroup{ + Id: "id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "descrption"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + Type: "oidc", + AuthMethodId: "auth-method-id", + Attrs: &pb.ManagedGroup_OidcManagedGroupAttributes{ + OidcManagedGroupAttributes: &pb.OidcManagedGroupAttributes{ + Filter: "filter", + }, + }, + MemberIds: []string{"member-id-1", "member-id-2"}, + AuthorizedActions: []string{"action1", "action2"}, + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + got, err := testEncryptingFilter.Process(ctx, tc.in) + require.NoError(err) + require.NotNil(got) + gotJSON, err := json.Marshal(got) + require.NoError(err) + + wantJSON, err := json.Marshal(tc.want) + require.NoError(err) + assert.JSONEq(string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go b/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go index 54374af72..bc1ce8bc3 100644 --- a/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go +++ b/sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go @@ -33,32 +33,32 @@ type ManagedGroup struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the ManagedGroup. - 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"` // Output only. Scope information for the ManagedGroup. Scope *scopes.ScopeInfo `protobuf:"bytes,20,opt,name=scope,proto3" json:"scope,omitempty"` // Optional name for identification purposes. - Name *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty"` + Name *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // Optional user-set description for identification purposes. - Description *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=description,proto3" json:"description,omitempty"` + Description *wrapperspb.StringValue `protobuf:"bytes,40,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,50,opt,name=created_time,proto3" json:"created_time,omitempty"` + CreatedTime *timestamppb.Timestamp `protobuf:"bytes,50,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,60,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,60,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,70,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // The type of this ManagedGroup. - Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // The ID of the Auth Method that is associated with this ManagedGroup. - AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` + AuthMethodId string `protobuf:"bytes,90,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: // *ManagedGroup_Attributes // *ManagedGroup_OidcManagedGroupAttributes Attrs isManagedGroup_Attrs `protobuf_oneof:"attrs"` // Output only. The IDs of the current set of members (accounts) that are associated with this ManagedGroup. - MemberIds []string `protobuf:"bytes,110,rep,name=member_ids,proto3" json:"member_ids,omitempty"` + MemberIds []string `protobuf:"bytes,110,rep,name=member_ids,proto3" json:"member_ids,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 *ManagedGroup) Reset() { @@ -215,7 +215,7 @@ type OidcManagedGroupAttributes struct { unknownFields protoimpl.UnknownFields // The boolean expression filter to use to determine membership. - Filter string `protobuf:"bytes,10,opt,name=filter,proto3" json:"filter,omitempty"` + Filter string `protobuf:"bytes,10,opt,name=filter,proto3" json:"filter,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *OidcManagedGroupAttributes) Reset() { @@ -280,7 +280,7 @@ var file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc = 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, 0xb6, 0x06, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, + 0x74, 0x6f, 0x22, 0xbc, 0x06, 0x0a, 0x0c, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, @@ -308,42 +308,43 @@ var file_controller_api_resources_managedgroups_v1_managed_group_proto_rawDesc = 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, - 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0xa8, 0x01, 0x0a, 0x1d, 0x6f, 0x69, 0x64, 0x63, 0x5f, - 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, - 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x4d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1c, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x04, 0x6f, - 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, - 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x1a, 0x6f, 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, - 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, 0x59, 0x0a, 0x1a, 0x4f, - 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x23, 0xa0, 0xda, 0x29, 0x01, 0xc2, - 0xdd, 0x29, 0x1b, 0x0a, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, - 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x5c, 0x5a, 0x5a, 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, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, - 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x5f, 0x69, 0x64, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xe3, 0x29, 0x01, + 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, + 0x12, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0xa8, 0x01, 0x0a, + 0x1d, 0x6f, 0x69, 0x64, 0x63, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, 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, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x4f, 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1c, 0xa0, 0xda, 0x29, + 0x01, 0x9a, 0xe3, 0x29, 0x04, 0x6f, 0x69, 0x64, 0x63, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, + 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x1a, 0x6f, 0x69, 0x64, + 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x65, 0x6d, 0x62, 0x65, + 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, + 0x73, 0x22, 0x59, 0x0a, 0x1a, 0x4f, 0x69, 0x64, 0x63, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, + 0x3b, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x23, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1b, 0x0a, 0x11, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x06, 0x46, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x42, 0x5c, 0x5a, 0x5a, + 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, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x3b, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x64, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( From 95315a3e0ac18096caf933e3c2339bb7bb08927c Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 8 Apr 2022 13:39:06 -0400 Subject: [PATCH 33/45] feat(groups): Classify resources for audit events --- Makefile | 2 + .../api/services/group_service.pb.go | 32 ++--- .../api/resources/groups/v1/group.proto | 22 ++-- .../api/services/v1/group_service.proto | 32 ++--- .../tests/api/groups/classification_test.go | 113 ++++++++++++++++++ .../api/resources/groups/group.pb.go | 22 ++-- 6 files changed, 169 insertions(+), 54 deletions(-) create mode 100644 internal/tests/api/groups/classification_test.go diff --git a/Makefile b/Makefile index 8bb69acad..1b92557d7 100644 --- a/Makefile +++ b/Makefile @@ -169,6 +169,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/authtokens_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/managedgroups/managed_group.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/managed_group_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/groups/group.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/group_service.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/group_service.pb.go b/internal/gen/controller/api/services/group_service.pb.go index 2967b7dec..8ae4170c1 100644 --- a/internal/gen/controller/api/services/group_service.pb.go +++ b/internal/gen/controller/api/services/group_service.pb.go @@ -29,7 +29,7 @@ type GetGroupRequest 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 *GetGroupRequest) Reset() { @@ -123,9 +123,9 @@ type ListGroupsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListGroupsRequest) Reset() { @@ -280,7 +280,7 @@ type CreateGroupResponse 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 *groups.Group `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -335,7 +335,7 @@ type UpdateGroupRequest 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 *groups.Group `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"` } @@ -445,7 +445,7 @@ type DeleteGroupRequest 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 *DeleteGroupRequest) Reset() { @@ -530,11 +530,11 @@ type AddGroupMembersRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - MemberIds []string `protobuf:"bytes,3,rep,name=member_ids,proto3" json:"member_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + MemberIds []string `protobuf:"bytes,3,rep,name=member_ids,proto3" json:"member_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddGroupMembersRequest) Reset() { @@ -642,11 +642,11 @@ type SetGroupMembersRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - MemberIds []string `protobuf:"bytes,3,rep,name=member_ids,proto3" json:"member_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + MemberIds []string `protobuf:"bytes,3,rep,name=member_ids,proto3" json:"member_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetGroupMembersRequest) Reset() { @@ -754,11 +754,11 @@ type RemoveGroupMembersRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - MemberIds []string `protobuf:"bytes,3,rep,name=member_ids,proto3" json:"member_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + MemberIds []string `protobuf:"bytes,3,rep,name=member_ids,proto3" json:"member_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveGroupMembersRequest) Reset() { diff --git a/internal/proto/controller/api/resources/groups/v1/group.proto b/internal/proto/controller/api/resources/groups/v1/group.proto index dbedd7ad7..4dddd5313 100644 --- a/internal/proto/controller/api/resources/groups/v1/group.proto +++ b/internal/proto/controller/api/resources/groups/v1/group.proto @@ -11,45 +11,45 @@ import "controller/custom_options/v1/options.proto"; message Member { // Output only. The ID of the member. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The Scope ID of the member. - string scope_id = 20 [json_name="scope_id"]; + string scope_id = 20 [json_name="scope_id"]; // @gotags: `class:"public"` } // Group contains all fields related to a Group resource message Group { // Output only. The ID of the Group. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The ID of the scope of which this Group is a part. - string scope_id = 20 [json_name="scope_id"]; + string scope_id = 20 [json_name="scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this Group. resources.scopes.v1.ScopeInfo scope = 30; // 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 descripton 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"` // Output only. Contains the list of member IDs in this Group. - repeated string member_ids = 90 [json_name="member_ids"]; + repeated string member_ids = 90 [json_name="member_ids"]; // @gotags: `class:"public"` // Output only. The members of this Group. repeated Member members = 100; // 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"` } diff --git a/internal/proto/controller/api/services/v1/group_service.proto b/internal/proto/controller/api/services/v1/group_service.proto index 290dc60f2..c75bcb067 100644 --- a/internal/proto/controller/api/services/v1/group_service.proto +++ b/internal/proto/controller/api/services/v1/group_service.proto @@ -131,7 +131,7 @@ service GroupService { } message GetGroupRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetGroupResponse { @@ -139,9 +139,9 @@ message GetGroupResponse { } message ListGroupsRequest { - string scope_id = 1 [json_name="scope_id"]; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1 [json_name="scope_id"]; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListGroupsResponse { @@ -153,12 +153,12 @@ message CreateGroupRequest { } message CreateGroupResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.groups.v1.Group item = 2; } message UpdateGroupRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.groups.v1.Group item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -168,17 +168,17 @@ message UpdateGroupResponse { } message DeleteGroupRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteGroupResponse {} message AddGroupMembersRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string member_ids = 3 [json_name="member_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string member_ids = 3 [json_name="member_ids"]; // @gotags: `class:"public"` } message AddGroupMembersResponse { @@ -186,11 +186,11 @@ message AddGroupMembersResponse { } message SetGroupMembersRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string member_ids = 3 [json_name="member_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string member_ids = 3 [json_name="member_ids"]; // @gotags: `class:"public"` } message SetGroupMembersResponse { @@ -198,11 +198,11 @@ message SetGroupMembersResponse { } message RemoveGroupMembersRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string member_ids = 3 [json_name="member_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string member_ids = 3 [json_name="member_ids"]; // @gotags: `class:"public"` } message RemoveGroupMembersResponse { diff --git a/internal/tests/api/groups/classification_test.go b/internal/tests/api/groups/classification_test.go new file mode 100644 index 000000000..f705f0bb8 --- /dev/null +++ b/internal/tests/api/groups/classification_test.go @@ -0,0 +1,113 @@ +package groups_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/groups" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + "github.com/hashicorp/boundary/sdk/wrapper" + "github.com/hashicorp/eventlogger" + "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 TestGroupsClassification(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + cases := []struct { + name string + in *eventlogger.Event + want *eventlogger.Event + }{ + { + name: "validate-group-filtering", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Group{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "id", + Type: "type", + Name: "name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + MemberIds: []string{"member-id"}, + Members: []*pb.Member{ + { + Id: "member-id", + ScopeId: "scope-id", + }, + }, + AuthorizedActions: []string{ + "action-1", + "action-2", + }, + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Group{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "id", + Type: "type", + Name: "name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + MemberIds: []string{"member-id"}, + Members: []*pb.Member{ + { + Id: "member-id", + ScopeId: "scope-id", + }, + }, + AuthorizedActions: []string{ + "action-1", + "action-2", + }, + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + assert, require := assert.New(t), require.New(t) + got, err := testEncryptingFilter.Process(ctx, tc.in) + require.NoError(err) + require.NotNil(got) + gotJSON, err := json.Marshal(got) + require.NoError(err) + + wantJSON, err := json.Marshal(tc.want) + require.NoError(err) + assert.JSONEq(string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/groups/group.pb.go b/sdk/pbs/controller/api/resources/groups/group.pb.go index 0b1510df3..4ff81e1a7 100644 --- a/sdk/pbs/controller/api/resources/groups/group.pb.go +++ b/sdk/pbs/controller/api/resources/groups/group.pb.go @@ -30,9 +30,9 @@ type Member struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the member. - 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"` // Output only. The Scope ID of the member. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *Member) Reset() { @@ -88,28 +88,28 @@ type Group struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Group. - 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 ID of the scope of which this Group is a part. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. Scope information for this Group. Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,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 descripton 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"` // Output only. Contains the list of member IDs in this Group. - MemberIds []string `protobuf:"bytes,90,rep,name=member_ids,proto3" json:"member_ids,omitempty"` + MemberIds []string `protobuf:"bytes,90,rep,name=member_ids,proto3" json:"member_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The members of this Group. Members []*Member `protobuf:"bytes,100,rep,name=members,proto3" json:"members,omitempty"` // 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 *Group) Reset() { From 3d4ba0389e2c1e5286494817fea6a4daf022c05f Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Wed, 6 Apr 2022 15:29:00 -0400 Subject: [PATCH 34/45] refact(credentiallibrary): Switch subtype attributes to oneof This updates the credential library resources to use a oneof for attributes. This allows requests to the credential library service to leverage the new subtypes.AttributeTransformerInterceptor so that attributes are strongly typed prior to the service handler. --- internal/credential/credential.go | 3 + internal/credential/subtype.go | 26 -- internal/credential/vault/public_ids.go | 2 +- .../services/credential_library_service.pb.go | 253 ++++++------ .../v1/credential_library.proto | 22 +- .../v1/credential_library_service.proto | 3 + .../credentiallibrary_service.go | 64 ++- .../credentiallibrary_service_test.go | 369 ++++++++---------- .../credentialstore_service.go | 12 +- .../handlers/targets/target_service.go | 8 +- .../targets/tcp/target_service_test.go | 64 +-- .../credential_library.pb.go | 245 +++++++----- 12 files changed, 542 insertions(+), 529 deletions(-) delete mode 100644 internal/credential/subtype.go diff --git a/internal/credential/credential.go b/internal/credential/credential.go index 7c1cc07b3..fbb8d2afb 100644 --- a/internal/credential/credential.go +++ b/internal/credential/credential.go @@ -8,6 +8,9 @@ import ( "github.com/hashicorp/boundary/internal/boundary" ) +// Domain defines the domain for the credential package. +const Domain = "credential" + // A Store is a resource that can store, retrieve, and potentially generate // credentials of differing types and access levels. It belongs to a scope // and must support the principle of least privilege by providing diff --git a/internal/credential/subtype.go b/internal/credential/subtype.go deleted file mode 100644 index ca1aedcf5..000000000 --- a/internal/credential/subtype.go +++ /dev/null @@ -1,26 +0,0 @@ -package credential - -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/credential/vault/public_ids.go b/internal/credential/vault/public_ids.go index fc896b4a5..4cbec8374 100644 --- a/internal/credential/vault/public_ids.go +++ b/internal/credential/vault/public_ids.go @@ -8,7 +8,7 @@ import ( ) func init() { - if err := credential.Register(Subtype, CredentialStorePrefix, CredentialLibraryPrefix, DynamicCredentialPrefix); err != nil { + if err := subtypes.Register(credential.Domain, Subtype, CredentialStorePrefix, CredentialLibraryPrefix, DynamicCredentialPrefix); err != nil { panic(err) } } diff --git a/internal/gen/controller/api/services/credential_library_service.pb.go b/internal/gen/controller/api/services/credential_library_service.pb.go index 62b125c39..e181dd774 100644 --- a/internal/gen/controller/api/services/credential_library_service.pb.go +++ b/internal/gen/controller/api/services/credential_library_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" credentiallibraries "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/credentiallibraries" + _ "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" @@ -537,151 +538,155 @@ var file_controller_api_services_v1_credential_library_service_proto_rawDesc = [ 0x63, 0x65, 0x73, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x22, 0x76, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 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, + 0x2d, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x76, + 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, + 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5f, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x13, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 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, 0x7b, 0x0a, 0x1f, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x69, 0x74, + 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x22, 0x78, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 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, + 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x8b, + 0x01, 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, - 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x5f, 0x0a, 0x1e, 0x4c, 0x69, - 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, - 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x13, - 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, - 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, 0x7b, 0x0a, 0x1f, 0x4c, - 0x69, 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, - 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, - 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, + 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x75, 0x72, 0x69, 0x12, 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xc6, 0x01, 0x0a, + 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x78, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, - 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x56, 0x0a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, - 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x8b, 0x01, 0x0a, 0x1f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 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, 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x79, 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, 0x79, 0x0a, 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x22, 0xc6, 0x01, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x56, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, - 0x62, 0x72, 0x61, 0x72, 0x79, 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, 0x79, 0x0a, 0x1f, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, - 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x22, 0x30, 0x0a, 0x1e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x21, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x85, 0x09, 0x0a, 0x18, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xdc, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, - 0x37, 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, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x51, 0x92, 0x41, 0x23, 0x12, 0x21, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, - 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, - 0x12, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xd6, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, - 0x73, 0x12, 0x3a, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, - 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, + 0x22, 0x30, 0x0a, 0x1e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x21, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x85, 0x09, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0xdc, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x37, 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, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x51, + 0x92, 0x41, 0x23, 0x12, 0x21, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x4c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x1d, 0x2f, 0x76, + 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x12, 0xd6, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3a, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, - 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x92, 0x41, 0x1f, 0x12, - 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0xe9, - 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x3a, 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, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x55, 0x92, 0x41, 0x26, 0x12, 0x24, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x26, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xe7, 0x01, 0x0a, 0x17, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 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, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x42, 0x92, 0x41, 0x1f, 0x12, 0x1d, 0x4c, 0x69, 0x73, + 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, + 0x12, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0xe9, 0x01, 0x0a, 0x17, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x3a, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x53, 0x92, 0x41, 0x1f, 0x12, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, - 0x72, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x32, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x12, 0xda, 0x01, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, - 0x12, 0x3a, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, - 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x63, + 0x55, 0x92, 0x41, 0x26, 0x12, 0x24, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, + 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, + 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xe7, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x12, 0x3a, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, + 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x53, 0x92, 0x41, 0x1f, + 0x12, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x32, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x12, 0xda, 0x01, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x3a, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x1e, 0x12, 0x1c, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x1f, 0x2a, 0x1d, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 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, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 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, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x46, 0x92, 0x41, 0x1e, 0x12, 0x1c, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x20, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x2a, 0x1d, + 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0x5b, 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, 0x0a, + 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto b/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto index 65d688e04..d9f1229dc 100644 --- a/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto +++ b/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; @@ -16,7 +17,10 @@ message CredentialLibrary { string id = 10; // The ID of the Credential Store of which this Credential Library is a part. - string credential_store_id = 20 [json_name = "credential_store_id"]; + string credential_store_id = 20 [ + json_name = "credential_store_id", + (controller.custom_options.v1.subtype_source_id) = true + ]; // Output only. Scope information for this Credential Library. resources.scopes.v1.ScopeInfo scope = 30; @@ -40,8 +44,18 @@ message CredentialLibrary { // The Credential Library type. string type = 90; - // The attributes that are applicable for the specific Credential Library type. - google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific Credential Library type. + google.protobuf.Struct attributes = 100 [ + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "default" + ]; + VaultCredentialLibraryAttributes vault_credential_library_attributes = 101 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "vault" + ]; + } // Output only. The available actions on this resource for this user. repeated string authorized_actions = 300 [json_name = "authorized_actions"]; @@ -63,4 +77,4 @@ message VaultCredentialLibraryAttributes { // The body of the HTTP request the library sends to vault. When set http_method must be "POST" google.protobuf.StringValue http_request_body = 30 [json_name = "http_request_body", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_request_body" that: "HttpRequestBody" }]; -} \ No newline at end of file +} diff --git a/internal/proto/controller/api/services/v1/credential_library_service.proto b/internal/proto/controller/api/services/v1/credential_library_service.proto index 080d516b8..35f13c9b8 100644 --- a/internal/proto/controller/api/services/v1/credential_library_service.proto +++ b/internal/proto/controller/api/services/v1/credential_library_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/credentiallibraries/v1/credential_library.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "credential"; service CredentialLibraryService { // GetCredentialLibrary returns a stored Credential Library if present. The provided request diff --git a/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go b/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go index 0402c526f..d442926e7 100644 --- a/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go +++ b/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers" "github.com/hashicorp/boundary/internal/types/action" "github.com/hashicorp/boundary/internal/types/resource" + "github.com/hashicorp/boundary/internal/types/subtypes" pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/credentiallibraries" "github.com/hashicorp/go-secure-stdlib/strutil" "google.golang.org/grpc/codes" @@ -27,10 +28,12 @@ import ( ) const ( + attributesPathField = "attributes" vaultPathField = "attributes.path" httpMethodField = "attributes.http_method" httpRequestBodyField = "attributes.http_request_body" credentialMappingPathField = "credential_mapping_overrides" + domain = "credential" ) // Credential mapping override attributes @@ -420,7 +423,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. default: opts = append(opts, auth.WithId(id)) - switch credential.SubtypeFromId(id) { + switch subtypes.SubtypeFromId(domain, id) { case vault.Subtype: cl, err := repo.LookupCredentialLibrary(ctx, id) if err != nil { @@ -445,7 +448,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. opts = append(opts, auth.WithPin(parentId)) - switch credential.SubtypeFromId(parentId) { + switch subtypes.SubtypeFromId(domain, parentId) { case vault.Subtype: cs, err := repo.LookupCredentialStore(ctx, parentId) if err != nil { @@ -482,7 +485,7 @@ func toProto(in credential.Library, opt ...handlers.Option) (*pb.CredentialLibra out.CredentialStoreId = in.GetStoreId() } if outputFields.Has(globals.TypeField) { - out.Type = credential.SubtypeFromId(in.GetPublicId()).String() + out.Type = subtypes.SubtypeFromId(domain, in.GetPublicId()).String() } if outputFields.Has(globals.DescriptionField) && in.GetDescription() != "" { out.Description = wrapperspb.String(in.GetDescription()) @@ -505,7 +508,7 @@ func toProto(in credential.Library, opt ...handlers.Option) (*pb.CredentialLibra if outputFields.Has(globals.AuthorizedActionsField) { out.AuthorizedActions = opts.WithAuthorizedActions } - switch credential.SubtypeFromId(in.GetPublicId()) { + switch subtypes.SubtypeFromId(domain, in.GetPublicId()) { case vault.Subtype: vaultIn, ok := in.(*vault.CredentialLibrary) if !ok { @@ -544,10 +547,8 @@ func toProto(in credential.Library, opt ...handlers.Option) (*pb.CredentialLibra if vaultIn.GetHttpRequestBody() != nil { attrs.HttpRequestBody = wrapperspb.String(string(vaultIn.GetHttpRequestBody())) } - var err error - out.Attributes, err = handlers.ProtoToStruct(attrs) - if err != nil { - return nil, errors.WrapDeprecated(err, op, errors.WithMsg("failed to convert resource from storage to api")) + out.Attrs = &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: attrs, } } } @@ -564,11 +565,7 @@ func toStorageVaultLibrary(storeId string, in *pb.CredentialLibrary) (out *vault opts = append(opts, vault.WithDescription(in.GetDescription().GetValue())) } - attrs := &pb.VaultCredentialLibraryAttributes{} - if err := handlers.StructToProto(in.GetAttributes(), attrs); err != nil { - return nil, errors.WrapDeprecated(err, op, errors.WithMsg("unable to parse the attributes")) - } - + attrs := in.GetVaultCredentialLibraryAttributes() if attrs.GetHttpMethod() != nil { opts = append(opts, vault.WithMethod(vault.Method(strings.ToUpper(attrs.GetHttpMethod().GetValue())))) } @@ -612,15 +609,14 @@ func validateGetRequest(req *pbs.GetCredentialLibraryRequest) error { func validateCreateRequest(req *pbs.CreateCredentialLibraryRequest) error { return handlers.ValidateCreateRequest(req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch credential.SubtypeFromId(req.GetItem().GetCredentialStoreId()) { + switch subtypes.SubtypeFromId(domain, req.GetItem().GetCredentialStoreId()) { case vault.Subtype: - if t := req.GetItem().GetType(); t != "" && credential.SubtypeFromType(t) != vault.Subtype { + if t := req.GetItem().GetType(); t != "" && subtypes.SubtypeFromType(domain, t) != vault.Subtype { badFields[globals.CredentialStoreIdField] = "If included, type must match that of the credential store." } - attrs := &pb.VaultCredentialLibraryAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = "Attribute fields do not match the expected format." - break + attrs := req.GetItem().GetVaultCredentialLibraryAttributes() + if attrs == nil { + badFields[attributesPathField] = "This is a required field." } if attrs.GetPath().GetValue() == "" { badFields[vaultPathField] = "This is a required field." @@ -642,29 +638,27 @@ func validateCreateRequest(req *pbs.CreateCredentialLibraryRequest) error { func validateUpdateRequest(req *pbs.UpdateCredentialLibraryRequest, currentCredentialType credential.Type) error { return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch credential.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case vault.Subtype: - if req.GetItem().GetType() != "" && credential.SubtypeFromType(req.GetItem().GetType()) != vault.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, req.GetItem().GetType()) != vault.Subtype { badFields[globals.TypeField] = "Cannot modify resource type." } if req.GetItem().GetCredentialType() != "" && req.GetItem().GetCredentialType() != string(currentCredentialType) { badFields[globals.CredentialTypeField] = "Cannot modify credential type." } - attrs := &pb.VaultCredentialLibraryAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = "Attribute fields do not match the expected format." - break + attrs := req.GetItem().GetVaultCredentialLibraryAttributes() + if attrs != nil { + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), vaultPathField) && attrs.GetPath().GetValue() == "" { + badFields[vaultPathField] = "This is a required field and cannot be set to empty." + } + if m := attrs.GetHttpMethod(); handlers.MaskContains(req.GetUpdateMask().GetPaths(), httpMethodField) && m != nil && !strutil.StrListContains([]string{"GET", "POST"}, strings.ToUpper(m.GetValue())) { + badFields[httpMethodField] = "If set, value must be 'GET' or 'POST'." + } + if b := attrs.GetHttpRequestBody(); b != nil && strings.ToUpper(attrs.GetHttpMethod().GetValue()) == "GET" { + badFields[httpRequestBodyField] = fmt.Sprintf("Field can only be set if %q is set to the value 'POST'.", httpMethodField) + } + validateMapping(badFields, currentCredentialType, req.GetItem().CredentialMappingOverrides.AsMap()) } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), vaultPathField) && attrs.GetPath().GetValue() == "" { - badFields[vaultPathField] = "This is a required field and cannot be set to empty." - } - if m := attrs.GetHttpMethod(); handlers.MaskContains(req.GetUpdateMask().GetPaths(), httpMethodField) && m != nil && !strutil.StrListContains([]string{"GET", "POST"}, strings.ToUpper(m.GetValue())) { - badFields[httpMethodField] = "If set, value must be 'GET' or 'POST'." - } - if b := attrs.GetHttpRequestBody(); b != nil && strings.ToUpper(attrs.GetHttpMethod().GetValue()) == "GET" { - badFields[httpRequestBodyField] = fmt.Sprintf("Field can only be set if %q is set to the value 'POST'.", httpMethodField) - } - validateMapping(badFields, currentCredentialType, req.GetItem().CredentialMappingOverrides.AsMap()) } return badFields }, vault.CredentialLibraryPrefix) diff --git a/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service_test.go b/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service_test.go index 38a890296..a615115bf 100644 --- a/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service_test.go +++ b/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service_test.go @@ -66,42 +66,51 @@ func TestList(t *testing.T) { Version: l.GetVersion(), Type: vault.Subtype.String(), AuthorizedActions: testAuthorizedActions, - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String(l.GetVaultPath()), HttpMethod: wrapperspb.String(l.GetHttpMethod()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }) } cases := []struct { - name string - req *pbs.ListCredentialLibrariesRequest - res *pbs.ListCredentialLibrariesResponse - err error + name string + req *pbs.ListCredentialLibrariesRequest + res *pbs.ListCredentialLibrariesResponse + anonRes *pbs.ListCredentialLibrariesResponse + err error }{ { - name: "List Many Libraries", - req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId()}, - res: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries}, + name: "List Many Libraries", + req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId()}, + res: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries}, + anonRes: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries}, }, { - name: "List No Libraries", - req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: storeNoLibs.GetPublicId()}, - res: &pbs.ListCredentialLibrariesResponse{}, + name: "List No Libraries", + req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: storeNoLibs.GetPublicId()}, + res: &pbs.ListCredentialLibrariesResponse{}, + anonRes: &pbs.ListCredentialLibrariesResponse{}, }, { - name: "Filter to One Libraries", - req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId(), Filter: fmt.Sprintf(`"/item/id"==%q`, wantLibraries[1].GetId())}, - res: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries[1:2]}, + name: "Filter to One Libraries", + req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId(), Filter: fmt.Sprintf(`"/item/id"==%q`, wantLibraries[1].GetId())}, + res: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries[1:2]}, + anonRes: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries[1:2]}, }, { - name: "Filter to No Libraries", - req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId(), Filter: `"/item/id"=="doesnt match"`}, - res: &pbs.ListCredentialLibrariesResponse{}, + name: "Filter on Attribute", + req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId(), Filter: fmt.Sprintf(`"/item/attributes/path"==%q`, wantLibraries[2].GetVaultCredentialLibraryAttributes().GetPath().Value)}, + res: &pbs.ListCredentialLibrariesResponse{Items: wantLibraries[2:3]}, + anonRes: &pbs.ListCredentialLibrariesResponse{}, // anonymous user does not have access to attributes + }, + { + name: "Filter to No Libraries", + req: &pbs.ListCredentialLibrariesRequest{CredentialStoreId: store.GetPublicId(), Filter: `"/item/id"=="doesnt match"`}, + res: &pbs.ListCredentialLibrariesResponse{}, + anonRes: &pbs.ListCredentialLibrariesResponse{}, }, { name: "Filter Bad Format", @@ -134,7 +143,7 @@ func TestList(t *testing.T) { // Test anonymous listing got, gErr = s.ListCredentialLibraries(auth.DisabledAuthTestContext(iamRepoFn, prj.GetPublicId(), auth.WithUserId(auth.AnonymousUserId)), tc.req) require.NoError(t, gErr) - assert.Len(t, got.Items, len(tc.res.Items)) + assert.Len(t, got.Items, len(tc.anonRes.Items)) for _, item := range got.GetItems() { require.Nil(t, item.CreatedTime) require.Nil(t, item.UpdatedTime) @@ -176,11 +185,9 @@ func TestCreate(t *testing.T) { name: "missing vault path", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{}) - require.NoError(t, err) - return attrs - }(), + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{}, + }, }}, idPrefix: vault.CredentialLibraryPrefix + "_", wantErr: true, @@ -190,13 +197,11 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), Id: vault.CredentialLibraryPrefix + "_notallowed", - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -206,13 +211,11 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), CreatedTime: timestamppb.Now(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -222,13 +225,11 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), UpdatedTime: timestamppb.Now(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -238,13 +239,11 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), Type: "static", - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -253,29 +252,11 @@ func TestCreate(t *testing.T) { name: "parent id must be included", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), - }}, - res: nil, - err: handlers.ApiErrorWithCode(codes.InvalidArgument), - }, - { - name: "Attributes must be valid for vault type", - req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ - CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ - Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - attrs.Fields["invalid"] = structpb.NewStringValue("foo") - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -284,14 +265,12 @@ func TestCreate(t *testing.T) { name: "Cannot specify a http request body when http method is get", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpRequestBody: wrapperspb.String("foo"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -300,14 +279,12 @@ func TestCreate(t *testing.T) { name: "Invalid Method", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("PATCH"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -316,14 +293,12 @@ func TestCreate(t *testing.T) { name: "Request Body With GET Method", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpRequestBody: wrapperspb.String("foo"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -332,13 +307,11 @@ func TestCreate(t *testing.T) { name: "Invalid credential type", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: "fake-type", }}, res: nil, @@ -348,13 +321,11 @@ func TestCreate(t *testing.T) { name: "Invalid user_password mapping", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: string(credential.UserPasswordType), CredentialMappingOverrides: func() *structpb.Struct { v := map[string]interface{}{ @@ -373,15 +344,13 @@ func TestCreate(t *testing.T) { name: "Using POST method", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("post"), HttpRequestBody: wrapperspb.String("foo"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialLibraryPrefix + "_", res: &pbs.CreateCredentialLibraryResponse{ @@ -394,15 +363,13 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("POST"), HttpRequestBody: wrapperspb.String("foo"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, AuthorizedActions: testAuthorizedActions, }, }, @@ -413,13 +380,11 @@ func TestCreate(t *testing.T) { CredentialStoreId: store.GetPublicId(), Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "desc"}, - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialLibraryPrefix + "_", res: &pbs.CreateCredentialLibraryResponse{ @@ -434,14 +399,12 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("GET"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, AuthorizedActions: testAuthorizedActions, }, }, @@ -450,13 +413,11 @@ func TestCreate(t *testing.T) { name: "Create a valid vault CredentialLibrary user_password type", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: string(credential.UserPasswordType), }}, idPrefix: vault.CredentialLibraryPrefix + "_", @@ -470,14 +431,12 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("GET"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: string(credential.UserPasswordType), AuthorizedActions: testAuthorizedActions, }, @@ -487,13 +446,11 @@ func TestCreate(t *testing.T) { name: "Create a valid vault CredentialLibrary user_password type with username mapping", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialMappingOverrides: func() *structpb.Struct { v := map[string]interface{}{ usernameAttribute: "user-test", @@ -515,14 +472,12 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("GET"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: string(credential.UserPasswordType), CredentialMappingOverrides: func() *structpb.Struct { v := map[string]interface{}{ @@ -540,13 +495,11 @@ func TestCreate(t *testing.T) { name: "Create a valid vault CredentialLibrary user_password type with username/password mapping", req: &pbs.CreateCredentialLibraryRequest{Item: &pb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialMappingOverrides: func() *structpb.Struct { v := map[string]interface{}{ usernameAttribute: "user-test", @@ -569,14 +522,12 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), HttpMethod: wrapperspb.String("GET"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: string(credential.UserPasswordType), CredentialMappingOverrides: func() *structpb.Struct { v := map[string]interface{}{ @@ -685,14 +636,12 @@ func TestGet(t *testing.T) { CreatedTime: unspecifiedLib.CreateTime.GetTimestamp(), UpdatedTime: unspecifiedLib.UpdateTime.GetTimestamp(), Version: 1, - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String(unspecifiedLib.GetVaultPath()), HttpMethod: wrapperspb.String(unspecifiedLib.GetHttpMethod()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, }, @@ -709,14 +658,12 @@ func TestGet(t *testing.T) { CreatedTime: userPassLib.CreateTime.GetTimestamp(), UpdatedTime: userPassLib.UpdateTime.GetTimestamp(), Version: 1, - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String(userPassLib.GetVaultPath()), HttpMethod: wrapperspb.String(userPassLib.GetHttpMethod()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, CredentialType: "user_password", CredentialMappingOverrides: func() *structpb.Struct { v := map[string]interface{}{ @@ -900,19 +847,17 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialLibraryRequest{ UpdateMask: fieldmask(httpMethodField), Item: &pb.CredentialLibrary{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ HttpMethod: wrapperspb.String("pOsT"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialLibrary) *pb.CredentialLibrary { out := proto.Clone(in).(*pb.CredentialLibrary) - out.Attributes.Fields["path"] = structpb.NewStringValue("vault/path") - out.Attributes.Fields["http_method"] = structpb.NewStringValue("POST") + out.GetVaultCredentialLibraryAttributes().Path = wrapperspb.String("vault/path") + out.GetVaultCredentialLibraryAttributes().HttpMethod = wrapperspb.String("POST") return out }, }, @@ -921,21 +866,19 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialLibraryRequest{ UpdateMask: fieldmask(httpRequestBodyField, httpMethodField), Item: &pb.CredentialLibrary{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ HttpMethod: wrapperspb.String("pOsT"), HttpRequestBody: wrapperspb.String("body"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialLibrary) *pb.CredentialLibrary { out := proto.Clone(in).(*pb.CredentialLibrary) - out.Attributes.Fields["path"] = structpb.NewStringValue("vault/path") - out.Attributes.Fields["http_method"] = structpb.NewStringValue("POST") - out.Attributes.Fields["http_request_body"] = structpb.NewStringValue("body") + out.GetVaultCredentialLibraryAttributes().Path = wrapperspb.String("vault/path") + out.GetVaultCredentialLibraryAttributes().HttpMethod = wrapperspb.String("POST") + out.GetVaultCredentialLibraryAttributes().HttpRequestBody = wrapperspb.String("body") return out }, }, @@ -944,18 +887,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialLibraryRequest{ UpdateMask: fieldmask(vaultPathField), Item: &pb.CredentialLibrary{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialLibraryAttributes{ + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ Path: wrapperspb.String("something"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialLibrary) *pb.CredentialLibrary { out := proto.Clone(in).(*pb.CredentialLibrary) - out.Attributes.Fields["path"] = structpb.NewStringValue("something") + out.GetVaultCredentialLibraryAttributes().Path = wrapperspb.String("something") return out }, }, @@ -1274,9 +1215,9 @@ func TestUpdate(t *testing.T) { UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{httpRequestBodyField}}, Item: &pb.CredentialLibrary{ Version: vl.GetVersion(), - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "http_request_body": structpb.NewStringValue("body"), + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ + HttpRequestBody: wrapperspb.String("body"), }, }, }, @@ -1290,16 +1231,16 @@ func TestUpdate(t *testing.T) { UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{httpMethodField}}, Item: &pb.CredentialLibrary{ Version: vl.GetVersion(), - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "http_method": structpb.NewStringValue("POST"), + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ + HttpMethod: wrapperspb.String("POST"), }, }, }, }) require.NoError(t, err) require.NotNil(t, cl) - require.Equal(t, "POST", cl.GetItem().GetAttributes().GetFields()["http_method"].GetStringValue()) + require.Equal(t, "POST", cl.GetItem().GetVaultCredentialLibraryAttributes().GetHttpMethod().Value) // Can set request body on POST cl, err = s.UpdateCredentialLibrary(ctx, &pbs.UpdateCredentialLibraryRequest{ @@ -1307,17 +1248,17 @@ func TestUpdate(t *testing.T) { UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{httpRequestBodyField}}, Item: &pb.CredentialLibrary{ Version: cl.Item.GetVersion(), - Attributes: &structpb.Struct{ - Fields: map[string]*structpb.Value{ - "http_request_body": structpb.NewStringValue("body"), + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ + HttpRequestBody: wrapperspb.String("body"), }, }, }, }) require.NoError(t, err) require.NotNil(t, cl) - require.Equal(t, "POST", cl.GetItem().GetAttributes().GetFields()["http_method"].GetStringValue()) - require.Equal(t, "body", cl.GetItem().GetAttributes().GetFields()["http_request_body"].GetStringValue()) + require.Equal(t, "POST", cl.GetItem().GetVaultCredentialLibraryAttributes().GetHttpMethod().Value) + require.Equal(t, "body", cl.GetItem().GetVaultCredentialLibraryAttributes().GetHttpRequestBody().Value) // Cannot unset POST method (defaulting to GET) when request body is set _, err = s.UpdateCredentialLibrary(ctx, &pbs.UpdateCredentialLibraryRequest{ @@ -1339,7 +1280,7 @@ func TestUpdate(t *testing.T) { }) assert.NoError(t, err) require.NotNil(t, cl) - assert.Equal(t, "GET", cl.GetItem().GetAttributes().GetFields()["http_method"].GetStringValue()) - assert.Nil(t, cl.GetItem().GetAttributes().GetFields()["http_request_body"]) + assert.Equal(t, "GET", cl.GetItem().GetVaultCredentialLibraryAttributes().GetHttpMethod().Value) + assert.Nil(t, cl.GetItem().GetVaultCredentialLibraryAttributes().GetHttpRequestBody()) }) } diff --git a/internal/servers/controller/handlers/credentialstores/credentialstore_service.go b/internal/servers/controller/handlers/credentialstores/credentialstore_service.go index d35ccba25..ac08072d7 100644 --- a/internal/servers/controller/handlers/credentialstores/credentialstore_service.go +++ b/internal/servers/controller/handlers/credentialstores/credentialstore_service.go @@ -22,6 +22,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/credentialstores" "google.golang.org/grpc/codes" "google.golang.org/protobuf/types/known/wrapperspb" @@ -34,6 +35,7 @@ const ( caCertsField = "attributes.ca_cert" clientCertField = "attributes.client_certificate" clientCertKeyField = "attributes.certificate_key" + domain = "credential" ) var ( @@ -478,7 +480,7 @@ func toProto(in credential.Store, opt ...handlers.Option) (*pb.CredentialStore, out.ScopeId = in.GetScopeId() } if outputFields.Has(globals.TypeField) { - out.Type = credential.SubtypeFromId(in.GetPublicId()).String() + out.Type = subtypes.SubtypeFromId(domain, in.GetPublicId()).String() } if outputFields.Has(globals.DescriptionField) && in.GetDescription() != "" { out.Description = wrapperspb.String(in.GetDescription()) @@ -505,7 +507,7 @@ func toProto(in credential.Store, opt ...handlers.Option) (*pb.CredentialStore, out.AuthorizedCollectionActions = opts.WithAuthorizedCollectionActions } if outputFields.Has(globals.AttributesField) { - switch credential.SubtypeFromId(in.GetPublicId()) { + switch subtypes.SubtypeFromId(domain, in.GetPublicId()) { case vault.Subtype: vaultIn, ok := in.(*vault.CredentialStore) if !ok { @@ -616,7 +618,7 @@ func validateCreateRequest(req *pbs.CreateCredentialStoreRequest) error { if !handlers.ValidId(handlers.Id(req.GetItem().GetScopeId()), scope.Project.Prefix()) { badFields["scope_id"] = "This field must be a valid project scope id." } - switch credential.SubtypeFromType(req.GetItem().GetType()) { + switch subtypes.SubtypeFromType(domain, req.GetItem().GetType()) { case vault.Subtype: attrs := &pb.VaultCredentialStoreAttributes{} if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { @@ -659,9 +661,9 @@ func validateCreateRequest(req *pbs.CreateCredentialStoreRequest) error { func validateUpdateRequest(req *pbs.UpdateCredentialStoreRequest) error { return handlers.ValidateUpdateRequest(req, req.GetItem(), func() map[string]string { badFields := map[string]string{} - switch credential.SubtypeFromId(req.GetId()) { + switch subtypes.SubtypeFromId(domain, req.GetId()) { case vault.Subtype: - if req.GetItem().GetType() != "" && credential.SubtypeFromType(req.GetItem().GetType()) != vault.Subtype { + if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, req.GetItem().GetType()) != vault.Subtype { badFields["type"] = "Cannot modify resource type." } attrs := &pb.VaultCredentialStoreAttributes{} diff --git a/internal/servers/controller/handlers/targets/target_service.go b/internal/servers/controller/handlers/targets/target_service.go index 55712fbd5..ac020ae23 100644 --- a/internal/servers/controller/handlers/targets/target_service.go +++ b/internal/servers/controller/handlers/targets/target_service.go @@ -46,6 +46,10 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) +const ( + credentialDomain = "credential" +) + var ( // IdActions contains the set of actions that can be performed on // individual resources @@ -1140,14 +1144,14 @@ func (s Service) AuthorizeSession(ctx context.Context, req *pbs.AuthorizeSession Name: l.GetName(), Description: l.GetDescription(), CredentialStoreId: l.GetStoreId(), - Type: credential.SubtypeFromId(l.GetPublicId()).String(), + Type: subtypes.SubtypeFromId(credentialDomain, l.GetPublicId()).String(), }, CredentialSource: &pb.CredentialSource{ Id: l.GetPublicId(), Name: l.GetName(), Description: l.GetDescription(), CredentialStoreId: l.GetStoreId(), - Type: credential.SubtypeFromId(l.GetPublicId()).String(), + Type: subtypes.SubtypeFromId(credentialDomain, l.GetPublicId()).String(), CredentialType: credType, }, Secret: &pb.SessionSecret{ diff --git a/internal/servers/controller/handlers/targets/tcp/target_service_test.go b/internal/servers/controller/handlers/targets/tcp/target_service_test.go index 1780dfa66..b9ffe2936 100644 --- a/internal/servers/controller/handlers/targets/tcp/target_service_test.go +++ b/internal/servers/controller/handlers/targets/tcp/target_service_test.go @@ -2712,11 +2712,19 @@ func TestAuthorizeSession(t *testing.T) { CredentialStoreId: store.GetPublicId(), Name: wrapperspb.String("Library Name"), Description: wrapperspb.String("Library Description"), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "path": structpb.NewStringValue(path.Join("pki", "issue", "boundary")), - "http_method": structpb.NewStringValue("POST"), - "http_request_body": structpb.NewStringValue(`{"common_name":"boundary.com"}`), - }}, + Attrs: &credpb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &credpb.VaultCredentialLibraryAttributes{ + Path: &wrapperspb.StringValue{ + Value: path.Join("pki", "issue", "boundary"), + }, + HttpMethod: &wrapperspb.StringValue{ + Value: "POST", + }, + HttpRequestBody: &wrapperspb.StringValue{ + Value: `{"common_name":"boundary.com"}`, + }, + }, + }, }}) require.NoError(t, err) @@ -2934,10 +2942,12 @@ func TestAuthorizeSessionTypedCredentials(t *testing.T) { CredentialStoreId: store.GetPublicId(), Name: wrapperspb.String("Userpassword Library"), Description: wrapperspb.String("Userpassword Library Description"), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "path": structpb.NewStringValue(path.Join("secret", "data", "default-userpass")), - "http_method": structpb.NewStringValue("GET"), - }}, + Attrs: &credpb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &credpb.VaultCredentialLibraryAttributes{ + Path: wrapperspb.String(path.Join("secret", "data", "default-userpass")), + HttpMethod: wrapperspb.String("GET"), + }, + }, CredentialType: "user_password", }}) require.NoError(t, err) @@ -2946,10 +2956,12 @@ func TestAuthorizeSessionTypedCredentials(t *testing.T) { CredentialStoreId: store.GetPublicId(), Name: wrapperspb.String("Unspecified Library"), Description: wrapperspb.String("Unspecified Library Description"), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "path": structpb.NewStringValue(path.Join("secret", "data", "default-userpass")), - "http_method": structpb.NewStringValue("GET"), - }}, + Attrs: &credpb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &credpb.VaultCredentialLibraryAttributes{ + Path: wrapperspb.String(path.Join("secret", "data", "default-userpass")), + HttpMethod: wrapperspb.String("GET"), + }, + }, }}) require.NoError(t, err) @@ -2961,10 +2973,12 @@ func TestAuthorizeSessionTypedCredentials(t *testing.T) { CredentialStoreId: store.GetPublicId(), Name: wrapperspb.String("Userpassword Mapping Library"), Description: wrapperspb.String("Userpassword Mapping Library Description"), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "path": structpb.NewStringValue(path.Join("secret", "data", "non-default-userpass")), - "http_method": structpb.NewStringValue("GET"), - }}, + Attrs: &credpb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &credpb.VaultCredentialLibraryAttributes{ + Path: wrapperspb.String(path.Join("secret", "data", "non-default-userpass")), + HttpMethod: wrapperspb.String("GET"), + }, + }, CredentialType: "user_password", CredentialMappingOverrides: &structpb.Struct{Fields: map[string]*structpb.Value{ "username_attribute": structpb.NewStringValue("non-default-user"), @@ -3218,9 +3232,11 @@ func TestAuthorizeSession_Errors(t *testing.T) { clsResp, err := credService.CreateCredentialLibrary(ctx, &pbs.CreateCredentialLibraryRequest{Item: &credpb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), Description: wrapperspb.String(fmt.Sprintf("Library Description for target %q", tar.GetName())), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "path": structpb.NewStringValue(path.Join("database", "creds", "opened")), - }}, + Attrs: &credpb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &credpb.VaultCredentialLibraryAttributes{ + Path: wrapperspb.String(path.Join("database", "creds", "opened")), + }, + }, }}) require.NoError(t, err) @@ -3240,9 +3256,11 @@ func TestAuthorizeSession_Errors(t *testing.T) { clsResp, err := credService.CreateCredentialLibrary(ctx, &pbs.CreateCredentialLibraryRequest{Item: &credpb.CredentialLibrary{ CredentialStoreId: store.GetPublicId(), Description: wrapperspb.String(fmt.Sprintf("Library Description for target %q", tar.GetName())), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "path": structpb.NewStringValue("bad path"), - }}, + Attrs: &credpb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &credpb.VaultCredentialLibraryAttributes{ + Path: wrapperspb.String("bad path"), + }, + }, }}) require.NoError(t, err) diff --git a/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go b/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go index 489992f75..bf95c4be7 100644 --- a/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go +++ b/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go @@ -9,6 +9,7 @@ package credentiallibraries import ( 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" @@ -50,8 +51,10 @@ type CredentialLibrary struct { Version uint32 `protobuf:"varint,80,opt,name=version,proto3" json:"version,omitempty"` // The Credential Library type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty"` - // The attributes that are applicable for the specific Credential Library type. - Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *CredentialLibrary_Attributes + // *CredentialLibrary_VaultCredentialLibraryAttributes + Attrs isCredentialLibrary_Attrs `protobuf_oneof:"attrs"` // 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"` // The type of credential this library will issue, defaults to Unspecified @@ -155,13 +158,27 @@ func (x *CredentialLibrary) GetType() string { return "" } +func (m *CredentialLibrary) GetAttrs() isCredentialLibrary_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *CredentialLibrary) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*CredentialLibrary_Attributes); ok { return x.Attributes } return nil } +func (x *CredentialLibrary) GetVaultCredentialLibraryAttributes() *VaultCredentialLibraryAttributes { + if x, ok := x.GetAttrs().(*CredentialLibrary_VaultCredentialLibraryAttributes); ok { + return x.VaultCredentialLibraryAttributes + } + return nil +} + func (x *CredentialLibrary) GetAuthorizedActions() []string { if x != nil { return x.AuthorizedActions @@ -183,6 +200,23 @@ func (x *CredentialLibrary) GetCredentialMappingOverrides() *structpb.Struct { return nil } +type isCredentialLibrary_Attrs interface { + isCredentialLibrary_Attrs() +} + +type CredentialLibrary_Attributes struct { + // The attributes that are applicable for the specific Credential Library type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3,oneof"` +} + +type CredentialLibrary_VaultCredentialLibraryAttributes struct { + VaultCredentialLibraryAttributes *VaultCredentialLibraryAttributes `protobuf:"bytes,101,opt,name=vault_credential_library_attributes,json=vaultCredentialLibraryAttributes,proto3,oneof"` +} + +func (*CredentialLibrary_Attributes) isCredentialLibrary_Attrs() {} + +func (*CredentialLibrary_VaultCredentialLibraryAttributes) isCredentialLibrary_Attrs() {} + // The attributes of a vault typed Credential Library. type VaultCredentialLibraryAttributes struct { state protoimpl.MessageState @@ -266,91 +300,107 @@ var file_controller_api_resources_credentiallibraries_v1_credential_library_prot 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, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf9, 0x05, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x13, - 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, - 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x04, 0x4e, 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, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f, 0x0a, - 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0xb6, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0f, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x62, - 0x0a, 0x1c, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x18, 0xc0, - 0x02, 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, 0x1c, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, - 0x65, 0x73, 0x22, 0xee, 0x02, 0x0a, 0x20, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x56, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 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, 0x24, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1c, 0x0a, 0x0f, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x12, 0x09, - 0x56, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, - 0x6c, 0x0a, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x14, + 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 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, 0xd9, 0x07, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x13, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, + 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xe3, 0x29, 0x01, 0x52, 0x13, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, + 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x2c, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x24, 0x0a, 0x16, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, - 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0a, 0x48, 0x74, 0x74, 0x70, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x52, 0x0b, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x83, 0x01, - 0x0a, 0x11, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, - 0x6f, 0x64, 0x79, 0x18, 0x1e, 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, 0x37, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, - 0x2f, 0x0a, 0x1c, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x68, 0x74, - 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x12, - 0x0f, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, - 0x52, 0x11, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, - 0x6f, 0x64, 0x79, 0x42, 0x68, 0x5a, 0x66, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x04, 0x4e, 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, 0x44, 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, 0x4a, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0xc1, 0x01, 0x0a, + 0x23, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x51, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x61, 0x75, + 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1d, 0xa0, + 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x05, 0x76, 0x61, 0x75, 0x6c, 0x74, 0xfa, 0xd2, 0xe4, 0x93, + 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x20, + 0x76, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x2f, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0xb6, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, + 0x01, 0x52, 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x62, 0x0a, 0x1c, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, + 0x65, 0x73, 0x18, 0xc0, 0x02, 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, 0x1c, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x6f, 0x76, 0x65, + 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, + 0xee, 0x02, 0x0a, 0x20, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x56, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 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, 0x24, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1c, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x12, 0x09, 0x56, 0x61, 0x75, + 0x6c, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x6c, 0x0a, 0x0b, + 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x14, 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, + 0x2c, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x24, 0x0a, 0x16, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x12, 0x0a, 0x48, 0x74, 0x74, 0x70, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x0b, 0x68, + 0x74, 0x74, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x83, 0x01, 0x0a, 0x11, 0x68, + 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x1e, 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, 0x37, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2f, 0x0a, 0x1c, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x5f, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x0f, 0x48, 0x74, + 0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x11, 0x68, + 0x74, 0x74, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x6f, 0x64, 0x79, + 0x42, 0x68, 0x5a, 0x66, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -381,15 +431,16 @@ var file_controller_api_resources_credentiallibraries_v1_credential_library_prot 4, // 3: controller.api.resources.credentiallibraries.v1.CredentialLibrary.created_time:type_name -> google.protobuf.Timestamp 4, // 4: controller.api.resources.credentiallibraries.v1.CredentialLibrary.updated_time:type_name -> google.protobuf.Timestamp 5, // 5: controller.api.resources.credentiallibraries.v1.CredentialLibrary.attributes:type_name -> google.protobuf.Struct - 5, // 6: controller.api.resources.credentiallibraries.v1.CredentialLibrary.credential_mapping_overrides:type_name -> google.protobuf.Struct - 3, // 7: controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes.path:type_name -> google.protobuf.StringValue - 3, // 8: controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes.http_method:type_name -> google.protobuf.StringValue - 3, // 9: controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes.http_request_body:type_name -> google.protobuf.StringValue - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 1, // 6: controller.api.resources.credentiallibraries.v1.CredentialLibrary.vault_credential_library_attributes:type_name -> controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes + 5, // 7: controller.api.resources.credentiallibraries.v1.CredentialLibrary.credential_mapping_overrides:type_name -> google.protobuf.Struct + 3, // 8: controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes.path:type_name -> google.protobuf.StringValue + 3, // 9: controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes.http_method:type_name -> google.protobuf.StringValue + 3, // 10: controller.api.resources.credentiallibraries.v1.VaultCredentialLibraryAttributes.http_request_body:type_name -> google.protobuf.StringValue + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_controller_api_resources_credentiallibraries_v1_credential_library_proto_init() } @@ -423,6 +474,10 @@ func file_controller_api_resources_credentiallibraries_v1_credential_library_pro } } } + file_controller_api_resources_credentiallibraries_v1_credential_library_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*CredentialLibrary_Attributes)(nil), + (*CredentialLibrary_VaultCredentialLibraryAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ From 00e57b20a2b9624c33ea3f1afd8b89feb1fe7bda Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Wed, 6 Apr 2022 15:36:08 -0400 Subject: [PATCH 35/45] feat(credentiallibrary): Classify resources for audit events --- Makefile | 2 + .../services/credential_library_service.pb.go | 12 +- .../v1/credential_library.proto | 26 +-- .../v1/credential_library_service.proto | 12 +- .../credentiallibrary_classification_test.go | 201 ++++++++++++++++++ .../credential_library.pb.go | 26 +-- 6 files changed, 241 insertions(+), 38 deletions(-) create mode 100644 internal/tests/api/credentiallibraries/credentiallibrary_classification_test.go diff --git a/Makefile b/Makefile index 1b92557d7..64c262fb3 100644 --- a/Makefile +++ b/Makefile @@ -171,6 +171,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/managed_group_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/groups/group.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/group_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_library_service.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/credential_library_service.pb.go b/internal/gen/controller/api/services/credential_library_service.pb.go index e181dd774..30a19ff6c 100644 --- a/internal/gen/controller/api/services/credential_library_service.pb.go +++ b/internal/gen/controller/api/services/credential_library_service.pb.go @@ -30,7 +30,7 @@ type GetCredentialLibraryRequest 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 *GetCredentialLibraryRequest) Reset() { @@ -124,8 +124,8 @@ type ListCredentialLibrariesRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CredentialStoreId string `protobuf:"bytes,1,opt,name=credential_store_id,json=scope_id,proto3" json:"credential_store_id,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + CredentialStoreId string `protobuf:"bytes,1,opt,name=credential_store_id,json=scope_id,proto3" json:"credential_store_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 *ListCredentialLibrariesRequest) Reset() { @@ -273,7 +273,7 @@ type CreateCredentialLibraryResponse 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 *credentiallibraries.CredentialLibrary `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -328,7 +328,7 @@ type UpdateCredentialLibraryRequest 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 *credentiallibraries.CredentialLibrary `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"` } @@ -438,7 +438,7 @@ type DeleteCredentialLibraryRequest 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 *DeleteCredentialLibraryRequest) Reset() { diff --git a/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto b/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto index d9f1229dc..fcb2c2463 100644 --- a/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto +++ b/internal/proto/controller/api/resources/credentiallibraries/v1/credential_library.proto @@ -14,35 +14,35 @@ import "controller/custom_options/v1/options.proto"; // CredentialLibrary contains all fields related to an Credential Library resource message CredentialLibrary { // Output only. The ID of the Credential Library. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The ID of the Credential Store of which this Credential Library is a part. string credential_store_id = 20 [ json_name = "credential_store_id", (controller.custom_options.v1.subtype_source_id) = true - ]; + ]; // @gotags: `class:"public"` // Output only. Scope information for this Credential Library. resources.scopes.v1.ScopeInfo scope = 30; // 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 Credential Library type. - string type = 90; + string type = 90; // @gotags: `class:"public"` oneof attrs { // The attributes that are applicable for the specific Credential Library type. @@ -58,10 +58,10 @@ message CredentialLibrary { } // 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"` // The type of credential this library will issue, defaults to Unspecified - string credential_type = 310 [json_name = "credential_type", (custom_options.v1.generate_sdk_option) = true]; + string credential_type = 310 [json_name = "credential_type", (custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"` // The credential mapping overrides google.protobuf.Struct credential_mapping_overrides = 320 [json_name = "credential_mapping_overrides", (custom_options.v1.generate_sdk_option) = true]; @@ -70,11 +70,11 @@ message CredentialLibrary { // The attributes of a vault typed Credential Library. message VaultCredentialLibraryAttributes { // The path in Vault to request credentials from. - google.protobuf.StringValue path = 10 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.path" that: "VaultPath" }]; + google.protobuf.StringValue path = 10 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.path" that: "VaultPath" }]; // @gotags: `class:"public"` // The HTTP method the library uses to communicate with Vault. - google.protobuf.StringValue http_method = 20 [json_name = "http_method", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_method" that: "HttpMethod" }]; + google.protobuf.StringValue http_method = 20 [json_name = "http_method", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_method" that: "HttpMethod" }]; // @gotags: `class:"public"` // The body of the HTTP request the library sends to vault. When set http_method must be "POST" - google.protobuf.StringValue http_request_body = 30 [json_name = "http_request_body", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_request_body" that: "HttpRequestBody" }]; + google.protobuf.StringValue http_request_body = 30 [json_name = "http_request_body", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_request_body" that: "HttpRequestBody" }]; // @gotags: `class:"secret"` } diff --git a/internal/proto/controller/api/services/v1/credential_library_service.proto b/internal/proto/controller/api/services/v1/credential_library_service.proto index 35f13c9b8..c031900e5 100644 --- a/internal/proto/controller/api/services/v1/credential_library_service.proto +++ b/internal/proto/controller/api/services/v1/credential_library_service.proto @@ -86,7 +86,7 @@ service CredentialLibraryService { } message GetCredentialLibraryRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetCredentialLibraryResponse { @@ -94,8 +94,8 @@ message GetCredentialLibraryResponse { } message ListCredentialLibrariesRequest { - string credential_store_id = 1 [json_name = "scope_id"]; - string filter = 30 [json_name = "filter"]; + string credential_store_id = 1 [json_name = "scope_id"]; // @gotags: `class:"public"` + string filter = 30 [json_name = "filter"]; // @gotags: `class:"public"` } message ListCredentialLibrariesResponse { @@ -107,12 +107,12 @@ message CreateCredentialLibraryRequest { } message CreateCredentialLibraryResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.credentiallibraries.v1.CredentialLibrary item = 2; } message UpdateCredentialLibraryRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.credentiallibraries.v1.CredentialLibrary item = 2; google.protobuf.FieldMask update_mask = 3 [json_name = "update_mask"]; } @@ -122,7 +122,7 @@ message UpdateCredentialLibraryResponse { } message DeleteCredentialLibraryRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteCredentialLibraryResponse {} diff --git a/internal/tests/api/credentiallibraries/credentiallibrary_classification_test.go b/internal/tests/api/credentiallibraries/credentiallibrary_classification_test.go new file mode 100644 index 000000000..13556c29d --- /dev/null +++ b/internal/tests/api/credentiallibraries/credentiallibrary_classification_test.go @@ -0,0 +1,201 @@ +package credentiallibraries_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/credentiallibraries" + "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/structpb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +func TestCredentialLibraryClassification(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + cases := []struct { + name string + in *eventlogger.Event + want *eventlogger.Event + }{ + { + "Vault", + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialLibrary{ + Id: "id", + CredentialStoreId: "credential-store-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "vault", + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ + Path: &wrapperspb.StringValue{Value: "/path"}, + HttpMethod: &wrapperspb.StringValue{Value: "POST"}, + HttpRequestBody: &wrapperspb.StringValue{Value: `{"request": "body-secret"}`}, + }, + }, + AuthorizedActions: []string{"action-1", "action-2"}, + CredentialType: "credential-type", + CredentialMappingOverrides: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "override-1": structpb.NewStringValue("one"), + "override-2": structpb.NewStringValue("two"), + }, + }, + }, + }, + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialLibrary{ + Id: "id", + CredentialStoreId: "credential-store-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "vault", + Attrs: &pb.CredentialLibrary_VaultCredentialLibraryAttributes{ + VaultCredentialLibraryAttributes: &pb.VaultCredentialLibraryAttributes{ + Path: &wrapperspb.StringValue{Value: "/path"}, + HttpMethod: &wrapperspb.StringValue{Value: "POST"}, + HttpRequestBody: &wrapperspb.StringValue{Value: encrypt.RedactedData}, + }, + }, + AuthorizedActions: []string{"action-1", "action-2"}, + CredentialType: "credential-type", + CredentialMappingOverrides: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "override-1": structpb.NewStringValue(encrypt.RedactedData), + "override-2": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + }, + }, + { + "Default", + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialLibrary{ + Id: "id", + CredentialStoreId: "credential-store-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "default", + Attrs: &pb.CredentialLibrary_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewStringValue("vaule1"), + "field2": structpb.NewStringValue("vaule2"), + }, + }, + }, + AuthorizedActions: []string{"action-1", "action-2"}, + CredentialType: "credential-type", + CredentialMappingOverrides: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "override-1": structpb.NewStringValue("one"), + "override-2": structpb.NewStringValue("two"), + }, + }, + }, + }, + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialLibrary{ + Id: "id", + CredentialStoreId: "credential-store-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "default", + Attrs: &pb.CredentialLibrary_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewStringValue(encrypt.RedactedData), + "field2": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + AuthorizedActions: []string{"action-1", "action-2"}, + CredentialType: "credential-type", + CredentialMappingOverrides: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "override-1": structpb.NewStringValue(encrypt.RedactedData), + "override-2": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + wantJSON, err := json.Marshal(tc.want) + require.NoError(t, err) + + got, err := testEncryptingFilter.Process(ctx, tc.in) + require.NoError(t, err) + require.NotNil(t, got) + gotJSON, err := json.Marshal(got) + require.NoError(t, err) + assert.JSONEq(t, string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go b/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go index bf95c4be7..29bf4d234 100644 --- a/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go +++ b/sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go @@ -33,32 +33,32 @@ type CredentialLibrary struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Credential Library. - 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 ID of the Credential Store of which this Credential Library is a part. - CredentialStoreId string `protobuf:"bytes,20,opt,name=credential_store_id,proto3" json:"credential_store_id,omitempty"` + CredentialStoreId string `protobuf:"bytes,20,opt,name=credential_store_id,proto3" json:"credential_store_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. Scope information for this Credential Library. Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,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 Credential Library type. - 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"` // Types that are assignable to Attrs: // *CredentialLibrary_Attributes // *CredentialLibrary_VaultCredentialLibraryAttributes Attrs isCredentialLibrary_Attrs `protobuf_oneof:"attrs"` // 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"` // The type of credential this library will issue, defaults to Unspecified - CredentialType string `protobuf:"bytes,310,opt,name=credential_type,proto3" json:"credential_type,omitempty"` + CredentialType string `protobuf:"bytes,310,opt,name=credential_type,proto3" json:"credential_type,omitempty" class:"public"` // @gotags: `class:"public"` // The credential mapping overrides CredentialMappingOverrides *structpb.Struct `protobuf:"bytes,320,opt,name=credential_mapping_overrides,proto3" json:"credential_mapping_overrides,omitempty"` } @@ -224,11 +224,11 @@ type VaultCredentialLibraryAttributes struct { unknownFields protoimpl.UnknownFields // The path in Vault to request credentials from. - Path *wrapperspb.StringValue `protobuf:"bytes,10,opt,name=path,proto3" json:"path,omitempty"` + Path *wrapperspb.StringValue `protobuf:"bytes,10,opt,name=path,proto3" json:"path,omitempty" class:"public"` // @gotags: `class:"public"` // The HTTP method the library uses to communicate with Vault. - HttpMethod *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=http_method,proto3" json:"http_method,omitempty"` + HttpMethod *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=http_method,proto3" json:"http_method,omitempty" class:"public"` // @gotags: `class:"public"` // The body of the HTTP request the library sends to vault. When set http_method must be "POST" - HttpRequestBody *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=http_request_body,proto3" json:"http_request_body,omitempty"` + HttpRequestBody *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=http_request_body,proto3" json:"http_request_body,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *VaultCredentialLibraryAttributes) Reset() { From 9d3a57cbb0429190ac56ef4728414c442f0ad3af Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 7 Apr 2022 13:31:04 -0400 Subject: [PATCH 36/45] refact(credentialstore): Switch subtype attributes to oneof This updates the credential store resources to use a oneof for attributes. This allows requests to the credential store service to leverage the new subtypes.AttributeTransformerInterceptor so that attributes are strongly typed prior to the service handler. --- .../services/credential_store_service.pb.go | 264 ++++++------ .../v1/credential_store.proto | 15 +- .../v1/credential_store_service.proto | 3 + .../credentiallibrary_service.go | 6 +- .../credentialstore_service.go | 70 ++-- .../credentialstore_service_test.go | 389 ++++++++---------- .../credentialstores/credential_store.pb.go | 344 +++++++++------- 7 files changed, 557 insertions(+), 534 deletions(-) diff --git a/internal/gen/controller/api/services/credential_store_service.pb.go b/internal/gen/controller/api/services/credential_store_service.pb.go index d8e3d5bd4..27e147144 100644 --- a/internal/gen/controller/api/services/credential_store_service.pb.go +++ b/internal/gen/controller/api/services/credential_store_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" credentialstores "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/credentialstores" + _ "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" @@ -544,146 +545,149 @@ var file_controller_api_services_v1_credential_store_service_proto_rawDesc = []b 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x19, - 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x1a, 0x47, 0x65, 0x74, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6f, 0x0a, 0x1b, 0x4c, 0x69, - 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, - 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, - 0x69, 0x76, 0x65, 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, 0x73, 0x0a, 0x1c, 0x4c, - 0x69, 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, - 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x05, 0x69, - 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x63, 0x6f, 0x6e, + 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6f, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x14, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 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, 0x73, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x71, 0x0a, 0x1c, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x22, 0x71, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, - 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x22, 0x84, 0x01, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, + 0x84, 0x01, 0x0a, 0x1d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xbf, 0x01, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xbf, 0x01, 0x0a, 0x1c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x51, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 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, 0x72, 0x0a, 0x1d, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x22, 0x2e, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x1f, 0x0a, 0x1d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xc9, 0x08, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xd1, 0x01, 0x0a, - 0x12, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 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, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x4c, 0x92, 0x41, 0x21, 0x12, 0x1f, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, - 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x1a, - 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x12, 0xc9, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x37, 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, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x92, 0x41, - 0x1e, 0x12, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0xde, 0x01, 0x0a, - 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x38, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x74, 0x6f, 0x72, 0x65, 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, 0x72, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2e, 0x0a, 0x1c, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1f, 0x0a, 0x1d, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc9, 0x08, + 0x0a, 0x16, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xd1, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, + 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x39, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x50, 0x92, 0x41, 0x24, - 0x12, 0x22, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, + 0x92, 0x41, 0x21, 0x12, 0x1f, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, + 0x6f, 0x72, 0x65, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xdc, 0x01, - 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x39, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4e, 0x92, 0x41, - 0x1d, 0x12, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x28, 0x32, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xce, 0x01, 0x0a, - 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x39, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x92, 0x41, 0x1b, - 0x12, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1c, 0x2a, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 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, + 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xc9, 0x01, 0x0a, + 0x14, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, + 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x37, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, + 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, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x92, 0x41, 0x1e, 0x12, 0x1c, 0x4c, + 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x12, 0xde, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0x12, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 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, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x50, 0x92, 0x41, 0x24, 0x12, 0x22, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3a, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xdc, 0x01, 0x0a, 0x15, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x12, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4e, 0x92, 0x41, 0x1d, 0x12, 0x1b, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, + 0x32, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, + 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xce, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0x12, 0x38, 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, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 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, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x92, 0x41, 0x1b, 0x12, 0x19, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, 0x2f, + 0x76, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0x5b, 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, 0x0a, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto b/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto index 5daf5c93b..2d34f1562 100644 --- a/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto +++ b/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; @@ -40,8 +41,18 @@ message CredentialStore { // The Credential Store type. string type = 90; - // The attributes that are applicable for the specific Credential Store type. - google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific Credential Store type. + google.protobuf.Struct attributes = 100 [ + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "default" + ]; + VaultCredentialStoreAttributes vault_credential_store_attributes = 101 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "vault" + ]; + } // Output only. The available actions on this resource for this user. repeated string authorized_actions = 300 [json_name = "authorized_actions"]; diff --git a/internal/proto/controller/api/services/v1/credential_store_service.proto b/internal/proto/controller/api/services/v1/credential_store_service.proto index 755b92d26..f1866b9e4 100644 --- a/internal/proto/controller/api/services/v1/credential_store_service.proto +++ b/internal/proto/controller/api/services/v1/credential_store_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/credentialstores/v1/credential_store.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "credential"; service CredentialStoreService { // GetCredentialStore returns a stored Credential Store if present. The provided request diff --git a/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go b/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go index d442926e7..ab46f68f5 100644 --- a/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go +++ b/internal/servers/controller/handlers/credentiallibraries/credentiallibrary_service.go @@ -142,7 +142,11 @@ func (s Service) ListCredentialLibraries(ctx context.Context, req *pbs.ListCrede return nil, err } - if filter.Match(item) { + filterable, err := subtypes.Filterable(item) + if err != nil { + return nil, err + } + if filter.Match(filterable) { finalItems = append(finalItems, item) } } diff --git a/internal/servers/controller/handlers/credentialstores/credentialstore_service.go b/internal/servers/controller/handlers/credentialstores/credentialstore_service.go index ac08072d7..8f97b943d 100644 --- a/internal/servers/controller/handlers/credentialstores/credentialstore_service.go +++ b/internal/servers/controller/handlers/credentialstores/credentialstore_service.go @@ -167,7 +167,11 @@ func (s Service) ListCredentialStores(ctx context.Context, req *pbs.ListCredenti return nil, err } - if filter.Match(item) { + filterable, err := subtypes.Filterable(item) + if err != nil { + return nil, err + } + if filter.Match(filterable) { finalItems = append(finalItems, item) } } @@ -538,9 +542,8 @@ func toProto(in credential.Store, opt ...handlers.Option) (*pb.CredentialStore, attrs.ClientCertificateKeyHmac = base64.RawURLEncoding.EncodeToString(cc.GetCertificateKeyHmac()) } - var err error - if out.Attributes, err = handlers.ProtoToStruct(attrs); err != nil { - return nil, errors.WrapDeprecated(err, op) + out.Attrs = &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: attrs, } } } @@ -557,10 +560,7 @@ func toStorageVaultStore(scopeId string, in *pb.CredentialStore) (out *vault.Cre opts = append(opts, vault.WithDescription(in.GetDescription().GetValue())) } - attrs := &pb.VaultCredentialStoreAttributes{} - if err := handlers.StructToProto(in.GetAttributes(), attrs); err != nil { - return nil, errors.WrapDeprecated(err, op, errors.WithMsg("unable to parse the attributes")) - } + attrs := in.GetVaultCredentialStoreAttributes() if attrs.GetTlsServerName() != nil { opts = append(opts, vault.WithTlsServerName(attrs.GetTlsServerName().GetValue())) } @@ -620,11 +620,11 @@ func validateCreateRequest(req *pbs.CreateCredentialStoreRequest) error { } switch subtypes.SubtypeFromType(domain, req.GetItem().GetType()) { case vault.Subtype: - attrs := &pb.VaultCredentialStoreAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = fmt.Sprintf("Attribute fields do not match the expected format. Got %#v", req.GetItem().GetAttributes().AsMap()) - break + attrs := req.GetItem().GetVaultCredentialStoreAttributes() + if attrs == nil { + badFields[globals.AttributesField] = "Attributes are required for creating a vault credential store" } + if attrs.GetAddress().GetValue() == "" { badFields[addressField] = "Field required for creating a vault credential store." } @@ -666,32 +666,30 @@ func validateUpdateRequest(req *pbs.UpdateCredentialStoreRequest) error { if req.GetItem().GetType() != "" && subtypes.SubtypeFromType(domain, req.GetItem().GetType()) != vault.Subtype { badFields["type"] = "Cannot modify resource type." } - attrs := &pb.VaultCredentialStoreAttributes{} - if err := handlers.StructToProto(req.GetItem().GetAttributes(), attrs); err != nil { - badFields[globals.AttributesField] = "Attribute fields do not match the expected format." - break - } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), addressField) && - attrs.GetAddress().GetValue() == "" { - badFields[addressField] = "This is a required field and cannot be unset." - } - if handlers.MaskContains(req.GetUpdateMask().GetPaths(), vaultTokenField) && - attrs.GetToken().GetValue() == "" { - badFields[vaultTokenField] = "This is a required field and cannot be unset." - } - if attrs.GetTokenHmac() != "" { - badFields[vaultTokenHmacField] = "This is a read only field." - } + attrs := req.GetItem().GetVaultCredentialStoreAttributes() + if attrs != nil { + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), addressField) && + attrs.GetAddress().GetValue() == "" { + badFields[addressField] = "This is a required field and cannot be unset." + } + if handlers.MaskContains(req.GetUpdateMask().GetPaths(), vaultTokenField) && + attrs.GetToken().GetValue() == "" { + badFields[vaultTokenField] = "This is a required field and cannot be unset." + } + if attrs.GetTokenHmac() != "" { + badFields[vaultTokenHmacField] = "This is a read only field." + } - // TODO(ICU-1478 and ICU-1479): Validate client and CA certificate payloads - _, err := decodePemBlocks(attrs.GetCaCert().GetValue()) - if attrs.GetCaCert() != nil && err != nil { - badFields[caCertsField] = "Incorrectly formatted value." - } + // TODO(ICU-1478 and ICU-1479): Validate client and CA certificate payloads + _, err := decodePemBlocks(attrs.GetCaCert().GetValue()) + if attrs.GetCaCert() != nil && err != nil { + badFields[caCertsField] = "Incorrectly formatted value." + } - _, _, err = extractClientCertAndPk(attrs.GetClientCertificate().GetValue(), attrs.GetClientCertificateKey().GetValue()) - if err != nil { - badFields[clientCertField] = fmt.Sprintf("Invalid values: %q", err.Error()) + _, _, err = extractClientCertAndPk(attrs.GetClientCertificate().GetValue(), attrs.GetClientCertificateKey().GetValue()) + if err != nil { + badFields[clientCertField] = fmt.Sprintf("Invalid values: %q", err.Error()) + } } } return badFields diff --git a/internal/servers/controller/handlers/credentialstores/credentialstore_service_test.go b/internal/servers/controller/handlers/credentialstores/credentialstore_service_test.go index bd6508304..babd0524a 100644 --- a/internal/servers/controller/handlers/credentialstores/credentialstore_service_test.go +++ b/internal/servers/controller/handlers/credentialstores/credentialstore_service_test.go @@ -79,45 +79,54 @@ func TestList(t *testing.T) { Type: vault.Subtype.String(), AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: testAuthorizedCollectionActions, - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(s.GetVaultAddress()), TokenHmac: base64.RawURLEncoding.EncodeToString(s.Token().GetTokenHmac()), ClientCertificate: wrapperspb.String(string(s.ClientCertificate().GetCertificate())), ClientCertificateKeyHmac: base64.RawURLEncoding.EncodeToString(s.ClientCertificate().GetCertificateKeyHmac()), // TODO: Add all fields including tls related fields, namespace, etc... - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }) } cases := []struct { - name string - req *pbs.ListCredentialStoresRequest - res *pbs.ListCredentialStoresResponse - err error + name string + req *pbs.ListCredentialStoresRequest + res *pbs.ListCredentialStoresResponse + anonRes *pbs.ListCredentialStoresResponse + err error }{ { - name: "List Many Stores", - req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId()}, - res: &pbs.ListCredentialStoresResponse{Items: wantStores}, + name: "List Many Stores", + req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId()}, + res: &pbs.ListCredentialStoresResponse{Items: wantStores}, + anonRes: &pbs.ListCredentialStoresResponse{Items: wantStores}, }, { - name: "List No Stores", - req: &pbs.ListCredentialStoresRequest{ScopeId: prjNoStores.GetPublicId()}, - res: &pbs.ListCredentialStoresResponse{}, + name: "List No Stores", + req: &pbs.ListCredentialStoresRequest{ScopeId: prjNoStores.GetPublicId()}, + res: &pbs.ListCredentialStoresResponse{}, + anonRes: &pbs.ListCredentialStoresResponse{}, }, { - name: "Filter to One Store", - req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId(), Filter: fmt.Sprintf(`"/item/id"==%q`, wantStores[1].GetId())}, - res: &pbs.ListCredentialStoresResponse{Items: wantStores[1:2]}, + name: "Filter to One Store", + req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId(), Filter: fmt.Sprintf(`"/item/id"==%q`, wantStores[1].GetId())}, + res: &pbs.ListCredentialStoresResponse{Items: wantStores[1:2]}, + anonRes: &pbs.ListCredentialStoresResponse{Items: wantStores[1:2]}, }, { - name: "Filter to No Store", - req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId(), Filter: `"/item/id"=="doesnt match"`}, - res: &pbs.ListCredentialStoresResponse{}, + name: "Filter on Attribute", + req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId(), Filter: fmt.Sprintf(`"/item/attributes/address"==%q`, wantStores[2].GetVaultCredentialStoreAttributes().GetAddress().Value)}, + res: &pbs.ListCredentialStoresResponse{Items: wantStores[2:3]}, + anonRes: &pbs.ListCredentialStoresResponse{}, // anonymous user does not have access to attributes + }, + { + name: "Filter to No Store", + req: &pbs.ListCredentialStoresRequest{ScopeId: prj.GetPublicId(), Filter: `"/item/id"=="doesnt match"`}, + res: &pbs.ListCredentialStoresResponse{}, + anonRes: &pbs.ListCredentialStoresResponse{}, }, { name: "Filter Bad Format", @@ -138,12 +147,14 @@ func TestList(t *testing.T) { return } require.NoError(t, gErr) - assert.ElementsMatch(t, got.Items, tc.res.Items) + assert.Empty(t, cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.SortRepeated(func(x, y *pb.CredentialStore) bool { + return x.Id < y.Id + }))) // Test anonymous listing got, gErr = s.ListCredentialStores(auth.DisabledAuthTestContext(iamRepoFn, tc.req.GetScopeId(), auth.WithUserId(auth.AnonymousUserId)), tc.req) require.NoError(t, gErr) - assert.Len(t, got.Items, len(tc.res.Items)) + assert.Len(t, got.Items, len(tc.anonRes.Items)) for _, item := range got.GetItems() { require.Nil(t, item.CreatedTime) require.Nil(t, item.UpdatedTime) @@ -202,16 +213,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), ClientCertificate: wrapperspb.String(string(v.ClientCert)), ClientCertificateKey: wrapperspb.String(string(v.ClientKey)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", wantErr: true, @@ -221,17 +230,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String("madeup"), CaCert: wrapperspb.String(string(v.CaCert)), ClientCertificate: wrapperspb.String(string(v.ClientCert)), ClientCertificateKey: wrapperspb.String(string(v.ClientKey)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", wantErr: true, @@ -241,16 +248,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), CaCert: wrapperspb.String(string(v.CaCert)), ClientCertificate: wrapperspb.String(string(v.ClientCert)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -260,16 +265,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), CaCert: wrapperspb.String(string(v.CaCert)), ClientCertificateKey: wrapperspb.String(string(v.ClientKey)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -279,17 +282,15 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), CaCert: wrapperspb.String(string(v.CaCert)), ClientCertificateKey: wrapperspb.String(string(append(v.ClientCert, v.ClientKey...))), ClientCertificate: wrapperspb.String(string(v.ClientKey)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -300,14 +301,12 @@ func TestCreate(t *testing.T) { ScopeId: prj.GetPublicId(), Id: vault.CredentialStorePrefix + "_notallowed", Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -318,14 +317,12 @@ func TestCreate(t *testing.T) { ScopeId: prj.GetPublicId(), CreatedTime: timestamppb.Now(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -336,14 +333,12 @@ func TestCreate(t *testing.T) { ScopeId: prj.GetPublicId(), UpdatedTime: timestamppb.Now(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -354,14 +349,12 @@ func TestCreate(t *testing.T) { ScopeId: prj.GetPublicId(), UpdatedTime: timestamppb.Now(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -370,14 +363,12 @@ func TestCreate(t *testing.T) { name: "Must specify type", req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -387,13 +378,11 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -403,31 +392,11 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), - }) - require.NoError(t, err) - return attrs - }(), - }}, - res: nil, - err: handlers.ApiErrorWithCode(codes.InvalidArgument), - }, - { - name: "Attributes must be valid for vault type", - req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ - ScopeId: prj.GetPublicId(), - Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ - Address: wrapperspb.String(v.Addr), - Token: wrapperspb.String(newToken()), - }) - require.NoError(t, err) - attrs.Fields["invalid"] = structpb.NewStringValue("foo") - return attrs - }(), + }, + }, }}, res: nil, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -437,16 +406,14 @@ func TestCreate(t *testing.T) { req: &pbs.CreateCredentialStoreRequest{Item: &pb.CredentialStore{ ScopeId: prj.GetPublicId(), Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), CaCert: wrapperspb.String(string(v.CaCert)), ClientCertificate: wrapperspb.String(string(v.ClientCert) + string(v.ClientKey)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", res: &pbs.CreateCredentialStoreResponse{ @@ -456,17 +423,15 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ CaCert: wrapperspb.String(string(v.CaCert)), Address: wrapperspb.String(v.Addr), TokenHmac: "", ClientCertificate: wrapperspb.String(string(v.ClientCert)), ClientCertificateKeyHmac: "", - }) - require.NoError(t, err) - return attrs - }(), + }, + }, AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: testAuthorizedCollectionActions, }, @@ -479,17 +444,15 @@ func TestCreate(t *testing.T) { Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "desc"}, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v.Addr), Token: wrapperspb.String(newToken()), CaCert: wrapperspb.String(string(v.CaCert)), ClientCertificate: wrapperspb.String(string(v.ClientCert)), ClientCertificateKey: wrapperspb.String(string(v.ClientKey)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }}, idPrefix: vault.CredentialStorePrefix + "_", res: &pbs.CreateCredentialStoreResponse{ @@ -501,17 +464,15 @@ func TestCreate(t *testing.T) { Scope: &scopepb.ScopeInfo{Id: prj.GetPublicId(), Type: prj.GetType(), ParentScopeId: prj.GetParentId()}, Version: 1, Type: vault.Subtype.String(), - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ CaCert: wrapperspb.String(string(v.CaCert)), Address: wrapperspb.String(v.Addr), TokenHmac: "", ClientCertificate: wrapperspb.String(string(v.ClientCert)), ClientCertificateKeyHmac: "", - }) - require.NoError(t, err) - return attrs - }(), + }, + }, AuthorizedActions: testAuthorizedActions, AuthorizedCollectionActions: testAuthorizedCollectionActions, }, @@ -538,30 +499,36 @@ func TestCreate(t *testing.T) { if tc.res == nil { require.Nil(got) } + cmpOptions := []cmp.Option{ + protocmp.Transform(), + protocmp.SortRepeatedFields(got), + } if got != nil { assert.Contains(got.GetUri(), tc.res.Uri) + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pbs.CreateCredentialStoreResponse{}, "uri")) + assert.True(strings.HasPrefix(got.GetItem().GetId(), tc.idPrefix)) + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pb.CredentialStore{}, "id")) + gotCreateTime := got.GetItem().GetCreatedTime() gotUpdateTime := got.GetItem().GetUpdatedTime() // Verify it is a credential store created after the test setup's default credential store assert.True(gotCreateTime.AsTime().After(defaultCreated.AsTime()), "New credential store should have been created after default credential store. Was created %v, which is after %v", gotCreateTime, defaultCreated) assert.True(gotUpdateTime.AsTime().After(defaultCreated.AsTime()), "New credential store should have been updated after default credential store. Was updated %v, which is after %v", gotUpdateTime, defaultCreated) + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pb.CredentialStore{}, "created_time")) + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pb.CredentialStore{}, "updated_time")) - // Clear all values which are hard to compare against. - got.Uri, tc.res.Uri = "", "" - got.Item.Id, tc.res.Item.Id = "", "" - got.Item.CreatedTime, got.Item.UpdatedTime, tc.res.Item.CreatedTime, tc.res.Item.UpdatedTime = nil, nil, nil, nil - if _, ok := got.Item.Attributes.Fields["token_hmac"]; ok { - assert.NotEqual(tc.req.Item.Attributes.Fields["token"], got.Item.Attributes.Fields["token_hmac"]) - got.Item.Attributes.Fields["token_hmac"] = structpb.NewStringValue("") + if got.Item.GetVaultCredentialStoreAttributes().TokenHmac != "" { + assert.NotEqual(tc.req.Item.GetVaultCredentialStoreAttributes().Token, got.Item.GetVaultCredentialStoreAttributes().TokenHmac) + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pb.VaultCredentialStoreAttributes{}, "token_hmac")) } - if _, ok := got.Item.Attributes.Fields["client_certificate_key_hmac"]; ok { - assert.NotEqual(tc.req.Item.Attributes.Fields["client_certificate_key_hmac"], got.Item.Attributes.Fields["client_certificate_key_hmac"]) - got.Item.Attributes.Fields["client_certificate_key_hmac"] = structpb.NewStringValue("") + if got.Item.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac != "" { + assert.NotEqual(tc.req.Item.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac, got.Item.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac) + cmpOptions = append(cmpOptions, protocmp.IgnoreFields(&pb.VaultCredentialStoreAttributes{}, "client_certificate_key_hmac")) } } - assert.Empty(cmp.Diff(got, tc.res, protocmp.Transform(), protocmp.SortRepeatedFields(got)), "CreateCredentialStore(%q) got response %q, wanted %q", tc.req, got, tc.res) + assert.Empty(cmp.Diff(got, tc.res, cmpOptions...), "CreateCredentialStore(%q) got response %q, wanted %q", tc.req, got, tc.res) }) } } @@ -607,16 +574,14 @@ func TestGet(t *testing.T) { CreatedTime: store.CreateTime.GetTimestamp(), UpdatedTime: store.UpdateTime.GetTimestamp(), Version: 1, - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(store.GetVaultAddress()), TokenHmac: base64.RawURLEncoding.EncodeToString(store.Token().GetTokenHmac()), ClientCertificate: wrapperspb.String(string(store.ClientCertificate().GetCertificate())), ClientCertificateKeyHmac: base64.RawURLEncoding.EncodeToString(store.ClientCertificate().GetCertificateKeyHmac()), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, }, @@ -794,26 +759,24 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.address", "attributes.client_certificate", "attributes.client_certificate_key", "attributes.ca_cert", "attributes.token"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Address: wrapperspb.String(v2.Addr), Token: wrapperspb.String(token2), ClientCertificate: wrapperspb.String(string(clientCert2.Certificate)), ClientCertificateKey: wrapperspb.String(string(clientCert2.CertificateKey)), CaCert: wrapperspb.String(string(v2.CaCert)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["address"] = structpb.NewStringValue(v2.Addr) - out.Attributes.Fields["client_certificate"] = structpb.NewStringValue(string(clientCert2.Certificate)) - out.Attributes.Fields["ca_cert"] = structpb.NewStringValue(string(v2.CaCert)) - out.Attributes.Fields["token_hmac"] = structpb.NewStringValue("") - out.Attributes.Fields["client_certificate_key_hmac"] = structpb.NewStringValue("") + out.GetVaultCredentialStoreAttributes().Address = wrapperspb.String(v2.Addr) + out.GetVaultCredentialStoreAttributes().ClientCertificate = wrapperspb.String(string(clientCert2.Certificate)) + out.GetVaultCredentialStoreAttributes().CaCert = wrapperspb.String(string(v2.CaCert)) + out.GetVaultCredentialStoreAttributes().TokenHmac = "" + out.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac = "" return out }, }, @@ -822,18 +785,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.token"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Token: wrapperspb.String(token1b), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["token_hmac"] = structpb.NewStringValue("") + out.GetVaultCredentialStoreAttributes().TokenHmac = "" return out }, }, @@ -845,8 +806,8 @@ func TestUpdate(t *testing.T) { }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - delete(out.Attributes.Fields, "client_certificate") - delete(out.Attributes.Fields, "client_certificate_key_hmac") + out.GetVaultCredentialStoreAttributes().ClientCertificate = nil + out.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac = "" return out }, }, @@ -855,18 +816,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.namespace"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Namespace: wrapperspb.String("update namespace"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["namespace"] = structpb.NewStringValue("update namespace") + out.GetVaultCredentialStoreAttributes().Namespace = wrapperspb.String("update namespace") return out }, }, @@ -875,18 +834,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.tls_server_name"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ TlsServerName: wrapperspb.String("UpdateTlsServerName"), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["tls_server_name"] = structpb.NewStringValue("UpdateTlsServerName") + out.GetVaultCredentialStoreAttributes().TlsServerName = wrapperspb.String("UpdateTlsServerName") return out }, }, @@ -895,18 +852,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.tls_skip_verify"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ TlsSkipVerify: wrapperspb.Bool(true), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["tls_skip_verify"] = structpb.NewBoolValue(true) + out.GetVaultCredentialStoreAttributes().TlsSkipVerify = wrapperspb.Bool(true) return out }, }, @@ -915,18 +870,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.ca_cert"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ CaCert: wrapperspb.String(string(v2.CaCert)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["ca_cert"] = structpb.NewStringValue(string(v2.CaCert)) + out.GetVaultCredentialStoreAttributes().CaCert = wrapperspb.String(string(v2.CaCert)) return out }, }, @@ -935,18 +888,16 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateCredentialStoreRequest{ UpdateMask: fieldmask("attributes.client_certificate"), Item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ ClientCertificate: wrapperspb.String(string(v2.ClientCert)), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, }, res: func(in *pb.CredentialStore) *pb.CredentialStore { out := proto.Clone(in).(*pb.CredentialStore) - out.Attributes.Fields["client_certificate"] = structpb.NewStringValue(string(v2.ClientCert)) + out.GetVaultCredentialStoreAttributes().ClientCertificate = wrapperspb.String(string(v2.ClientCert)) return out }, }, @@ -981,11 +932,11 @@ func TestUpdate(t *testing.T) { assert.EqualValues(2, got.Item.Version) want.Item.Version = 2 - if v, ok := want.Item.GetAttributes().AsMap()["token_hmac"]; ok && v.(string) == "" { - got.Item.Attributes.Fields["token_hmac"] = structpb.NewStringValue("") + if want.Item.GetVaultCredentialStoreAttributes().TokenHmac == "" { + got.Item.GetVaultCredentialStoreAttributes().TokenHmac = "" } - if v, ok := want.Item.GetAttributes().AsMap()["client_certificate_key_hmac"]; ok && v.(string) == "" { - got.Item.Attributes.Fields["client_certificate_key_hmac"] = structpb.NewStringValue("") + if want.Item.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac == "" { + got.Item.GetVaultCredentialStoreAttributes().ClientCertificateKeyHmac = "" } assert.Empty(cmp.Diff(got, want, protocmp.Transform())) @@ -1026,13 +977,11 @@ func TestUpdate(t *testing.T) { // updating the token. path: "attributes.token", item: &pb.CredentialStore{ - Attributes: func() *structpb.Struct { - attrs, err := handlers.ProtoToStruct(&pb.VaultCredentialStoreAttributes{ + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ Token: wrapperspb.String(token2), - }) - require.NoError(t, err) - return attrs - }(), + }, + }, }, matcher: func(t *testing.T, err error) { assert.Containsf(t, err.Error(), "cannot lookup token for updated store", "got error %v, wanted 'unable to lookup token'", err) diff --git a/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go b/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go index 17c2a33c5..ccff18914 100644 --- a/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go +++ b/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go @@ -9,6 +9,7 @@ package credentialstores import ( 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" @@ -50,8 +51,10 @@ type CredentialStore struct { Version uint32 `protobuf:"varint,80,opt,name=version,proto3" json:"version,omitempty"` // The Credential Store type. Type string `protobuf:"bytes,90,opt,name=type,proto3" json:"type,omitempty"` - // The attributes that are applicable for the specific Credential Store type. - Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *CredentialStore_Attributes + // *CredentialStore_VaultCredentialStoreAttributes + Attrs isCredentialStore_Attrs `protobuf_oneof:"attrs"` // 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"` // Output only. The authorized actions for the scope's collections. @@ -153,13 +156,27 @@ func (x *CredentialStore) GetType() string { return "" } +func (m *CredentialStore) GetAttrs() isCredentialStore_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *CredentialStore) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*CredentialStore_Attributes); ok { return x.Attributes } return nil } +func (x *CredentialStore) GetVaultCredentialStoreAttributes() *VaultCredentialStoreAttributes { + if x, ok := x.GetAttrs().(*CredentialStore_VaultCredentialStoreAttributes); ok { + return x.VaultCredentialStoreAttributes + } + return nil +} + func (x *CredentialStore) GetAuthorizedActions() []string { if x != nil { return x.AuthorizedActions @@ -174,6 +191,23 @@ func (x *CredentialStore) GetAuthorizedCollectionActions() map[string]*structpb. return nil } +type isCredentialStore_Attrs interface { + isCredentialStore_Attrs() +} + +type CredentialStore_Attributes struct { + // The attributes that are applicable for the specific Credential Store type. + Attributes *structpb.Struct `protobuf:"bytes,100,opt,name=attributes,proto3,oneof"` +} + +type CredentialStore_VaultCredentialStoreAttributes struct { + VaultCredentialStoreAttributes *VaultCredentialStoreAttributes `protobuf:"bytes,101,opt,name=vault_credential_store_attributes,json=vaultCredentialStoreAttributes,proto3,oneof"` +} + +func (*CredentialStore_Attributes) isCredentialStore_Attrs() {} + +func (*CredentialStore_VaultCredentialStoreAttributes) isCredentialStore_Attrs() {} + // The attributes of a vault typed Credential Store. type VaultCredentialStoreAttributes struct { state protoimpl.MessageState @@ -323,139 +357,154 @@ var file_controller_api_resources_credentialstores_v1_credential_store_proto_raw 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, - 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe0, - 0x06, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, - 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, - 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, - 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x04, 0x4e, 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, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, - 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, + 0x74, 0x6f, 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, + 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, 0xb1, 0x08, 0x0a, 0x0f, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, + 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x04, 0x4e, 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, 0x44, 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, 0x4a, 0x0a, 0x0a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 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, 0xb8, 0x01, 0x0a, 0x21, 0x76, 0x61, 0x75, 0x6c, 0x74, + 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x65, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x4c, 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, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, + 0x42, 0x1d, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x05, 0x76, 0x61, 0x75, 0x6c, 0x74, 0xfa, + 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, + 0x00, 0x52, 0x1e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xa5, 0x01, - 0x0a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, - 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0xb6, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x5e, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, - 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, - 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x93, 0x08, 0x0a, 0x1e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x62, 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, 0x2a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x22, 0x0a, 0x12, 0x61, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x0c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x65, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x14, 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, 0x29, 0xa0, 0xda, 0x29, 0x01, 0xc2, - 0xdd, 0x29, 0x21, 0x0a, 0x14, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, - 0x5c, 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x1e, 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, 0x24, - 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1c, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x12, 0x06, 0x43, 0x61, - 0x43, 0x65, 0x72, 0x74, 0x52, 0x07, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x12, 0x7b, 0x0a, - 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 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, 0x33, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2b, 0x0a, 0x1a, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x74, 0x6c, 0x73, 0x5f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0d, 0x54, 0x6c, 0x73, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x79, 0x0a, 0x0f, 0x74, 0x6c, - 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x32, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x33, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2b, 0x0a, 0x1a, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, - 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x0d, 0x54, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, - 0x72, 0x69, 0x66, 0x79, 0x52, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, - 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x55, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x3c, + 0x6e, 0x73, 0x12, 0xa5, 0x01, 0x0a, 0x1d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xb6, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x5e, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x1d, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x6a, 0x0a, 0x20, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x22, + 0x93, 0x08, 0x0a, 0x1e, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x12, 0x62, 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, 0x2a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x22, 0x0a, 0x12, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x0c, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x65, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x18, 0x14, 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, 0x29, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, + 0x21, 0x0a, 0x14, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x09, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x5c, 0x0a, + 0x07, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x18, 0x1e, 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, 0x24, 0xa0, 0xda, + 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1c, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x2e, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x12, 0x06, 0x43, 0x61, 0x43, 0x65, + 0x72, 0x74, 0x52, 0x07, 0x63, 0x61, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x12, 0x7b, 0x0a, 0x0f, 0x74, + 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 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, 0x21, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x19, 0x0a, 0x10, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x05, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x12, 0x82, 0x01, 0x0a, - 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x18, 0x50, 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, 0x34, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, - 0x2c, 0x0a, 0x1d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, - 0x12, 0x0b, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x12, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x12, 0x91, 0x01, 0x0a, 0x16, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, - 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x5a, 0x20, 0x01, + 0x75, 0x65, 0x42, 0x33, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2b, 0x0a, 0x1a, 0x61, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0d, 0x54, 0x6c, 0x73, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x79, 0x0a, 0x0f, 0x74, 0x6c, 0x73, 0x5f, + 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x32, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x33, 0xa0, + 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2b, 0x0a, 0x1a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x2e, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x12, 0x0d, 0x54, 0x6c, 0x73, 0x53, 0x6b, 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x52, 0x0f, 0x74, 0x6c, 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x12, 0x55, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x3c, 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, 0x3b, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x33, 0x0a, 0x21, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, - 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x0e, 0x43, - 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x16, 0x63, + 0x42, 0x21, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x19, 0x0a, 0x10, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x05, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x12, 0x82, 0x01, 0x0a, 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x1b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, - 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, - 0x68, 0x6d, 0x61, 0x63, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, - 0x65, 0x79, 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x42, 0x62, 0x5a, 0x60, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3b, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x65, 0x18, 0x50, 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, 0x34, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x2c, 0x0a, + 0x1d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x0b, + 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x12, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, + 0x91, 0x01, 0x0a, 0x16, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x5a, 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, 0x3b, + 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x33, 0x0a, 0x21, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, + 0x75, 0x74, 0x65, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x0e, 0x43, 0x65, 0x72, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x16, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, + 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x1b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x65, + 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x68, 0x6d, + 0x61, 0x63, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, + 0x5f, 0x68, 0x6d, 0x61, 0x63, 0x42, 0x62, 0x5a, 0x60, 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, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x3b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -489,21 +538,22 @@ var file_controller_api_resources_credentialstores_v1_credential_store_proto_dep 5, // 3: controller.api.resources.credentialstores.v1.CredentialStore.created_time:type_name -> google.protobuf.Timestamp 5, // 4: controller.api.resources.credentialstores.v1.CredentialStore.updated_time:type_name -> google.protobuf.Timestamp 6, // 5: controller.api.resources.credentialstores.v1.CredentialStore.attributes:type_name -> google.protobuf.Struct - 2, // 6: controller.api.resources.credentialstores.v1.CredentialStore.authorized_collection_actions:type_name -> controller.api.resources.credentialstores.v1.CredentialStore.AuthorizedCollectionActionsEntry - 4, // 7: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.address:type_name -> google.protobuf.StringValue - 4, // 8: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.namespace:type_name -> google.protobuf.StringValue - 4, // 9: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.ca_cert:type_name -> google.protobuf.StringValue - 4, // 10: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.tls_server_name:type_name -> google.protobuf.StringValue - 7, // 11: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.tls_skip_verify:type_name -> google.protobuf.BoolValue - 4, // 12: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.token:type_name -> google.protobuf.StringValue - 4, // 13: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.client_certificate:type_name -> google.protobuf.StringValue - 4, // 14: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.client_certificate_key:type_name -> google.protobuf.StringValue - 8, // 15: controller.api.resources.credentialstores.v1.CredentialStore.AuthorizedCollectionActionsEntry.value:type_name -> google.protobuf.ListValue - 16, // [16:16] is the sub-list for method output_type - 16, // [16:16] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name + 1, // 6: controller.api.resources.credentialstores.v1.CredentialStore.vault_credential_store_attributes:type_name -> controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes + 2, // 7: controller.api.resources.credentialstores.v1.CredentialStore.authorized_collection_actions:type_name -> controller.api.resources.credentialstores.v1.CredentialStore.AuthorizedCollectionActionsEntry + 4, // 8: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.address:type_name -> google.protobuf.StringValue + 4, // 9: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.namespace:type_name -> google.protobuf.StringValue + 4, // 10: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.ca_cert:type_name -> google.protobuf.StringValue + 4, // 11: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.tls_server_name:type_name -> google.protobuf.StringValue + 7, // 12: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.tls_skip_verify:type_name -> google.protobuf.BoolValue + 4, // 13: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.token:type_name -> google.protobuf.StringValue + 4, // 14: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.client_certificate:type_name -> google.protobuf.StringValue + 4, // 15: controller.api.resources.credentialstores.v1.VaultCredentialStoreAttributes.client_certificate_key:type_name -> google.protobuf.StringValue + 8, // 16: controller.api.resources.credentialstores.v1.CredentialStore.AuthorizedCollectionActionsEntry.value:type_name -> google.protobuf.ListValue + 17, // [17:17] is the sub-list for method output_type + 17, // [17:17] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name } func init() { file_controller_api_resources_credentialstores_v1_credential_store_proto_init() } @@ -537,6 +587,10 @@ func file_controller_api_resources_credentialstores_v1_credential_store_proto_in } } } + file_controller_api_resources_credentialstores_v1_credential_store_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*CredentialStore_Attributes)(nil), + (*CredentialStore_VaultCredentialStoreAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ From 6ad9aba50570c5e1e819c3e956f5f48e2987b5bd Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 7 Apr 2022 15:24:31 -0400 Subject: [PATCH 37/45] feat(credentialstore): Classify resources for audit events --- Makefile | 2 + .../services/credential_store_service.pb.go | 14 +- .../v1/credential_store.proto | 40 +-- .../v1/credential_store_service.proto | 14 +- .../credentialstores_classification_test.go | 227 ++++++++++++++++++ .../credentialstores/credential_store.pb.go | 40 +-- .../credential_store_taggable.go | 20 ++ 7 files changed, 303 insertions(+), 54 deletions(-) create mode 100644 internal/tests/api/credentialstores/credentialstores_classification_test.go create mode 100644 sdk/pbs/controller/api/resources/credentialstores/credential_store_taggable.go diff --git a/Makefile b/Makefile index 64c262fb3..970fbf920 100644 --- a/Makefile +++ b/Makefile @@ -171,6 +171,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/managed_group_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/groups/group.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/group_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_store_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_library_service.pb.go diff --git a/internal/gen/controller/api/services/credential_store_service.pb.go b/internal/gen/controller/api/services/credential_store_service.pb.go index 27e147144..aaa01ef48 100644 --- a/internal/gen/controller/api/services/credential_store_service.pb.go +++ b/internal/gen/controller/api/services/credential_store_service.pb.go @@ -30,7 +30,7 @@ type GetCredentialStoreRequest 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 *GetCredentialStoreRequest) Reset() { @@ -124,9 +124,9 @@ type ListCredentialStoresRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListCredentialStoresRequest) Reset() { @@ -281,7 +281,7 @@ type CreateCredentialStoreResponse 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 *credentialstores.CredentialStore `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -336,7 +336,7 @@ type UpdateCredentialStoreRequest 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 *credentialstores.CredentialStore `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"` } @@ -446,7 +446,7 @@ type DeleteCredentialStoreRequest 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 *DeleteCredentialStoreRequest) Reset() { diff --git a/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto b/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto index 2d34f1562..17a708929 100644 --- a/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto +++ b/internal/proto/controller/api/resources/credentialstores/v1/credential_store.proto @@ -14,32 +14,32 @@ import "controller/custom_options/v1/options.proto"; // CredentialStore contains all fields related to an Credential Store resource message CredentialStore { // Output only. The ID of the Credential Store. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The ID of the Scope of which this Credential Store is a part. - string scope_id = 20 [json_name = "scope_id"]; + string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this Credential Store. resources.scopes.v1.ScopeInfo scope = 30; // 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 Credential Store type. - string type = 90; + string type = 90; // @gotags: `class:"public"` oneof attrs { // The attributes that are applicable for the specific Credential Store type. @@ -55,44 +55,44 @@ message CredentialStore { } // 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"` // Output only. The authorized actions for the scope's collections. - map authorized_collection_actions = 310 [json_name = "authorized_collection_actions"]; + map authorized_collection_actions = 310 [json_name = "authorized_collection_actions"]; // classified as public via taggable implementation } // The attributes of a vault typed Credential Store. message VaultCredentialStoreAttributes { // The complete url address of vault. - google.protobuf.StringValue address = 10 [json_name = "address", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.address" that: "VaultAddress" }]; + google.protobuf.StringValue address = 10 [json_name = "address", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.address" that: "VaultAddress" }]; // @gotags: `class:"public"` // The namespace of vault used by this store - google.protobuf.StringValue namespace = 20 [json_name = "namespace", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.namespace" that: "Namespace" }]; + google.protobuf.StringValue namespace = 20 [json_name = "namespace", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.namespace" that: "Namespace" }]; // @gotags: `class:"public"` // The PEM encoded CA cert to verify the vault server's ssl certificate - google.protobuf.StringValue ca_cert = 30 [json_name = "ca_cert", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.ca_cert" that: "CaCert" }]; + google.protobuf.StringValue ca_cert = 30 [json_name = "ca_cert", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.ca_cert" that: "CaCert" }]; // @gotags: `class:"public"` // The value to use as the SNI host when connecting to vault via TLS. - google.protobuf.StringValue tls_server_name = 40 [json_name = "tls_server_name", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.tls_server_name" that: "TlsServerName" }]; + google.protobuf.StringValue tls_server_name = 40 [json_name = "tls_server_name", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.tls_server_name" that: "TlsServerName" }]; // @gotags: `class:"public"` // When set to true verification of the TLS certificate is disabled. - google.protobuf.BoolValue tls_skip_verify = 50 [json_name = "tls_skip_verify", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.tls_skip_verify" that: "TlsSkipVerify" }]; + google.protobuf.BoolValue tls_skip_verify = 50 [json_name = "tls_skip_verify", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.tls_skip_verify" that: "TlsSkipVerify" }]; // @gotags: `class:"public"` // Input only. The current vault token used by this credential store for creating new credentials. - google.protobuf.StringValue token = 60 [json_name = "token", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.token" that: "Token" }]; + google.protobuf.StringValue token = 60 [json_name = "token", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.token" that: "Token" }]; // @gotags: `class:"secret"` // Output only. The hmac value of the vault token used by this credential store. - string token_hmac = 70 [json_name = "token_hmac"]; + string token_hmac = 70 [json_name = "token_hmac"]; // @gotags: `class:"public"` // Input only. A PEM encoded client certificate for vault with an // optional private key included in the bundle. It is an error to include // the private key in this bundle as well as setting the certificate_key // field. - google.protobuf.StringValue client_certificate = 80 [json_name = "client_certificate", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_certificate" that: "Certificate" }]; + google.protobuf.StringValue client_certificate = 80 [json_name = "client_certificate", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_certificate" that: "Certificate" }]; // @gotags: `class:"secret"` // Input only. A client certificate private key. - google.protobuf.StringValue client_certificate_key = 90 [json_name = "client_certificate_key", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_certificate_key" that: "CertificateKey" }]; + google.protobuf.StringValue client_certificate_key = 90 [json_name = "client_certificate_key", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_certificate_key" that: "CertificateKey" }]; // @gotags: `class:"secret"` // Output only. The hmac value of the private key used by the credential store. - string client_certificate_key_hmac = 100 [json_name = "client_certificate_key_hmac"]; + string client_certificate_key_hmac = 100 [json_name = "client_certificate_key_hmac"]; // @gotags: `class:"public"` } diff --git a/internal/proto/controller/api/services/v1/credential_store_service.proto b/internal/proto/controller/api/services/v1/credential_store_service.proto index f1866b9e4..3d6047bc7 100644 --- a/internal/proto/controller/api/services/v1/credential_store_service.proto +++ b/internal/proto/controller/api/services/v1/credential_store_service.proto @@ -86,7 +86,7 @@ service CredentialStoreService { } message GetCredentialStoreRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetCredentialStoreResponse { @@ -94,9 +94,9 @@ message GetCredentialStoreResponse { } message ListCredentialStoresRequest { - string scope_id = 1 [json_name = "scope_id"]; - bool recursive = 20 [json_name = "recursive"]; - string filter = 30 [json_name = "filter"]; + string scope_id = 1 [json_name = "scope_id"]; // @gotags: `class:"public"` + bool recursive = 20 [json_name = "recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name = "filter"]; // @gotags: `class:"public"` } message ListCredentialStoresResponse { @@ -108,12 +108,12 @@ message CreateCredentialStoreRequest { } message CreateCredentialStoreResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.credentialstores.v1.CredentialStore item = 2; } message UpdateCredentialStoreRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.credentialstores.v1.CredentialStore item = 2; google.protobuf.FieldMask update_mask = 3 [json_name = "update_mask"]; } @@ -123,7 +123,7 @@ message UpdateCredentialStoreResponse { } message DeleteCredentialStoreRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteCredentialStoreResponse {} diff --git a/internal/tests/api/credentialstores/credentialstores_classification_test.go b/internal/tests/api/credentialstores/credentialstores_classification_test.go new file mode 100644 index 000000000..19d490f29 --- /dev/null +++ b/internal/tests/api/credentialstores/credentialstores_classification_test.go @@ -0,0 +1,227 @@ +package credentialstores_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/credentialstores" + "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/structpb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +func TestCredentialStoreClassification(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + cases := []struct { + name string + in *eventlogger.Event + want *eventlogger.Event + }{ + { + "Vault", + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialStore{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{ + Value: "name", + }, + Description: &wrapperspb.StringValue{ + Value: "description", + }, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "vault", + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ + Address: &wrapperspb.StringValue{Value: "address"}, + Namespace: &wrapperspb.StringValue{Value: "namespace"}, + CaCert: &wrapperspb.StringValue{Value: "ca-cert"}, + TlsServerName: &wrapperspb.StringValue{Value: "tls-server-name"}, + TlsSkipVerify: &wrapperspb.BoolValue{Value: true}, + Token: &wrapperspb.StringValue{Value: "token"}, + TokenHmac: "token-hmac", + ClientCertificate: &wrapperspb.StringValue{Value: "client-certificate"}, + ClientCertificateKey: &wrapperspb.StringValue{Value: "client-certificate-key"}, + ClientCertificateKeyHmac: "client-certificate-key-hmac", + }, + }, + AuthorizedActions: []string{ + "action-1", + "action-2", + }, + AuthorizedCollectionActions: map[string]*structpb.ListValue{ + "action-1": {Values: []*structpb.Value{structpb.NewStringValue("value-1")}}, + }, + }, + }, + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialStore{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{ + Value: "name", + }, + Description: &wrapperspb.StringValue{ + Value: "description", + }, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "vault", + Attrs: &pb.CredentialStore_VaultCredentialStoreAttributes{ + VaultCredentialStoreAttributes: &pb.VaultCredentialStoreAttributes{ + Address: &wrapperspb.StringValue{Value: "address"}, + Namespace: &wrapperspb.StringValue{Value: "namespace"}, + CaCert: &wrapperspb.StringValue{Value: "ca-cert"}, + TlsServerName: &wrapperspb.StringValue{Value: "tls-server-name"}, + TlsSkipVerify: &wrapperspb.BoolValue{Value: true}, + Token: &wrapperspb.StringValue{Value: encrypt.RedactedData}, + TokenHmac: "token-hmac", + ClientCertificate: &wrapperspb.StringValue{Value: encrypt.RedactedData}, + ClientCertificateKey: &wrapperspb.StringValue{Value: encrypt.RedactedData}, + ClientCertificateKeyHmac: "client-certificate-key-hmac", + }, + }, + AuthorizedActions: []string{ + "action-1", + "action-2", + }, + AuthorizedCollectionActions: map[string]*structpb.ListValue{ + "action-1": {Values: []*structpb.Value{structpb.NewStringValue("value-1")}}, + }, + }, + }, + }, + { + "Default", + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialStore{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{ + Value: "name", + }, + Description: &wrapperspb.StringValue{ + Value: "description", + }, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "vault", + Attrs: &pb.CredentialStore_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewStringValue("value-1"), + "field2": structpb.NewStringValue("value-2"), + }, + }, + }, + AuthorizedActions: []string{ + "action-1", + "action-2", + }, + AuthorizedCollectionActions: map[string]*structpb.ListValue{ + "action-1": {Values: []*structpb.Value{structpb.NewStringValue("value-1")}}, + }, + }, + }, + &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.CredentialStore{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-descriptione", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{ + Value: "name", + }, + Description: &wrapperspb.StringValue{ + Value: "description", + }, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 1, + Type: "vault", + Attrs: &pb.CredentialStore_Attributes{ + Attributes: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "field1": structpb.NewStringValue(encrypt.RedactedData), + "field2": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + AuthorizedActions: []string{ + "action-1", + "action-2", + }, + AuthorizedCollectionActions: map[string]*structpb.ListValue{ + "action-1": {Values: []*structpb.Value{structpb.NewStringValue("value-1")}}, + }, + }, + }, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + wantJSON, err := json.Marshal(tc.want) + require.NoError(t, err) + + got, err := testEncryptingFilter.Process(ctx, tc.in) + require.NoError(t, err) + require.NotNil(t, got) + gotJSON, err := json.Marshal(got) + require.NoError(t, err) + assert.JSONEq(t, string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go b/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go index ccff18914..000bb115a 100644 --- a/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go +++ b/sdk/pbs/controller/api/resources/credentialstores/credential_store.pb.go @@ -33,32 +33,32 @@ type CredentialStore struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Credential Store. - 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 ID of the Scope of which this Credential Store is a part. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. Scope information for this Credential Store. Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,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 Credential Store type. - 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"` // Types that are assignable to Attrs: // *CredentialStore_Attributes // *CredentialStore_VaultCredentialStoreAttributes Attrs isCredentialStore_Attrs `protobuf_oneof:"attrs"` // 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"` // Output only. The authorized actions for the scope's collections. - AuthorizedCollectionActions map[string]*structpb.ListValue `protobuf:"bytes,310,rep,name=authorized_collection_actions,proto3" json:"authorized_collection_actions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + AuthorizedCollectionActions map[string]*structpb.ListValue `protobuf:"bytes,310,rep,name=authorized_collection_actions,proto3" json:"authorized_collection_actions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // classified as public via taggable implementation } func (x *CredentialStore) Reset() { @@ -215,28 +215,28 @@ type VaultCredentialStoreAttributes struct { unknownFields protoimpl.UnknownFields // The complete url address of vault. - 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"` // The namespace of vault used by this store - Namespace *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=namespace,proto3" json:"namespace,omitempty"` + Namespace *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=namespace,proto3" json:"namespace,omitempty" class:"public"` // @gotags: `class:"public"` // The PEM encoded CA cert to verify the vault server's ssl certificate - CaCert *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=ca_cert,proto3" json:"ca_cert,omitempty"` + CaCert *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=ca_cert,proto3" json:"ca_cert,omitempty" class:"public"` // @gotags: `class:"public"` // The value to use as the SNI host when connecting to vault via TLS. - TlsServerName *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=tls_server_name,proto3" json:"tls_server_name,omitempty"` + TlsServerName *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=tls_server_name,proto3" json:"tls_server_name,omitempty" class:"public"` // @gotags: `class:"public"` // When set to true verification of the TLS certificate is disabled. - TlsSkipVerify *wrapperspb.BoolValue `protobuf:"bytes,50,opt,name=tls_skip_verify,proto3" json:"tls_skip_verify,omitempty"` + TlsSkipVerify *wrapperspb.BoolValue `protobuf:"bytes,50,opt,name=tls_skip_verify,proto3" json:"tls_skip_verify,omitempty" class:"public"` // @gotags: `class:"public"` // Input only. The current vault token used by this credential store for creating new credentials. - Token *wrapperspb.StringValue `protobuf:"bytes,60,opt,name=token,proto3" json:"token,omitempty"` + Token *wrapperspb.StringValue `protobuf:"bytes,60,opt,name=token,proto3" json:"token,omitempty" class:"secret"` // @gotags: `class:"secret"` // Output only. The hmac value of the vault token used by this credential store. - TokenHmac string `protobuf:"bytes,70,opt,name=token_hmac,proto3" json:"token_hmac,omitempty"` + TokenHmac string `protobuf:"bytes,70,opt,name=token_hmac,proto3" json:"token_hmac,omitempty" class:"public"` // @gotags: `class:"public"` // Input only. A PEM encoded client certificate for vault with an // optional private key included in the bundle. It is an error to include // the private key in this bundle as well as setting the certificate_key // field. - ClientCertificate *wrapperspb.StringValue `protobuf:"bytes,80,opt,name=client_certificate,proto3" json:"client_certificate,omitempty"` + ClientCertificate *wrapperspb.StringValue `protobuf:"bytes,80,opt,name=client_certificate,proto3" json:"client_certificate,omitempty" class:"secret"` // @gotags: `class:"secret"` // Input only. A client certificate private key. - ClientCertificateKey *wrapperspb.StringValue `protobuf:"bytes,90,opt,name=client_certificate_key,proto3" json:"client_certificate_key,omitempty"` + ClientCertificateKey *wrapperspb.StringValue `protobuf:"bytes,90,opt,name=client_certificate_key,proto3" json:"client_certificate_key,omitempty" class:"secret"` // @gotags: `class:"secret"` // Output only. The hmac value of the private key used by the credential store. - ClientCertificateKeyHmac string `protobuf:"bytes,100,opt,name=client_certificate_key_hmac,proto3" json:"client_certificate_key_hmac,omitempty"` + ClientCertificateKeyHmac string `protobuf:"bytes,100,opt,name=client_certificate_key_hmac,proto3" json:"client_certificate_key_hmac,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *VaultCredentialStoreAttributes) Reset() { diff --git a/sdk/pbs/controller/api/resources/credentialstores/credential_store_taggable.go b/sdk/pbs/controller/api/resources/credentialstores/credential_store_taggable.go new file mode 100644 index 000000000..49794a660 --- /dev/null +++ b/sdk/pbs/controller/api/resources/credentialstores/credential_store_taggable.go @@ -0,0 +1,20 @@ +package credentialstores + +import ( + "fmt" + + "github.com/hashicorp/eventlogger/filters/encrypt" +) + +// Tags implements the encrypt.Taggable interface which allows +// CredentialStore map fields to be classified for the encrypt filter. +func (req *CredentialStore) Tags() ([]encrypt.PointerTag, error) { + tags := make([]encrypt.PointerTag, 0, len(req.AuthorizedCollectionActions)) + for k := range req.AuthorizedCollectionActions { + tags = append(tags, encrypt.PointerTag{ + Pointer: fmt.Sprintf("/AuthorizedCollectionActions/%s", k), + Classification: encrypt.PublicClassification, + }) + } + return tags, nil +} From 1af803780cd6bee067ac67dd0d8ba410a3d360f9 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Wed, 6 Apr 2022 09:05:22 -0400 Subject: [PATCH 38/45] feat(controller): Reorder interceptor stack The new `subtype.AttributeTransformerInterceptor` can return an error if it fails to transform the attributes. This is mainly if invalid attribute fields were included for a particular subtype. This error case used to be checked in the grpc service handler functions. However, now that it is happening in the interceptor, the `errorInterceptor` needs to be moved up in the stack so that it will process the response of the new transformation interceptor. The `errorInterceptor` used to be after the `auditRequestInterceptor` and prior to the `auditResponseInterceptor`, meaning that the `auditResponseInterceptor` would have access to the result of the `errorInterceptor`. But it seems the `auditRequestInterceptor` does not use or need any of the headers set by the `errorInterceptor` so it should be safe to move the `errorInterceptor`. This is important since the `subtype.AttributeTransformerInterceptor` needs to be before the audit interceptors in the stack to properly transform requests/responses so they can be audited with the complete classification information. --- internal/servers/controller/gateway.go | 2 +- internal/tests/api/accounts/account_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/servers/controller/gateway.go b/internal/servers/controller/gateway.go index 397486684..05243cb07 100644 --- a/internal/servers/controller/gateway.go +++ b/internal/servers/controller/gateway.go @@ -75,9 +75,9 @@ func newGrpcServer( grpc.UnaryInterceptor( grpc_middleware.ChainUnaryServer( requestCtxInterceptor, // populated requestInfo from headers into the request ctx + errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy subtypes.AttributeTransformerInterceptor(ctx), // convert to/from generic attributes from/to subtype specific attributes auditRequestInterceptor(ctx), // before we get started, audit the request - errorInterceptor(ctx), // convert domain and api errors into headers for the http proxy statusCodeInterceptor(ctx), // convert grpc codes into http status codes for the http proxy (can modify the resp) auditResponseInterceptor(ctx), // as we finish, audit the response grpc_recovery.UnaryServerInterceptor( // recover from panics with a grpc internal error diff --git a/internal/tests/api/accounts/account_test.go b/internal/tests/api/accounts/account_test.go index 671d0af8c..1c4f9197a 100644 --- a/internal/tests/api/accounts/account_test.go +++ b/internal/tests/api/accounts/account_test.go @@ -382,4 +382,12 @@ func TestErrorsOidc(t *testing.T) { apiErr = api.AsServerError(err) require.NotNil(apiErr) assert.EqualValues(http.StatusBadRequest, apiErr.Response().StatusCode()) + + // Invalid attribute fields + _, err = accountClient.Create(tc.Context(), amId, + accounts.WithOidcAccountSubject("subject2"), + accounts.WithPasswordAccountLoginName("foo"), + ) + require.Error(err) + require.JSONEq(err.Error(), `{"kind":"InvalidArgument", "message":"Error in provided request.", "details":{"request_fields":[{"name":"attributes", "description":"Attribute fields do not match the expected format."}]}}`) } From 4599e64cabd85affeae5ab61768176d0ff82ace1 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 15 Apr 2022 11:43:01 -0400 Subject: [PATCH 39/45] feat(event): Remove BOUNDARY_DEVELOPER_ENABLE_EVENTS env var --- globals/boundary_developer_env.go | 7 ------- internal/db/read_writer_test.go | 3 --- internal/observability/event/context.go | 8 -------- internal/observability/event/context_test.go | 7 ------- internal/observability/event/eventer_gate_test.go | 5 ----- internal/observability/event/testing.go | 15 --------------- .../scheduler/additional_verification_test.go | 7 ------- internal/servers/common/handler_test.go | 10 ---------- internal/servers/controller/auth/auth_test.go | 3 --- internal/servers/worker/status_test.go | 2 -- .../tests/api/authmethods/authenticate_test.go | 4 ---- internal/tests/api/authmethods/authmethod_test.go | 8 -------- 12 files changed, 79 deletions(-) diff --git a/globals/boundary_developer_env.go b/globals/boundary_developer_env.go index 819216458..822e37a58 100644 --- a/globals/boundary_developer_env.go +++ b/globals/boundary_developer_env.go @@ -1,8 +1 @@ package globals - -const ( - // BOUNDARY_DEVELOPER_ENABLE_EVENTS defines an envvar that enables events. - // Once this feature is generally available, then this envvar will be - // deprecated and removed. - BOUNDARY_DEVELOPER_ENABLE_EVENTS = "BOUNDARY_DEVELOPER_ENABLE_EVENTS" -) diff --git a/internal/db/read_writer_test.go b/internal/db/read_writer_test.go index cf0135e44..60ea56ad0 100644 --- a/internal/db/read_writer_test.go +++ b/internal/db/read_writer_test.go @@ -916,9 +916,6 @@ func TestDb_LookupWhere(t *testing.T) { // TestDb_LookupNotFoundEvent validates that not found error events are suppressed when // LookupById and LookupWhere are called. func TestDb_LookupNotFoundEvent(t *testing.T) { - // this test and its subtests cannot be run in parallel because of it's - // dependency on the sysEventer - event.TestEnableEventing(t, true) conn, _ := TestSetup(t, "postgres") TestCreateTables(t, conn) diff --git a/internal/observability/event/context.go b/internal/observability/event/context.go index 659404880..0016cfde3 100644 --- a/internal/observability/event/context.go +++ b/internal/observability/event/context.go @@ -3,12 +3,9 @@ package event import ( "context" "fmt" - "os" "runtime" - "strings" "time" - "github.com/hashicorp/boundary/globals" "github.com/hashicorp/go-hclog" ) @@ -170,11 +167,6 @@ func WriteError(ctx context.Context, caller Op, e error, opt ...Option) { // WithRequest, WithResponse, WithAuth, WithId, WithFlush and WithRequestInfo. // All other options are ignored. func WriteAudit(ctx context.Context, caller Op, opt ...Option) error { - // TODO (jimlambrt) 6/2021: remove this feature flag envvar when events are - // generally available. - if !strings.EqualFold(os.Getenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS), "true") { - return nil - } const op = "event.WriteAudit" if ctx == nil { return fmt.Errorf("%s: missing context: %w", op, ErrInvalidParameter) diff --git a/internal/observability/event/context_test.go b/internal/observability/event/context_test.go index 67c402e38..c145c6863 100644 --- a/internal/observability/event/context_test.go +++ b/internal/observability/event/context_test.go @@ -261,8 +261,6 @@ func Test_EventerFromContext(t *testing.T) { } func Test_WriteObservation(t *testing.T) { - event.TestEnableEventing(t, true) - // this test and its subtests cannot be run in parallel because of it's // dependency on the sysEventer @@ -505,7 +503,6 @@ func Test_WriteObservation(t *testing.T) { } func Test_Filtering(t *testing.T) { - event.TestEnableEventing(t, true) testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ Mutex: testLock, @@ -631,8 +628,6 @@ func testObservationJsonFromCtx(t *testing.T, ctx context.Context, caller event. } func Test_WriteAudit(t *testing.T) { - event.TestEnableEventing(t, true) - // this test and its subtests cannot be run in parallel because of it's // dependency on the sysEventer now := time.Now() @@ -970,8 +965,6 @@ func Test_WriteAudit(t *testing.T) { } func Test_WriteError(t *testing.T) { - event.TestEnableEventing(t, true) - // this test and its subtests cannot be run in parallel because of it's // dependency on the sysEventer now := time.Now() diff --git a/internal/observability/event/eventer_gate_test.go b/internal/observability/event/eventer_gate_test.go index a2e4c5a36..092850523 100644 --- a/internal/observability/event/eventer_gate_test.go +++ b/internal/observability/event/eventer_gate_test.go @@ -4,12 +4,10 @@ import ( "bytes" "context" "fmt" - "os" "strings" "sync" "testing" - "github.com/hashicorp/boundary/globals" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-secure-stdlib/strutil" "github.com/stretchr/testify/assert" @@ -20,9 +18,6 @@ func TestEventer_Gating(t *testing.T) { t.Parallel() require := require.New(t) - // FIXME: Remove this when no longer needed: - os.Setenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS, "true") - buffer := new(bytes.Buffer) eventerConfig := EventerConfig{ AuditEnabled: true, diff --git a/internal/observability/event/testing.go b/internal/observability/event/testing.go index 5736638b7..54b8bde0b 100644 --- a/internal/observability/event/testing.go +++ b/internal/observability/event/testing.go @@ -7,7 +7,6 @@ import ( "testing" "time" - "github.com/hashicorp/boundary/globals" pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/groups" "github.com/hashicorp/eventlogger" @@ -15,20 +14,6 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" ) -// TestEnableEventing will enable eventing via it's envvar -// globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS -func TestEnableEventing(t *testing.T, enable bool) { - t.Helper() - if enable { - os.Setenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS, "true") - t.Cleanup(func() { - defer os.Unsetenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS) - }) - } else { - os.Unsetenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS) - } -} - // TestGetEventerConfig is a test accessor for the eventer's config func TestGetEventerConfig(t *testing.T, e *Eventer) EventerConfig { t.Helper() diff --git a/internal/scheduler/additional_verification_test.go b/internal/scheduler/additional_verification_test.go index 16fb614ab..c48b17dc0 100644 --- a/internal/scheduler/additional_verification_test.go +++ b/internal/scheduler/additional_verification_test.go @@ -25,7 +25,6 @@ func TestSchedulerWorkflow(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") wrapper := db.TestWrapper(t) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ @@ -108,7 +107,6 @@ func TestSchedulerCancelCtx(t *testing.T) { conn, _ := db.TestSetup(t, "postgres") wrapper := db.TestWrapper(t) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ @@ -158,7 +156,6 @@ func TestSchedulerInterruptedCancelCtx(t *testing.T) { rw := db.New(conn) kmsCache := kms.TestKms(t, conn, wrapper) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ @@ -260,7 +257,6 @@ func TestSchedulerJobProgress(t *testing.T) { rw := db.New(conn) kmsCache := kms.TestKms(t, conn, wrapper) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ @@ -369,7 +365,6 @@ func TestSchedulerMonitorLoop(t *testing.T) { rw := db.New(conn) kmsCache := kms.TestKms(t, conn, wrapper) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ @@ -435,7 +430,6 @@ func TestSchedulerFinalStatusUpdate(t *testing.T) { rw := db.New(conn) kmsCache := kms.TestKms(t, conn, wrapper) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ @@ -526,7 +520,6 @@ func TestSchedulerRunNow(t *testing.T) { rw := db.New(conn) kmsCache := kms.TestKms(t, conn, wrapper) iam.TestRepo(t, conn, wrapper) - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ diff --git a/internal/servers/common/handler_test.go b/internal/servers/common/handler_test.go index 2159aa4f1..02b97f8e3 100644 --- a/internal/servers/common/handler_test.go +++ b/internal/servers/common/handler_test.go @@ -166,10 +166,6 @@ func Test_WrapWithOptionals(t *testing.T) { func Test_WrapWithEventsHandler(t *testing.T) { // This cannot run in parallel because it relies on a pkg var common.privateNets - - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) wrapper := db.TestWrapper(t) conn, _ := db.TestSetup(t, "postgres") testKms := kms.TestKms(t, conn, wrapper) @@ -353,9 +349,6 @@ func Test_WrapWithEventsHandler(t *testing.T) { } func Test_startGatedEvents(t *testing.T) { - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) testStartTime := time.Now() tests := []struct { name string @@ -412,9 +405,6 @@ func Test_startGatedEvents(t *testing.T) { } func Test_flushGatedEvents(t *testing.T) { - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) testStartTime := time.Now() tests := []struct { name string diff --git a/internal/servers/controller/auth/auth_test.go b/internal/servers/controller/auth/auth_test.go index 0eda12218..1569821d3 100644 --- a/internal/servers/controller/auth/auth_test.go +++ b/internal/servers/controller/auth/auth_test.go @@ -140,9 +140,6 @@ func TestAuthTokenAuthenticator(t *testing.T) { } func TestVerify_AuditEvent(t *testing.T) { - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) eventConfig := event.TestEventerConfig(t, "Test_Verify", event.TestWithAuditSink(t)) testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ diff --git a/internal/servers/worker/status_test.go b/internal/servers/worker/status_test.go index 718546dbb..e5ad90ebd 100644 --- a/internal/servers/worker/status_test.go +++ b/internal/servers/worker/status_test.go @@ -14,8 +14,6 @@ import ( ) func TestWorkerWaitForNextSuccessfulStatusUpdate(t *testing.T) { - // do not run using t.Parallel() since it relies on the sys eventer - event.TestEnableEventing(t, true) testConfig := event.DefaultEventerConfig() testLock := &sync.Mutex{} testLogger := hclog.New(&hclog.LoggerOptions{ diff --git a/internal/tests/api/authmethods/authenticate_test.go b/internal/tests/api/authmethods/authenticate_test.go index a75d3efa0..a5a74f39a 100644 --- a/internal/tests/api/authmethods/authenticate_test.go +++ b/internal/tests/api/authmethods/authenticate_test.go @@ -22,10 +22,6 @@ import ( // TestAuthenticate tests the api calls and the audit events it should produce func TestAuthenticate(t *testing.T) { - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) - assert, require := assert.New(t), require.New(t) eventConfig := event.TestEventerConfig(t, "TestAuthenticateAuditEntry", event.TestWithAuditSink(t)) testLock := &sync.Mutex{} diff --git a/internal/tests/api/authmethods/authmethod_test.go b/internal/tests/api/authmethods/authmethod_test.go index 0e5f73e99..e9f654f5c 100644 --- a/internal/tests/api/authmethods/authmethod_test.go +++ b/internal/tests/api/authmethods/authmethod_test.go @@ -24,10 +24,6 @@ import ( const global = "global" func TestCrud(t *testing.T) { - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) - assert, require := assert.New(t), require.New(t) eventConfig := event.TestEventerConfig(t, "TestCrud", event.TestWithAuditSink(t)) testLock := &sync.Mutex{} @@ -253,10 +249,6 @@ func TestList(t *testing.T) { } func TestCustomMethods(t *testing.T) { - // this cannot run in parallel because it relies on envvar - // globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS - event.TestEnableEventing(t, true) - assert, require := assert.New(t), require.New(t) eventConfig := event.TestEventerConfig(t, "TestCrud", event.TestWithAuditSink(t)) testLock := &sync.Mutex{} From 38a3960047f8c65da9b82b4ffe76d7a3f97a5389 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 12 Apr 2022 22:37:04 -0400 Subject: [PATCH 40/45] feat(role): Classify resources for audit events --- Makefile | 2 + .../api/services/role_service.pb.go | 48 +++--- .../api/resources/roles/v1/role.proto | 40 ++--- .../api/services/v1/role_service.proto | 48 +++--- .../tests/api/roles/classification_test.go | 142 ++++++++++++++++++ .../controller/api/resources/roles/role.pb.go | 38 ++--- 6 files changed, 231 insertions(+), 87 deletions(-) create mode 100644 internal/tests/api/roles/classification_test.go diff --git a/Makefile b/Makefile index 970fbf920..2648e7406 100644 --- a/Makefile +++ b/Makefile @@ -175,6 +175,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_store_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/credentiallibraries/credential_library.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_library_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/roles/role.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/role_service.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/role_service.pb.go b/internal/gen/controller/api/services/role_service.pb.go index d6fe5af11..c69d5d34e 100644 --- a/internal/gen/controller/api/services/role_service.pb.go +++ b/internal/gen/controller/api/services/role_service.pb.go @@ -29,7 +29,7 @@ type GetRoleRequest 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 *GetRoleRequest) Reset() { @@ -123,9 +123,9 @@ type ListRolesRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListRolesRequest) Reset() { @@ -335,7 +335,7 @@ type UpdateRoleRequest 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 *roles.Role `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"` } @@ -445,7 +445,7 @@ type DeleteRoleRequest 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 *DeleteRoleRequest) Reset() { @@ -530,11 +530,11 @@ type AddRolePrincipalsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - PrincipalIds []string `protobuf:"bytes,3,rep,name=principal_ids,proto3" json:"principal_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + PrincipalIds []string `protobuf:"bytes,3,rep,name=principal_ids,proto3" json:"principal_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddRolePrincipalsRequest) Reset() { @@ -642,11 +642,11 @@ type SetRolePrincipalsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - PrincipalIds []string `protobuf:"bytes,3,rep,name=principal_ids,proto3" json:"principal_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + PrincipalIds []string `protobuf:"bytes,3,rep,name=principal_ids,proto3" json:"principal_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetRolePrincipalsRequest) Reset() { @@ -754,11 +754,11 @@ type RemoveRolePrincipalsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - PrincipalIds []string `protobuf:"bytes,3,rep,name=principal_ids,proto3" json:"principal_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + PrincipalIds []string `protobuf:"bytes,3,rep,name=principal_ids,proto3" json:"principal_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveRolePrincipalsRequest) Reset() { @@ -866,11 +866,11 @@ type AddRoleGrantsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - GrantStrings []string `protobuf:"bytes,3,rep,name=grant_strings,proto3" json:"grant_strings,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + GrantStrings []string `protobuf:"bytes,3,rep,name=grant_strings,proto3" json:"grant_strings,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddRoleGrantsRequest) Reset() { @@ -978,11 +978,11 @@ type SetRoleGrantsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - GrantStrings []string `protobuf:"bytes,3,rep,name=grant_strings,proto3" json:"grant_strings,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + GrantStrings []string `protobuf:"bytes,3,rep,name=grant_strings,proto3" json:"grant_strings,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetRoleGrantsRequest) Reset() { @@ -1090,11 +1090,11 @@ type RemoveRoleGrantsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - GrantStrings []string `protobuf:"bytes,3,rep,name=grant_strings,proto3" json:"grant_strings,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + GrantStrings []string `protobuf:"bytes,3,rep,name=grant_strings,proto3" json:"grant_strings,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveRoleGrantsRequest) Reset() { diff --git a/internal/proto/controller/api/resources/roles/v1/role.proto b/internal/proto/controller/api/resources/roles/v1/role.proto index d57be8315..0f7704574 100644 --- a/internal/proto/controller/api/resources/roles/v1/role.proto +++ b/internal/proto/controller/api/resources/roles/v1/role.proto @@ -11,32 +11,32 @@ import "controller/custom_options/v1/options.proto"; message Principal { // Output only. The ID of the principal. - string id = 1; + string id = 1; // @gotags: `class:"public"` // Output only. The type of the principal. - string type = 2; + string type = 2; // @gotags: `class:"public"` // Output only. The Scope of the principal. - string scope_id = 3 [json_name="scope_id"]; + string scope_id = 3 [json_name="scope_id"]; // @gotags: `class:"public"` } message GrantJson { // Output only. The ID, if set. - string id = 1; + string id = 1; // @gotags: `class:"public"` // Output only. The type, if set. - string type = 2; + string type = 2; // @gotags: `class:"public"` // Output only. The actions. - repeated string actions = 3; + repeated string actions = 3; // @gotags: `class:"public"` } message Grant { // Output only. The original user-supplied string. - string raw = 1; + string raw = 1; // @gotags: `class:"public"` // Output only. The canonically-formatted string. - string canonical = 2; + string canonical = 2; // @gotags: `class:"public"` // Output only. The JSON representation of the grant. GrantJson json = 3; @@ -45,45 +45,45 @@ message Grant { // Role contains all fields related to a Role resource message Role { // Output only. The ID of the Role. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The ID of the Scope containing this Role. - string scope_id = 20 [json_name="scope_id"]; + string scope_id = 20 [json_name="scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; - + // 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 Scope the grants will apply to. If the Role is at the global scope, this can be an org or project. If the Role is at an org scope, this can be a project within the org. It is invalid for this to be anything other than the Role's scope when the Role's scope is a project. - google.protobuf.StringValue grant_scope_id = 90 [json_name="grant_scope_id", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"grant_scope_id" that: "GrantScopeId"}]; + google.protobuf.StringValue grant_scope_id = 90 [json_name="grant_scope_id", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"grant_scope_id" that: "GrantScopeId"}]; // @gotags: `class:"public"` // Output only. The IDs (only) of principals that are assigned to this role. - repeated string principal_ids = 100 [json_name="principal_ids"]; + repeated string principal_ids = 100 [json_name="principal_ids"]; // @gotags: `class:"public"` // Output only. The principals that are assigned to this role. repeated Principal principals = 110; // Output only. The grants that this role provides for its principals. - repeated string grant_strings = 120 [json_name="grant_strings"]; + repeated string grant_strings = 120 [json_name="grant_strings"]; // @gotags: `class:"public"` // Output only. The parsed grant information. repeated Grant grants = 130; // 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"` } diff --git a/internal/proto/controller/api/services/v1/role_service.proto b/internal/proto/controller/api/services/v1/role_service.proto index b620bbad2..b372823b0 100644 --- a/internal/proto/controller/api/services/v1/role_service.proto +++ b/internal/proto/controller/api/services/v1/role_service.proto @@ -180,7 +180,7 @@ service RoleService { } message GetRoleRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetRoleResponse { @@ -188,9 +188,9 @@ message GetRoleResponse { } message ListRolesRequest { - string scope_id = 1 [json_name="scope_id"]; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1 [json_name="scope_id"]; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListRolesResponse { @@ -207,7 +207,7 @@ message CreateRoleResponse { } message UpdateRoleRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.roles.v1.Role item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -217,17 +217,17 @@ message UpdateRoleResponse { } message DeleteRoleRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteRoleResponse {} message AddRolePrincipalsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string principal_ids = 3 [json_name="principal_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string principal_ids = 3 [json_name="principal_ids"]; // @gotags: `class:"public"` } message AddRolePrincipalsResponse { @@ -235,11 +235,11 @@ message AddRolePrincipalsResponse { } message SetRolePrincipalsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string principal_ids = 3 [json_name="principal_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string principal_ids = 3 [json_name="principal_ids"]; // @gotags: `class:"public"` } message SetRolePrincipalsResponse { @@ -247,11 +247,11 @@ message SetRolePrincipalsResponse { } message RemoveRolePrincipalsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string principal_ids = 3 [json_name="principal_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string principal_ids = 3 [json_name="principal_ids"]; // @gotags: `class:"public"` } message RemoveRolePrincipalsResponse { @@ -259,11 +259,11 @@ message RemoveRolePrincipalsResponse { } message AddRoleGrantsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string grant_strings = 3 [json_name="grant_strings"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string grant_strings = 3 [json_name="grant_strings"]; // @gotags: `class:"public"` } message AddRoleGrantsResponse { @@ -271,11 +271,11 @@ message AddRoleGrantsResponse { } message SetRoleGrantsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string grant_strings = 3 [json_name="grant_strings"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string grant_strings = 3 [json_name="grant_strings"]; // @gotags: `class:"public"` } message SetRoleGrantsResponse { @@ -283,11 +283,11 @@ message SetRoleGrantsResponse { } message RemoveRoleGrantsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string grant_strings = 3 [json_name="grant_strings"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string grant_strings = 3 [json_name="grant_strings"]; // @gotags: `class:"public"` } message RemoveRoleGrantsResponse { diff --git a/internal/tests/api/roles/classification_test.go b/internal/tests/api/roles/classification_test.go new file mode 100644 index 000000000..4605da27b --- /dev/null +++ b/internal/tests/api/roles/classification_test.go @@ -0,0 +1,142 @@ +package roles_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/roles" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + "github.com/hashicorp/boundary/sdk/wrapper" + "github.com/hashicorp/eventlogger" + "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 TestRoles(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + tests := []struct { + name string + in *eventlogger.Event + want *eventlogger.Event + }{ + { + name: "role", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Role{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-description", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + GrantScopeId: &wrapperspb.StringValue{Value: "grant-scope-id"}, + PrincipalIds: []string{ + "principal-id", + }, + Principals: []*pb.Principal{ + { + Id: "principal-id", + Type: "principal-type", + ScopeId: "principal-scope-id", + }, + }, + GrantStrings: []string{ + "grand-string", + }, + Grants: []*pb.Grant{ + { + Raw: "raw", + Canonical: "canonical", + Json: &pb.GrantJson{ + Id: "grant-json-id", + Type: "grant-json-type", + Actions: []string{"action"}, + }, + }, + }, + AuthorizedActions: []string{"action-1"}, + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Role{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-description", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + GrantScopeId: &wrapperspb.StringValue{Value: "grant-scope-id"}, + PrincipalIds: []string{ + "principal-id", + }, + Principals: []*pb.Principal{ + { + Id: "principal-id", + Type: "principal-type", + ScopeId: "principal-scope-id", + }, + }, + GrantStrings: []string{ + "grand-string", + }, + Grants: []*pb.Grant{ + { + Raw: "raw", + Canonical: "canonical", + Json: &pb.GrantJson{ + Id: "grant-json-id", + Type: "grant-json-type", + Actions: []string{"action"}, + }, + }, + }, + AuthorizedActions: []string{"action-1"}, + }, + }, + }, + } + 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.in) + require.NoError(err) + require.NotNil(got) + gotJSON, err := json.Marshal(got) + require.NoError(err) + + wantJSON, err := json.Marshal(tt.want) + require.NoError(err) + assert.JSONEq(string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/roles/role.pb.go b/sdk/pbs/controller/api/resources/roles/role.pb.go index 59455090e..88bc26348 100644 --- a/sdk/pbs/controller/api/resources/roles/role.pb.go +++ b/sdk/pbs/controller/api/resources/roles/role.pb.go @@ -30,11 +30,11 @@ type Principal struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the principal. - 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 type of the principal. - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Scope of the principal. - ScopeId string `protobuf:"bytes,3,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,3,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *Principal) Reset() { @@ -96,11 +96,11 @@ type GrantJson struct { unknownFields protoimpl.UnknownFields // Output only. The ID, if set. - 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 type, if set. - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The actions. - Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"` + Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *GrantJson) Reset() { @@ -162,9 +162,9 @@ type Grant struct { unknownFields protoimpl.UnknownFields // Output only. The original user-supplied string. - Raw string `protobuf:"bytes,1,opt,name=raw,proto3" json:"raw,omitempty"` + Raw string `protobuf:"bytes,1,opt,name=raw,proto3" json:"raw,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The canonically-formatted string. - Canonical string `protobuf:"bytes,2,opt,name=canonical,proto3" json:"canonical,omitempty"` + Canonical string `protobuf:"bytes,2,opt,name=canonical,proto3" json:"canonical,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The JSON representation of the grant. Json *GrantJson `protobuf:"bytes,3,opt,name=json,proto3" json:"json,omitempty"` } @@ -229,34 +229,34 @@ type Role struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Role. - 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 ID of the Scope containing this Role. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_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"` // 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 Scope the grants will apply to. If the Role is at the global scope, this can be an org or project. If the Role is at an org scope, this can be a project within the org. It is invalid for this to be anything other than the Role's scope when the Role's scope is a project. - GrantScopeId *wrapperspb.StringValue `protobuf:"bytes,90,opt,name=grant_scope_id,proto3" json:"grant_scope_id,omitempty"` + GrantScopeId *wrapperspb.StringValue `protobuf:"bytes,90,opt,name=grant_scope_id,proto3" json:"grant_scope_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The IDs (only) of principals that are assigned to this role. - PrincipalIds []string `protobuf:"bytes,100,rep,name=principal_ids,proto3" json:"principal_ids,omitempty"` + PrincipalIds []string `protobuf:"bytes,100,rep,name=principal_ids,proto3" json:"principal_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The principals that are assigned to this role. Principals []*Principal `protobuf:"bytes,110,rep,name=principals,proto3" json:"principals,omitempty"` // Output only. The grants that this role provides for its principals. - GrantStrings []string `protobuf:"bytes,120,rep,name=grant_strings,proto3" json:"grant_strings,omitempty"` + GrantStrings []string `protobuf:"bytes,120,rep,name=grant_strings,proto3" json:"grant_strings,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The parsed grant information. Grants []*Grant `protobuf:"bytes,130,rep,name=grants,proto3" json:"grants,omitempty"` // 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 *Role) Reset() { From 006fa3a85a1881928b454b63f9b25e8f698e6a83 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Tue, 12 Apr 2022 22:38:45 -0400 Subject: [PATCH 41/45] feat(session): Classify resources for audit events --- Makefile | 2 + .../api/services/session_service.pb.go | 12 +- .../api/resources/sessions/v1/session.proto | 56 +++--- .../api/services/v1/session_service.proto | 12 +- .../tests/api/sessions/classification_test.go | 160 ++++++++++++++++++ .../api/resources/sessions/session.pb.go | 56 +++--- 6 files changed, 230 insertions(+), 68 deletions(-) create mode 100644 internal/tests/api/sessions/classification_test.go diff --git a/Makefile b/Makefile index 2648e7406..ad3082fdb 100644 --- a/Makefile +++ b/Makefile @@ -177,6 +177,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/credential_library_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/roles/role.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/role_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/sessions/session.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/session_service.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/session_service.pb.go b/internal/gen/controller/api/services/session_service.pb.go index a5f84520d..dbed5c594 100644 --- a/internal/gen/controller/api/services/session_service.pb.go +++ b/internal/gen/controller/api/services/session_service.pb.go @@ -28,7 +28,7 @@ type GetSessionRequest 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 *GetSessionRequest) Reset() { @@ -122,9 +122,9 @@ type ListSessionsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListSessionsRequest) Reset() { @@ -232,8 +232,8 @@ type CancelSessionRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *CancelSessionRequest) Reset() { diff --git a/internal/proto/controller/api/resources/sessions/v1/session.proto b/internal/proto/controller/api/resources/sessions/v1/session.proto index a700ead92..a7e473e9a 100644 --- a/internal/proto/controller/api/resources/sessions/v1/session.proto +++ b/internal/proto/controller/api/resources/sessions/v1/session.proto @@ -9,106 +9,106 @@ import "controller/api/resources/scopes/v1/scope.proto"; message WorkerInfo { // The address of the worker. - string address = 10; + string address = 10; // @gotags: `class:"public"` } message SessionState { // The status of the Session, e.g. "pending", "active", "canceling", "terminated". - string status = 10; + string status = 10; // @gotags: `class:"public"` // Output only. The time the Session entered this state. - google.protobuf.Timestamp start_time = 20 [json_name = "start_time"]; + google.protobuf.Timestamp start_time = 20 [json_name = "start_time"]; // @gotags: `class:"public"` // Output only. The time the Session stopped being in this state. - google.protobuf.Timestamp end_time = 30 [json_name = "end_time"]; + google.protobuf.Timestamp end_time = 30 [json_name = "end_time"]; // @gotags: `class:"public"` } // Connection contains information about a specific connection in a session message Connection { // client_tcp_address of the connection - string client_tcp_address = 3; + string client_tcp_address = 3; // @gotags: `class:"public"` // client_tcp_port of the connection - uint32 client_tcp_port = 4; + uint32 client_tcp_port = 4; // @gotags: `class:"public"` // endpoint_tcp_address of the connection - string endpoint_tcp_address = 5; + string endpoint_tcp_address = 5; // @gotags: `class:"public"` // endpoint_tcp_port of the connection - uint32 endpoint_tcp_port = 6; + uint32 endpoint_tcp_port = 6; // @gotags: `class:"public"` // bytes_up of the connection - uint64 bytes_up = 7; + uint64 bytes_up = 7; // @gotags: `class:"public"` // bytes_down of the connection - uint64 bytes_down = 8; + uint64 bytes_down = 8; // @gotags: `class:"public"` // closed_reason of the conneciont - string closed_reason = 9; + string closed_reason = 9; // @gotags: `class:"public"` } // Session contains all fields related to a Session resource message Session { // Output only. The ID of the Session. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The ID of the Target that created this Session. - string target_id = 20 [json_name = "target_id"]; + string target_id = 20 [json_name = "target_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; // 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 when canceling this Session to ensure that the operation is acting on a known session state. - uint32 version = 80; + uint32 version = 80; // @gotags: `class:"public"` // Output only. Type of the Session (e.g. tcp). - string type = 90; + string type = 90; // @gotags: `class:"public"` // Output only. After this time the connection will be expired, e.g. forcefully terminated. - google.protobuf.Timestamp expiration_time = 100 [json_name = "expiration_time"]; + google.protobuf.Timestamp expiration_time = 100 [json_name = "expiration_time"]; // @gotags: `class:"public"` // Output only. The ID of the Auth Token used to authenticate. - string auth_token_id = 110 [json_name = "auth_token_id"]; + string auth_token_id = 110 [json_name = "auth_token_id"]; // @gotags: `class:"public"` // Output only. The ID of the User that requested the Session. - string user_id = 120 [json_name = "user_id"]; + string user_id = 120 [json_name = "user_id"]; // @gotags: `class:"public"` // Output only. The Host Set sourcing the Host for this Session. - string host_set_id = 130 [json_name = "host_set_id"]; + string host_set_id = 130 [json_name = "host_set_id"]; // @gotags: `class:"public"` // Output only. The Host used by the Session. - string host_id = 140 [json_name = "host_id"]; + string host_id = 140 [json_name = "host_id"]; // @gotags: `class:"public"` // Output only. The Scope of the Session. - string scope_id = 150 [json_name = "scope_id"]; + string scope_id = 150 [json_name = "scope_id"]; // @gotags: `class:"public"` // Output only. The endpoint of the Session; that is, the address to which the worker is proxying data. - string endpoint = 160; + string endpoint = 160; // @gotags: `class:"public"` // Output only. The states of this Session in descending order from the current state to the first. repeated SessionState states = 170; // Output only. The current status of this Session. - string status = 180; + string status = 180; // @gotags: `class:"public"` // Output only. Worker information given to the client. repeated WorkerInfo worker_info = 190 [json_name = "worker_info"]; // Output only. The certificate generated for the session. Raw DER bytes. - bytes certificate = 200; + bytes certificate = 200; // @gotags: `class:"public"` // Output only. If the session is terminated, this provides a short description as to why. - string termination_reason = 210 [json_name = "termination_reason"]; + string termination_reason = 210 [json_name = "termination_reason"]; // @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"` // Output only. The associated connections with this session. repeated Connection connections = 310; diff --git a/internal/proto/controller/api/services/v1/session_service.proto b/internal/proto/controller/api/services/v1/session_service.proto index 73e163c74..8dbeae49e 100644 --- a/internal/proto/controller/api/services/v1/session_service.proto +++ b/internal/proto/controller/api/services/v1/session_service.proto @@ -52,7 +52,7 @@ service SessionService { } message GetSessionRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetSessionResponse { @@ -60,9 +60,9 @@ message GetSessionResponse { } message ListSessionsRequest { - string scope_id = 1; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListSessionsResponse { @@ -70,8 +70,8 @@ message ListSessionsResponse { } message CancelSessionRequest { - string id = 1; - uint32 version = 2; + string id = 1; // @gotags: `class:"public"` + uint32 version = 2; // @gotags: `class:"public"` } message CancelSessionResponse { diff --git a/internal/tests/api/sessions/classification_test.go b/internal/tests/api/sessions/classification_test.go new file mode 100644 index 000000000..3136a44e9 --- /dev/null +++ b/internal/tests/api/sessions/classification_test.go @@ -0,0 +1,160 @@ +package sessions_test + +import ( + "context" + "encoding/json" + "testing" + "time" + + "github.com/hashicorp/boundary/sdk/pbs/controller/api" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/sessions" + "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" +) + +func TestSessions(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.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 + in *eventlogger.Event + want *eventlogger.Event + }{ + { + name: "session", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Session{ + Id: "id", + TargetId: "target_id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-description", + ParentScopeId: "scope-parent_scope_id", + }, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + Type: "type", + ExpirationTime: pbNow, + AuthTokenId: "auth_token_id", + UserId: "user_id", + HostSetId: "host_set_id", + HostId: "host_id", + ScopeId: "scope_id", + Endpoint: "endpoint", + States: []*pb.SessionState{ + { + Status: "status", + StartTime: pbNow, + EndTime: pbNow, + }, + }, + Status: "status", + WorkerInfo: []*pb.WorkerInfo{ + { + Address: "worker-address", + }, + }, + Certificate: []byte("certificate"), + TerminationReason: "termination_reason", + AuthorizedActions: []string{"action-1"}, + Connections: []*pb.Connection{ + { + ClientTcpAddress: "client_tcp_address", + ClientTcpPort: 0, + EndpointTcpAddress: "endpoint_tcp_address", + EndpointTcpPort: 0, + BytesUp: 0, + BytesDown: 0, + ClosedReason: "closed_reason", + }, + }, + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Session{ + Id: "id", + TargetId: "target_id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-description", + ParentScopeId: "scope-parent_scope_id", + }, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + Type: "type", + ExpirationTime: pbNow, + AuthTokenId: "auth_token_id", + UserId: "user_id", + HostSetId: "host_set_id", + HostId: "host_id", + ScopeId: "scope_id", + Endpoint: "endpoint", + States: []*pb.SessionState{ + { + Status: "status", + StartTime: pbNow, + EndTime: pbNow, + }, + }, + Status: "status", + WorkerInfo: []*pb.WorkerInfo{ + { + Address: "worker-address", + }, + }, + Certificate: []byte("certificate"), + TerminationReason: "termination_reason", + AuthorizedActions: []string{"action-1"}, + Connections: []*pb.Connection{ + { + ClientTcpAddress: "client_tcp_address", + ClientTcpPort: 0, + EndpointTcpAddress: "endpoint_tcp_address", + EndpointTcpPort: 0, + BytesUp: 0, + BytesDown: 0, + ClosedReason: "closed_reason", + }, + }, + }, + }, + }, + } + 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.in) + require.NoError(err) + require.NotNil(got) + gotJSON, err := json.Marshal(got) + require.NoError(err) + + wantJSON, err := json.Marshal(tt.want) + require.NoError(err) + assert.JSONEq(string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/sessions/session.pb.go b/sdk/pbs/controller/api/resources/sessions/session.pb.go index 8761881dd..8d3fd027d 100644 --- a/sdk/pbs/controller/api/resources/sessions/session.pb.go +++ b/sdk/pbs/controller/api/resources/sessions/session.pb.go @@ -28,7 +28,7 @@ type WorkerInfo struct { unknownFields protoimpl.UnknownFields // The address of the worker. - Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty"` + Address string `protobuf:"bytes,10,opt,name=address,proto3" json:"address,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *WorkerInfo) Reset() { @@ -76,11 +76,11 @@ type SessionState struct { unknownFields protoimpl.UnknownFields // The status of the Session, e.g. "pending", "active", "canceling", "terminated". - Status string `protobuf:"bytes,10,opt,name=status,proto3" json:"status,omitempty"` + Status string `protobuf:"bytes,10,opt,name=status,proto3" json:"status,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The time the Session entered this state. - StartTime *timestamppb.Timestamp `protobuf:"bytes,20,opt,name=start_time,proto3" json:"start_time,omitempty"` + StartTime *timestamppb.Timestamp `protobuf:"bytes,20,opt,name=start_time,proto3" json:"start_time,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The time the Session stopped being in this state. - EndTime *timestamppb.Timestamp `protobuf:"bytes,30,opt,name=end_time,proto3" json:"end_time,omitempty"` + EndTime *timestamppb.Timestamp `protobuf:"bytes,30,opt,name=end_time,proto3" json:"end_time,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SessionState) Reset() { @@ -143,19 +143,19 @@ type Connection struct { unknownFields protoimpl.UnknownFields // client_tcp_address of the connection - ClientTcpAddress string `protobuf:"bytes,3,opt,name=client_tcp_address,json=clientTcpAddress,proto3" json:"client_tcp_address,omitempty"` + ClientTcpAddress string `protobuf:"bytes,3,opt,name=client_tcp_address,json=clientTcpAddress,proto3" json:"client_tcp_address,omitempty" class:"public"` // @gotags: `class:"public"` // client_tcp_port of the connection - ClientTcpPort uint32 `protobuf:"varint,4,opt,name=client_tcp_port,json=clientTcpPort,proto3" json:"client_tcp_port,omitempty"` + ClientTcpPort uint32 `protobuf:"varint,4,opt,name=client_tcp_port,json=clientTcpPort,proto3" json:"client_tcp_port,omitempty" class:"public"` // @gotags: `class:"public"` // endpoint_tcp_address of the connection - EndpointTcpAddress string `protobuf:"bytes,5,opt,name=endpoint_tcp_address,json=endpointTcpAddress,proto3" json:"endpoint_tcp_address,omitempty"` + EndpointTcpAddress string `protobuf:"bytes,5,opt,name=endpoint_tcp_address,json=endpointTcpAddress,proto3" json:"endpoint_tcp_address,omitempty" class:"public"` // @gotags: `class:"public"` // endpoint_tcp_port of the connection - EndpointTcpPort uint32 `protobuf:"varint,6,opt,name=endpoint_tcp_port,json=endpointTcpPort,proto3" json:"endpoint_tcp_port,omitempty"` + EndpointTcpPort uint32 `protobuf:"varint,6,opt,name=endpoint_tcp_port,json=endpointTcpPort,proto3" json:"endpoint_tcp_port,omitempty" class:"public"` // @gotags: `class:"public"` // bytes_up of the connection - BytesUp uint64 `protobuf:"varint,7,opt,name=bytes_up,json=bytesUp,proto3" json:"bytes_up,omitempty"` + BytesUp uint64 `protobuf:"varint,7,opt,name=bytes_up,json=bytesUp,proto3" json:"bytes_up,omitempty" class:"public"` // @gotags: `class:"public"` // bytes_down of the connection - BytesDown uint64 `protobuf:"varint,8,opt,name=bytes_down,json=bytesDown,proto3" json:"bytes_down,omitempty"` + BytesDown uint64 `protobuf:"varint,8,opt,name=bytes_down,json=bytesDown,proto3" json:"bytes_down,omitempty" class:"public"` // @gotags: `class:"public"` // closed_reason of the conneciont - ClosedReason string `protobuf:"bytes,9,opt,name=closed_reason,json=closedReason,proto3" json:"closed_reason,omitempty"` + ClosedReason string `protobuf:"bytes,9,opt,name=closed_reason,json=closedReason,proto3" json:"closed_reason,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *Connection) Reset() { @@ -246,45 +246,45 @@ type Session struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Session. - 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"` // Output only. The ID of the Target that created this Session. - TargetId string `protobuf:"bytes,20,opt,name=target_id,proto3" json:"target_id,omitempty"` + TargetId string `protobuf:"bytes,20,opt,name=target_id,proto3" json:"target_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. 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 when canceling this Session to ensure that the operation is acting on a known session state. - 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"` // Output only. Type of the Session (e.g. tcp). - 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. After this time the connection will be expired, e.g. forcefully terminated. - ExpirationTime *timestamppb.Timestamp `protobuf:"bytes,100,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"` + ExpirationTime *timestamppb.Timestamp `protobuf:"bytes,100,opt,name=expiration_time,proto3" json:"expiration_time,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The ID of the Auth Token used to authenticate. - AuthTokenId string `protobuf:"bytes,110,opt,name=auth_token_id,proto3" json:"auth_token_id,omitempty"` + AuthTokenId string `protobuf:"bytes,110,opt,name=auth_token_id,proto3" json:"auth_token_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The ID of the User that requested the Session. - UserId string `protobuf:"bytes,120,opt,name=user_id,proto3" json:"user_id,omitempty"` + UserId string `protobuf:"bytes,120,opt,name=user_id,proto3" json:"user_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Host Set sourcing the Host for this Session. - HostSetId string `protobuf:"bytes,130,opt,name=host_set_id,proto3" json:"host_set_id,omitempty"` + HostSetId string `protobuf:"bytes,130,opt,name=host_set_id,proto3" json:"host_set_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Host used by the Session. - HostId string `protobuf:"bytes,140,opt,name=host_id,proto3" json:"host_id,omitempty"` + HostId string `protobuf:"bytes,140,opt,name=host_id,proto3" json:"host_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Scope of the Session. - ScopeId string `protobuf:"bytes,150,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,150,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The endpoint of the Session; that is, the address to which the worker is proxying data. - Endpoint string `protobuf:"bytes,160,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + Endpoint string `protobuf:"bytes,160,opt,name=endpoint,proto3" json:"endpoint,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The states of this Session in descending order from the current state to the first. States []*SessionState `protobuf:"bytes,170,rep,name=states,proto3" json:"states,omitempty"` // Output only. The current status of this Session. - Status string `protobuf:"bytes,180,opt,name=status,proto3" json:"status,omitempty"` + Status string `protobuf:"bytes,180,opt,name=status,proto3" json:"status,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. Worker information given to the client. WorkerInfo []*WorkerInfo `protobuf:"bytes,190,rep,name=worker_info,proto3" json:"worker_info,omitempty"` // Output only. The certificate generated for the session. Raw DER bytes. - Certificate []byte `protobuf:"bytes,200,opt,name=certificate,proto3" json:"certificate,omitempty"` + Certificate []byte `protobuf:"bytes,200,opt,name=certificate,proto3" json:"certificate,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. If the session is terminated, this provides a short description as to why. - TerminationReason string `protobuf:"bytes,210,opt,name=termination_reason,proto3" json:"termination_reason,omitempty"` + TerminationReason string `protobuf:"bytes,210,opt,name=termination_reason,proto3" json:"termination_reason,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"` // Output only. The associated connections with this session. Connections []*Connection `protobuf:"bytes,310,rep,name=connections,proto3" json:"connections,omitempty"` } From 2ade7f34a8932b4b395516060ef0ae843baaa1af Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Wed, 13 Apr 2022 09:42:31 -0400 Subject: [PATCH 42/45] feat(users): Classify resources for audit events --- Makefile | 2 + .../api/services/user_service.pb.go | 32 ++--- .../api/resources/users/v1/user.proto | 30 ++--- .../api/services/v1/user_service.proto | 32 ++--- .../tests/api/users/classification_test.go | 119 ++++++++++++++++++ .../controller/api/resources/users/user.pb.go | 30 ++--- 6 files changed, 183 insertions(+), 62 deletions(-) create mode 100644 internal/tests/api/users/classification_test.go diff --git a/Makefile b/Makefile index ad3082fdb..2711390b2 100644 --- a/Makefile +++ b/Makefile @@ -179,6 +179,8 @@ protobuild: @protoc-go-inject-tag -input=./internal/gen/controller/api/services/role_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/sessions/session.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/api/services/session_service.pb.go + @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/users/user.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/user_service.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/user_service.pb.go b/internal/gen/controller/api/services/user_service.pb.go index 02e8a0532..bd8a91f30 100644 --- a/internal/gen/controller/api/services/user_service.pb.go +++ b/internal/gen/controller/api/services/user_service.pb.go @@ -29,7 +29,7 @@ type GetUserRequest 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 *GetUserRequest) Reset() { @@ -123,9 +123,9 @@ type ListUsersRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty" class:"public"` // @gotags: `class:"public"` + Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` } func (x *ListUsersRequest) Reset() { @@ -280,7 +280,7 @@ type CreateUserResponse 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 *users.User `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -335,7 +335,7 @@ type UpdateUserRequest 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 *users.User `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"` } @@ -445,7 +445,7 @@ type DeleteUserRequest 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 *DeleteUserRequest) Reset() { @@ -530,10 +530,10 @@ type AddUserAccountsRequest 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"` // The version ensures the User hasn't changed since it was last retrieved and if it has the request will fail. - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - AccountIds []string `protobuf:"bytes,3,rep,name=account_ids,proto3" json:"account_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + AccountIds []string `protobuf:"bytes,3,rep,name=account_ids,proto3" json:"account_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddUserAccountsRequest) Reset() { @@ -641,10 +641,10 @@ type SetUserAccountsRequest 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"` // The version ensures the User hasn't changed since it was last retrieved and if it has the request will fail. - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - AccountIds []string `protobuf:"bytes,3,rep,name=account_ids,proto3" json:"account_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + AccountIds []string `protobuf:"bytes,3,rep,name=account_ids,proto3" json:"account_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetUserAccountsRequest) Reset() { @@ -752,10 +752,10 @@ type RemoveUserAccountsRequest 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"` // The version ensures the User hasn't changed since it was last retrieved and if it has the request will fail. - Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - AccountIds []string `protobuf:"bytes,3,rep,name=account_ids,proto3" json:"account_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + AccountIds []string `protobuf:"bytes,3,rep,name=account_ids,proto3" json:"account_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveUserAccountsRequest) Reset() { diff --git a/internal/proto/controller/api/resources/users/v1/user.proto b/internal/proto/controller/api/resources/users/v1/user.proto index 12afb7cdc..794f2f0b7 100644 --- a/internal/proto/controller/api/resources/users/v1/user.proto +++ b/internal/proto/controller/api/resources/users/v1/user.proto @@ -11,61 +11,61 @@ import "controller/custom_options/v1/options.proto"; message Account { // Output only. The ID of the Account. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The Scope containing the Account. - string scope_id = 20 [json_name = "scope_id"]; + string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public"` } // User contains all fields related to a User resource message User { // Output only. The ID of the User. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The ID of the Scope this resource is in. - string scope_id = 20 [json_name = "scope_id"]; + string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; // 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:"sensitive"` // 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:"sensitive"` // 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"` // Output only. Contains the list of Account IDs linked to this User. - repeated string account_ids = 90 [json_name = "account_ids"]; + repeated string account_ids = 90 [json_name = "account_ids"]; // @gotags: `class:"public"` // Output only. The Accounts linked to this User. repeated Account accounts = 100; // 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"` // Output only. login_name is a string that maps to the user's account "login // name" from the scope's primary auth method - string login_name = 110 [json_name = "login_name"]; + string login_name = 110 [json_name = "login_name"]; // @gotags: `class:"sensitive"` // Output only. full_name is a string that maps to the user's account name // from the scope's primary auth method - string full_name = 120 [json_name = "full_name"]; + string full_name = 120 [json_name = "full_name"]; // @gotags: `class:"sensitive"` // Output only. email is a string that maps to the user's account email from // the scope's primary auth method - string email = 130 [json_name = "email"]; + string email = 130 [json_name = "email"]; // @gotags: `class:"sensitive"` // Output only. primary_account_id is a string that maps to the user's account // public_id from the scope's primary auth method - string primary_account_id = 140 [json_name = "primary_account_id"]; + string primary_account_id = 140 [json_name = "primary_account_id"]; // @gotags: `class:"public"` } diff --git a/internal/proto/controller/api/services/v1/user_service.proto b/internal/proto/controller/api/services/v1/user_service.proto index a3b851137..f9f5c80eb 100644 --- a/internal/proto/controller/api/services/v1/user_service.proto +++ b/internal/proto/controller/api/services/v1/user_service.proto @@ -136,7 +136,7 @@ service UserService { } message GetUserRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetUserResponse { @@ -144,9 +144,9 @@ message GetUserResponse { } message ListUsersRequest { - string scope_id = 1; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"sensitive"` } message ListUsersResponse { @@ -158,12 +158,12 @@ message CreateUserRequest { } message CreateUserResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.users.v1.User item = 2; } message UpdateUserRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.users.v1.User item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -173,16 +173,16 @@ message UpdateUserResponse { } message DeleteUserRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteUserResponse {} message AddUserAccountsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // The version ensures the User hasn't changed since it was last retrieved and if it has the request will fail. - uint32 version = 2; - repeated string account_ids = 3 [json_name="account_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string account_ids = 3 [json_name="account_ids"]; // @gotags: `class:"public"` } message AddUserAccountsResponse { @@ -190,10 +190,10 @@ message AddUserAccountsResponse { } message SetUserAccountsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // The version ensures the User hasn't changed since it was last retrieved and if it has the request will fail. - uint32 version = 2; - repeated string account_ids = 3 [json_name="account_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string account_ids = 3 [json_name="account_ids"]; // @gotags: `class:"public"` } message SetUserAccountsResponse { @@ -201,10 +201,10 @@ message SetUserAccountsResponse { } message RemoveUserAccountsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // The version ensures the User hasn't changed since it was last retrieved and if it has the request will fail. - uint32 version = 2; - repeated string account_ids = 3 [json_name="account_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string account_ids = 3 [json_name="account_ids"]; // @gotags: `class:"public"` } message RemoveUserAccountsResponse { diff --git a/internal/tests/api/users/classification_test.go b/internal/tests/api/users/classification_test.go new file mode 100644 index 000000000..31f3ec5a1 --- /dev/null +++ b/internal/tests/api/users/classification_test.go @@ -0,0 +1,119 @@ +package users_test + +import ( + "context" + "encoding/json" + "testing" + "time" + + "github.com/hashicorp/boundary/sdk/pbs/controller/api" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/users" + "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 TestUsers(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.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 + in *eventlogger.Event + want *eventlogger.Event + }{ + { + name: "role", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.User{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-description", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + AccountIds: []string{"account-id"}, + Accounts: []*pb.Account{ + { + Id: "account-id", + ScopeId: "scope-id", + }, + }, + AuthorizedActions: []string{"action-1"}, + LoginName: "login-name", + FullName: "full-name", + Email: "email@test.test", + PrimaryAccountId: "primary-account-id", + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.User{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "scope-id", + Type: "scope-type", + Name: "scope-name", + Description: "scope-description", + ParentScopeId: "scope-parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: encrypt.TestHmacSha256(t, []byte("name"), wrapper, nil, nil)}, + Description: &wrapperspb.StringValue{Value: encrypt.TestHmacSha256(t, []byte("description"), wrapper, nil, nil)}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + AccountIds: []string{"account-id"}, + Accounts: []*pb.Account{ + { + Id: "account-id", + ScopeId: "scope-id", + }, + }, + AuthorizedActions: []string{"action-1"}, + LoginName: encrypt.TestHmacSha256(t, []byte("login-name"), wrapper, nil, nil), + FullName: encrypt.TestHmacSha256(t, []byte("full-name"), wrapper, nil, nil), + Email: encrypt.TestHmacSha256(t, []byte("email@test.test"), wrapper, nil, nil), + PrimaryAccountId: "primary-account-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.in) + require.NoError(err) + require.NotNil(got) + gotJSON, err := json.Marshal(got) + require.NoError(err) + + wantJSON, err := json.Marshal(tt.want) + require.NoError(err) + assert.JSONEq(string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/users/user.pb.go b/sdk/pbs/controller/api/resources/users/user.pb.go index cac44e362..05a960d54 100644 --- a/sdk/pbs/controller/api/resources/users/user.pb.go +++ b/sdk/pbs/controller/api/resources/users/user.pb.go @@ -30,9 +30,9 @@ type Account struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Account. - 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"` // Output only. The Scope containing the Account. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *Account) Reset() { @@ -88,40 +88,40 @@ type User struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the User. - 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 ID of the Scope this resource is in. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_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"` // 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:"sensitive"` // @gotags: `class:"sensitive"` // 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:"sensitive"` // @gotags: `class:"sensitive"` // 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"` // Output only. Contains the list of Account IDs linked to this User. - AccountIds []string `protobuf:"bytes,90,rep,name=account_ids,proto3" json:"account_ids,omitempty"` + AccountIds []string `protobuf:"bytes,90,rep,name=account_ids,proto3" json:"account_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Accounts linked to this User. Accounts []*Account `protobuf:"bytes,100,rep,name=accounts,proto3" json:"accounts,omitempty"` // 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"` // Output only. login_name is a string that maps to the user's account "login // name" from the scope's primary auth method - LoginName string `protobuf:"bytes,110,opt,name=login_name,proto3" json:"login_name,omitempty"` + LoginName string `protobuf:"bytes,110,opt,name=login_name,proto3" json:"login_name,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` // Output only. full_name is a string that maps to the user's account name // from the scope's primary auth method - FullName string `protobuf:"bytes,120,opt,name=full_name,proto3" json:"full_name,omitempty"` + FullName string `protobuf:"bytes,120,opt,name=full_name,proto3" json:"full_name,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` // Output only. email is a string that maps to the user's account email from // the scope's primary auth method - Email string `protobuf:"bytes,130,opt,name=email,proto3" json:"email,omitempty"` + Email string `protobuf:"bytes,130,opt,name=email,proto3" json:"email,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` // Output only. primary_account_id is a string that maps to the user's account // public_id from the scope's primary auth method - PrimaryAccountId string `protobuf:"bytes,140,opt,name=primary_account_id,proto3" json:"primary_account_id,omitempty"` + PrimaryAccountId string `protobuf:"bytes,140,opt,name=primary_account_id,proto3" json:"primary_account_id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *User) Reset() { From 8c452b0991a964fd7e58791e64f43ac151735462 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Mon, 11 Apr 2022 17:06:29 -0400 Subject: [PATCH 43/45] feat(authmethods): Add classification to all fields --- .../api/services/auth_method_service.pb.go | 20 +-- .../authmethods/v1/auth_method.proto | 38 ++--- .../api/services/v1/auth_method_service.proto | 20 +-- .../tests/api/authmethods/authmethod_test.go | 16 +- .../api/authmethods/classification_test.go | 28 ++-- .../service_classification_test.go | 151 +++++++++++++++++- .../resources/authmethods/auth_method.pb.go | 38 ++--- 7 files changed, 221 insertions(+), 90 deletions(-) diff --git a/internal/gen/controller/api/services/auth_method_service.pb.go b/internal/gen/controller/api/services/auth_method_service.pb.go index 5648ba675..cbb116e12 100644 --- a/internal/gen/controller/api/services/auth_method_service.pb.go +++ b/internal/gen/controller/api/services/auth_method_service.pb.go @@ -127,9 +127,9 @@ type ListAuthMethodsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListAuthMethodsRequest) Reset() { @@ -449,7 +449,7 @@ type DeleteAuthMethodRequest 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 *DeleteAuthMethodRequest) Reset() { @@ -536,11 +536,11 @@ type OidcChangeStateAttributes struct { unknownFields protoimpl.UnknownFields // state must be `inactive`, `active-private`, or `active-public` - State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty" class:"public"` // @gotags: `class:"public"` // This flag is only useful for an oidc auth method. It should not be used // unless the oidc provider's config is incorrectly set and is stopping the // activation of this auth method. - DisableDiscoveredConfigValidation bool `protobuf:"varint,2,opt,name=disable_discovered_config_validation,proto3" json:"disable_discovered_config_validation,omitempty"` + DisableDiscoveredConfigValidation bool `protobuf:"varint,2,opt,name=disable_discovered_config_validation,proto3" json:"disable_discovered_config_validation,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *OidcChangeStateAttributes) Reset() { @@ -597,7 +597,7 @@ type ChangeStateRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" class:"public"` // @gotags: `class:"public"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` // Types that are assignable to Attrs: // *ChangeStateRequest_Attributes // *ChangeStateRequest_OidcChangeStateAttributes @@ -742,8 +742,8 @@ type PasswordLoginAttributes struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - LoginName string `protobuf:"bytes,1,opt,name=login_name,proto3" json:"login_name,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + LoginName string `protobuf:"bytes,1,opt,name=login_name,proto3" json:"login_name,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *PasswordLoginAttributes) Reset() { @@ -802,7 +802,7 @@ type OidcStartAttributes struct { // An object which will be marshaled as JSON and roundtripped in the token command call. RoundtripPayload *structpb.Struct `protobuf:"bytes,1,opt,name=roundtrip_payload,proto3" json:"roundtrip_payload,omitempty"` // Cached marshaled payload. This is not ingressed from the client; anything found will be thrown out. - CachedRoundtripPayload string `protobuf:"bytes,2,opt,name=cached_roundtrip_payload,json=cachedRoundtripPayload,proto3" json:"cached_roundtrip_payload,omitempty"` + CachedRoundtripPayload string `protobuf:"bytes,2,opt,name=cached_roundtrip_payload,json=cachedRoundtripPayload,proto3" json:"cached_roundtrip_payload,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` } func (x *OidcStartAttributes) Reset() { diff --git a/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto b/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto index 34cab4d76..52759d736 100644 --- a/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto +++ b/internal/proto/controller/api/resources/authmethods/v1/auth_method.proto @@ -22,7 +22,7 @@ message AuthMethod { string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this Auth method. - resources.scopes.v1.ScopeInfo scope = 30; // @gotags: `class:"public"` + resources.scopes.v1.ScopeInfo scope = 30; // 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" }]; // @gotags: `class:"public"` @@ -74,77 +74,77 @@ message AuthMethod { message PasswordAuthMethodAttributes { // The minimum length allowed for user names for Accounts in this Auth Method. uint32 min_login_name_length = 10 - [json_name = "min_login_name_length", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.min_login_name_length" that: "MinLoginNameLength" }]; + [json_name = "min_login_name_length", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.min_login_name_length" that: "MinLoginNameLength" }]; // @gotags: `class:"public"` // The minimum length allowed for passwords for Accounts in this Auth Method. uint32 min_password_length = 20 - [json_name = "min_password_length", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.min_password_length" that: "MinPasswordLength" }]; + [json_name = "min_password_length", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.min_password_length" that: "MinPasswordLength" }]; // @gotags: `class:"public"` } // The attributes of an OIDC typed auth method. message OidcAuthMethodAttributes { // Output only. The state of the auth method. Will be "inactive", // "active-private", or "active-public". - string state = 10 [json_name = "state"]; + string state = 10 [json_name = "state"]; // @gotags: `class:"public"` // The issuer URL. Boundary expects only the schema, host, and port and will // strip off ".well-known/openid-configuration" if present. This will be // used for configuration discovery as well as for validation of the "iss" // claim. - google.protobuf.StringValue issuer = 20 [json_name = "issuer", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.issuer" that: "Issuer" }]; + google.protobuf.StringValue issuer = 20 [json_name = "issuer", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.issuer" that: "Issuer" }]; // @gotags: `class:"public"` // An OAuth 2.0 Client Identifier valid at the Authorization Server. google.protobuf.StringValue client_id = 30 - [json_name = "client_id", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_id" that: "ClientId" }]; + [json_name = "client_id", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_id" that: "ClientId" }]; // @gotags: `class:"public"` // Input only. The client's secret. google.protobuf.StringValue client_secret = 40 - [json_name = "client_secret", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_secret" that: "ClientSecret" }]; + [json_name = "client_secret", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_secret" that: "ClientSecret" }]; // @gotags: `class:"secret"` // Output only. The HMAC'd value of the clients secret to indicate whether // the client secret has changed. - string client_secret_hmac = 50 [json_name = "client_secret_hmac"]; + string client_secret_hmac = 50 [json_name = "client_secret_hmac"]; // @gotags: `class:"public"` // The OIDC "max_age" parameter sent to the Authorization Server indicating // a maximum acceptable time in seconds since the user's last authentication // before requiring the user to reauthenticate. 0 indicates an immediate // need to reauthenticate. - google.protobuf.UInt32Value max_age = 60 [json_name = "max_age", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.max_age" that: "MaxAge" }]; + google.protobuf.UInt32Value max_age = 60 [json_name = "max_age", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.max_age" that: "MaxAge" }]; // @gotags: `class:"public"` // The signing algorithms allowed for the auth method. repeated string signing_algorithms = 70 - [json_name = "signing_algorithms", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.signing_algorithms" that: "SigningAlgs" }]; + [json_name = "signing_algorithms", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.signing_algorithms" that: "SigningAlgs" }]; // @gotags: `class:"public"` // The prefix that should be used for any URLs needed during the // authentication flow. This includes the callback URL, the token retrieval // URL, and the redirection URL used by the OIDC Authorization Server. google.protobuf.StringValue api_url_prefix = 80 - [json_name = "api_url_prefix", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.api_url_prefix" that: "ApiUrl" }]; + [json_name = "api_url_prefix", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.api_url_prefix" that: "ApiUrl" }]; // @gotags: `class:"public"` // Output only. The callback URL that should be configured on the // Authorization Server to use during the authentication flow. - string callback_url = 90 [json_name = "callback_url"]; + string callback_url = 90 [json_name = "callback_url"]; // @gotags: `class:"public"` // Optional PEM-encoded X.509 CA certificates that can be used as trust anchors // when connecting to an OIDC provider. repeated string idp_ca_certs = 100 - [json_name = "idp_ca_certs", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.idp_ca_certs" that: "Certificates" }]; + [json_name = "idp_ca_certs", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.idp_ca_certs" that: "Certificates" }]; // @gotags: `class:"public"` // Allowed audience claims for this auth method. repeated string allowed_audiences = 110 - [json_name = "allowed_audiences", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.allowed_audiences" that: "AudClaims" }]; + [json_name = "allowed_audiences", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.allowed_audiences" that: "AudClaims" }]; // @gotags: `class:"public"` // Optional claims scopes that will be requested during authentication. // see: https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims repeated string claims_scopes = 112 - [json_name = "claims_scopes", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.claims_scopes" that: "ClaimsScopes" }]; + [json_name = "claims_scopes", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.claims_scopes" that: "ClaimsScopes" }]; // @gotags: `class:"public"` // account_claim_maps are optional claim maps from custom claims to the // standard claims of sub, name and email. These maps are represented as // key=value where the key equals the from_claim and the value equals the // to_claim. For example "oid=sub". repeated string account_claim_maps = 113 - [json_name = "account_claim_maps", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.account_claim_maps" that: "AccountClaimMaps" }]; + [json_name = "account_claim_maps", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.account_claim_maps" that: "AccountClaimMaps" }]; // @gotags: `class:"public"` // If the Authorization Server's discovered configuration contains values // that do not match the configuration set on this auth method, this can be @@ -154,7 +154,7 @@ message OidcAuthMethodAttributes { // will be treated the same as "false"; that is, every time the method is // updated or the state is changed, this value must be set to "true" or it // will be disabled. - bool disable_discovered_config_validation = 120 [json_name = "disable_discovered_config_validation", (custom_options.v1.generate_sdk_option) = true]; + bool disable_discovered_config_validation = 120 [json_name = "disable_discovered_config_validation", (custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"` // dry_run, when set on an update request, indicates that the changes should // not be persisted. Boundary will still perform the normal checks to confirm @@ -162,7 +162,7 @@ message OidcAuthMethodAttributes { // This value will also be set on the returned resource when set in the request // along with the updated fields applied to the resource (but not persisted) as // a result of the update request. - bool dry_run = 130 [json_name = "dry_run", (custom_options.v1.generate_sdk_option) = true]; + bool dry_run = 130 [json_name = "dry_run", (custom_options.v1.generate_sdk_option) = true]; // @gotags: `class:"public"` } // The structure of the OIDC authenticate start response, in the JSON object @@ -197,7 +197,7 @@ message OidcAuthMethodAuthenticateCallbackResponse { // The structure of OIDC token request parameters message OidcAuthMethodAuthenticateTokenRequest { // The ID of the pending token - string token_id = 10 [json_name = "token_id"]; // @gotags: `class:"private"` + string token_id = 10 [json_name = "token_id"]; // @gotags: `class:"secret"` } // Internal only: the structure of a token response if it _does not_ contain a diff --git a/internal/proto/controller/api/services/v1/auth_method_service.proto b/internal/proto/controller/api/services/v1/auth_method_service.proto index 9be8afb27..286bc13e3 100644 --- a/internal/proto/controller/api/services/v1/auth_method_service.proto +++ b/internal/proto/controller/api/services/v1/auth_method_service.proto @@ -120,9 +120,9 @@ message GetAuthMethodResponse { } message ListAuthMethodsRequest { - string scope_id = 1 [json_name = "scope_id"]; - bool recursive = 20 [json_name = "recursive"]; - string filter = 30 [json_name = "filter"]; + string scope_id = 1 [json_name = "scope_id"]; // @gotags: `class:"public"` + bool recursive = 20 [json_name = "recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name = "filter"]; // @gotags: `class:"public"` } message ListAuthMethodsResponse { @@ -149,7 +149,7 @@ message UpdateAuthMethodResponse { } message DeleteAuthMethodRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteAuthMethodResponse {} @@ -157,18 +157,18 @@ message DeleteAuthMethodResponse {} // Attributes specific to changing the state of an oidc auth method. message OidcChangeStateAttributes { // state must be `inactive`, `active-private`, or `active-public` - string state = 1; + string state = 1; // @gotags: `class:"public"` // This flag is only useful for an oidc auth method. It should not be used // unless the oidc provider's config is incorrectly set and is stopping the // activation of this auth method. - bool disable_discovered_config_validation = 2 [json_name = "disable_discovered_config_validation"]; + bool disable_discovered_config_validation = 2 [json_name = "disable_discovered_config_validation"]; // @gotags: `class:"public"` } message ChangeStateRequest { string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; + uint32 version = 2; // @gotags: `class:"public"` oneof attrs { // The attributes specific to this auth method's state. @@ -184,8 +184,8 @@ message ChangeStateResponse { // The layout of the struct for "attributes" field in AuthenticateRequest for a password type. This message isn't directly referenced anywhere but is used here to define the expected field names and // types. message PasswordLoginAttributes { - string login_name = 1 [json_name = "login_name"]; - string password = 2; + string login_name = 1 [json_name = "login_name"]; // @gotags: `class:"sensitive"` + string password = 2; // @gotags: `class:"secret"` } // The layout of the struct for "attributes" field in AuthenticateRequest for a oidc type's start command. This message isn't directly referenced anywhere but is used here to define the expected field @@ -194,7 +194,7 @@ message OidcStartAttributes { // An object which will be marshaled as JSON and roundtripped in the token command call. google.protobuf.Struct roundtrip_payload = 1 [json_name = "roundtrip_payload"]; // Cached marshaled payload. This is not ingressed from the client; anything found will be thrown out. - string cached_roundtrip_payload = 2; + string cached_roundtrip_payload = 2; // @gotags: `class:"sensitive"` } message AuthenticateRequest { diff --git a/internal/tests/api/authmethods/authmethod_test.go b/internal/tests/api/authmethods/authmethod_test.go index e9f654f5c..8097203e2 100644 --- a/internal/tests/api/authmethods/authmethod_test.go +++ b/internal/tests/api/authmethods/authmethod_test.go @@ -69,13 +69,11 @@ func TestCrud(t *testing.T) { reqItem := tests_api.GetEventDetails(t, got, "request")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, reqItem) tests_api.AssertRedactedValues(t, reqItem["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually tests_api.AssertRedactedValues(t, reqItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) respItem := tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) tests_api.AssertRedactedValues(t, respItem["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls @@ -89,7 +87,6 @@ func TestCrud(t *testing.T) { respItem = tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) tests_api.AssertRedactedValues(t, respItem["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) _ = os.WriteFile(eventConfig.AuditEvents.Name(), nil, 0o666) // clean out audit events from previous calls @@ -103,7 +100,6 @@ func TestCrud(t *testing.T) { respItem = tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) tests_api.AssertRedactedValues(t, respItem["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["PasswordAuthMethodAttributes"]) pw, err = amClient.Update(tc.Context(), pw.Item.Id, pw.Item.Version, authmethods.DefaultName()) @@ -129,14 +125,12 @@ func TestCrud(t *testing.T) { reqItem = tests_api.GetEventDetails(t, got, "request")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, reqItem) tests_api.AssertRedactedValues(t, reqItem["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually - tests_api.AssertRedactedValues(t, reqItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"], "callback_url", "state", "client_secret_hmac") + tests_api.AssertRedactedValues(t, reqItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"]) respItem = tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) tests_api.AssertRedactedValues(t, respItem["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually - tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"], "state", "client_secret_hmac", "callback_url") + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"]) oidc, err = amClient.Read(tc.Context(), oidc.Item.Id) require.NoError(err) @@ -300,13 +294,11 @@ func TestCustomMethods(t *testing.T) { reqDetails := tests_api.GetEventDetails(t, got, "request") tests_api.AssertRedactedValues(t, reqDetails) tests_api.AssertRedactedValues(t, reqDetails["Attrs"]) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually - tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["OidcChangeStateAttributes"], "state") + tests_api.AssertRedactedValues(t, reqDetails["Attrs"].(map[string]interface{})["OidcChangeStateAttributes"]) respItem := tests_api.GetEventDetails(t, got, "response")["item"].(map[string]interface{}) tests_api.AssertRedactedValues(t, respItem) - // TODO(johanbrandhorst): Not all of these fields will be redacted eventually - tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"], "signing_algorithms", "callback_url", "idp_ca_certs", "state", "client_secret_hmac") + tests_api.AssertRedactedValues(t, respItem["Attrs"].(map[string]interface{})["OidcAuthMethodsAttributes"]) _, err = amClient.ChangeState(tc.Context(), u.Item.Id, u.Item.Version, "", authmethods.WithOidcAuthMethodDisableDiscoveredConfigValidation(true)) assert.Error(err) diff --git a/internal/tests/api/authmethods/classification_test.go b/internal/tests/api/authmethods/classification_test.go index bad427d65..ac2b4d966 100644 --- a/internal/tests/api/authmethods/classification_test.go +++ b/internal/tests/api/authmethods/classification_test.go @@ -22,6 +22,10 @@ func TestAuthMethod_Tags(t *testing.T) { 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 @@ -78,21 +82,20 @@ func TestAuthMethod_Tags(t *testing.T) { Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "description"}, Type: "oidc", - // TODO(johanbrandhorst): update redaction once typed attributes are available Attrs: &pb.AuthMethod_OidcAuthMethodsAttributes{ OidcAuthMethodsAttributes: &pb.OidcAuthMethodAttributes{ - State: encrypt.RedactedData, - Issuer: wrapperspb.String(encrypt.RedactedData), - ClientId: wrapperspb.String(encrypt.RedactedData), - ClientSecretHmac: encrypt.RedactedData, + State: "public-state", + Issuer: wrapperspb.String("public-issuer"), + ClientId: wrapperspb.String("public-client_id"), + ClientSecretHmac: "public-client_secret_hmac", MaxAge: wrapperspb.UInt32(100), - SigningAlgorithms: []string{encrypt.RedactedData}, - IdpCaCerts: []string{encrypt.RedactedData}, - ApiUrlPrefix: wrapperspb.String(encrypt.RedactedData), - CallbackUrl: encrypt.RedactedData, - AllowedAudiences: []string{encrypt.RedactedData}, - ClaimsScopes: []string{encrypt.RedactedData}, - AccountClaimMaps: []string{encrypt.RedactedData}, + SigningAlgorithms: []string{"public-signing_algorithms"}, + IdpCaCerts: []string{"public-idp_ca_certs"}, + ApiUrlPrefix: wrapperspb.String("public-api_url_prefix"), + CallbackUrl: "public-callback_url", + AllowedAudiences: []string{"public-allowed_audiences"}, + ClaimsScopes: []string{"public-claims_scopes"}, + AccountClaimMaps: []string{"public-account_claim_maps"}, DisableDiscoveredConfigValidation: false, DryRun: false, ClientSecret: wrapperspb.String(encrypt.RedactedData), @@ -147,7 +150,6 @@ func TestAuthMethod_Tags(t *testing.T) { Name: &wrapperspb.StringValue{Value: "name"}, Description: &wrapperspb.StringValue{Value: "description"}, Type: "password", - // TODO(johanbrandhorst): update redaction once typed attributes are available Attrs: &pb.AuthMethod_PasswordAuthMethodAttributes{ PasswordAuthMethodAttributes: &pb.PasswordAuthMethodAttributes{ MinLoginNameLength: 100, diff --git a/internal/tests/api/authmethods/service_classification_test.go b/internal/tests/api/authmethods/service_classification_test.go index f227c562b..1a1aab702 100644 --- a/internal/tests/api/authmethods/service_classification_test.go +++ b/internal/tests/api/authmethods/service_classification_test.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/eventlogger/filters/encrypt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -28,6 +29,10 @@ func TestAuthenticate_Tags(t *testing.T) { 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 @@ -35,7 +40,48 @@ func TestAuthenticate_Tags(t *testing.T) { wantEvent *eventlogger.Event }{ { - name: "validate-response-filtering", + name: "validate-authenticate-request-filtering", + testEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateRequest{ + AuthMethodId: "public-auth-method-id", + TokenType: "public-token-type", + Command: "public-command", + Attrs: &services.AuthenticateRequest_OidcStartAttributes{ + OidcStartAttributes: &services.OidcStartAttributes{ + RoundtripPayload: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key": structpb.NewStringValue("value"), + }, + }, + CachedRoundtripPayload: "public-cached_roundtrip_payload", + }, + }, + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateRequest{ + AuthMethodId: "public-auth-method-id", + TokenType: "public-token-type", + Command: "public-command", + Attrs: &services.AuthenticateRequest_OidcStartAttributes{ + OidcStartAttributes: &services.OidcStartAttributes{ + RoundtripPayload: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + CachedRoundtripPayload: encrypt.TestHmacSha256(t, []byte("public-cached_roundtrip_payload"), wrapper, nil, nil), + }, + }, + }, + }, + }, + { + name: "validate-authenticate-response-filtering", testEvent: &eventlogger.Event{ Type: "test", CreatedAt: now, @@ -73,7 +119,6 @@ func TestAuthenticate_Tags(t *testing.T) { CreatedAt: now, Payload: &services.AuthenticateResponse{ Command: "public-command", - // TODO(johanbrandhorst): update redaction once typed attributes are available Attrs: &services.AuthenticateResponse_AuthTokenResponse{ AuthTokenResponse: &authtokens.AuthToken{ AccountId: "public-account_id", @@ -103,7 +148,7 @@ func TestAuthenticate_Tags(t *testing.T) { }, }, { - name: "validate-request-filtering", + name: "validate-callback-request-filtering", testEvent: &eventlogger.Event{ Type: "test", CreatedAt: now, @@ -111,9 +156,75 @@ func TestAuthenticate_Tags(t *testing.T) { AuthMethodId: "public-auth-method-id", TokenType: "public-token-type", Command: "public-command", - Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ - OidcAuthMethodAuthenticateTokenRequest: &authmethods.OidcAuthMethodAuthenticateTokenRequest{ - TokenId: "public-token-id", + Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &authmethods.OidcAuthMethodAuthenticateCallbackRequest{ + Code: "secret-code", + State: "public-state", + Error: "public-error", + ErrorDescription: "public-error_description", + ErrorUri: "public-error_uri", + }, + }, + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateRequest{ + AuthMethodId: "public-auth-method-id", + TokenType: "public-token-type", + Command: "public-command", + Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateCallbackRequest{ + OidcAuthMethodAuthenticateCallbackRequest: &authmethods.OidcAuthMethodAuthenticateCallbackRequest{ + Code: encrypt.RedactedData, + State: "public-state", + Error: "public-error", + ErrorDescription: "public-error_description", + ErrorUri: "public-error_uri", + }, + }, + }, + }, + }, + { + name: "validate-callback-response-filtering", + testEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateResponse{ + Command: "public-command", + Attrs: &services.AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse{ + OidcAuthMethodAuthenticateCallbackResponse: &authmethods.OidcAuthMethodAuthenticateCallbackResponse{ + FinalRedirectUrl: "public-final_redirect_url", + }, + }, + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateResponse{ + Command: "public-command", + Attrs: &services.AuthenticateResponse_OidcAuthMethodAuthenticateCallbackResponse{ + OidcAuthMethodAuthenticateCallbackResponse: &authmethods.OidcAuthMethodAuthenticateCallbackResponse{ + FinalRedirectUrl: "public-final_redirect_url", + }, + }, + }, + }, + }, + { + name: "validate-token-request-filtering", + testEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateRequest{ + AuthMethodId: "public-auth-method-id", + TokenType: "public-token-type", + Command: "public-command", + Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ + OidcAuthMethodAuthenticateTokenRequest: &authmethods.OidcAuthMethodAuthenticateTokenRequest{ + TokenId: "secret-token-id", }, }, }, @@ -125,7 +236,6 @@ func TestAuthenticate_Tags(t *testing.T) { AuthMethodId: "public-auth-method-id", TokenType: "public-token-type", Command: "public-command", - // TODO(johanbrandhorst): update redaction once typed attributes are available Attrs: &services.AuthenticateRequest_OidcAuthMethodAuthenticateTokenRequest{ OidcAuthMethodAuthenticateTokenRequest: &authmethods.OidcAuthMethodAuthenticateTokenRequest{ TokenId: encrypt.RedactedData, @@ -134,6 +244,33 @@ func TestAuthenticate_Tags(t *testing.T) { }, }, }, + { + name: "validate-token-response-filtering", + testEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateResponse{ + Command: "public-command", + Attrs: &services.AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse{ + OidcAuthMethodAuthenticateTokenResponse: &authmethods.OidcAuthMethodAuthenticateTokenResponse{ + Status: "public-status", + }, + }, + }, + }, + wantEvent: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &services.AuthenticateResponse{ + Command: "public-command", + Attrs: &services.AuthenticateResponse_OidcAuthMethodAuthenticateTokenResponse{ + OidcAuthMethodAuthenticateTokenResponse: &authmethods.OidcAuthMethodAuthenticateTokenResponse{ + Status: "public-status", + }, + }, + }, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go b/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go index 670625e6f..16dbd78ab 100644 --- a/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go +++ b/sdk/pbs/controller/api/resources/authmethods/auth_method.pb.go @@ -37,7 +37,7 @@ type AuthMethod struct { // The ID of the Scope of which this Auth Method is a part. ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. Scope information for this Auth method. - Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,omitempty" class:"public"` // @gotags: `class:"public"` + Scope *scopes.ScopeInfo `protobuf:"bytes,30,opt,name=scope,proto3" json:"scope,omitempty"` // Optional name for identification purposes. 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. @@ -239,9 +239,9 @@ type PasswordAuthMethodAttributes struct { unknownFields protoimpl.UnknownFields // The minimum length allowed for user names for Accounts in this Auth Method. - MinLoginNameLength uint32 `protobuf:"varint,10,opt,name=min_login_name_length,proto3" json:"min_login_name_length,omitempty"` + MinLoginNameLength uint32 `protobuf:"varint,10,opt,name=min_login_name_length,proto3" json:"min_login_name_length,omitempty" class:"public"` // @gotags: `class:"public"` // The minimum length allowed for passwords for Accounts in this Auth Method. - MinPasswordLength uint32 `protobuf:"varint,20,opt,name=min_password_length,proto3" json:"min_password_length,omitempty"` + MinPasswordLength uint32 `protobuf:"varint,20,opt,name=min_password_length,proto3" json:"min_password_length,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *PasswordAuthMethodAttributes) Reset() { @@ -298,46 +298,46 @@ type OidcAuthMethodAttributes struct { // Output only. The state of the auth method. Will be "inactive", // "active-private", or "active-public". - State string `protobuf:"bytes,10,opt,name=state,proto3" json:"state,omitempty"` + State string `protobuf:"bytes,10,opt,name=state,proto3" json:"state,omitempty" class:"public"` // @gotags: `class:"public"` // The issuer URL. Boundary expects only the schema, host, and port and will // strip off ".well-known/openid-configuration" if present. This will be // used for configuration discovery as well as for validation of the "iss" // claim. - Issuer *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer *wrapperspb.StringValue `protobuf:"bytes,20,opt,name=issuer,proto3" json:"issuer,omitempty" class:"public"` // @gotags: `class:"public"` // An OAuth 2.0 Client Identifier valid at the Authorization Server. - ClientId *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=client_id,proto3" json:"client_id,omitempty"` + ClientId *wrapperspb.StringValue `protobuf:"bytes,30,opt,name=client_id,proto3" json:"client_id,omitempty" class:"public"` // @gotags: `class:"public"` // Input only. The client's secret. - ClientSecret *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=client_secret,proto3" json:"client_secret,omitempty"` + ClientSecret *wrapperspb.StringValue `protobuf:"bytes,40,opt,name=client_secret,proto3" json:"client_secret,omitempty" class:"secret"` // @gotags: `class:"secret"` // Output only. The HMAC'd value of the clients secret to indicate whether // the client secret has changed. - ClientSecretHmac string `protobuf:"bytes,50,opt,name=client_secret_hmac,proto3" json:"client_secret_hmac,omitempty"` + ClientSecretHmac string `protobuf:"bytes,50,opt,name=client_secret_hmac,proto3" json:"client_secret_hmac,omitempty" class:"public"` // @gotags: `class:"public"` // The OIDC "max_age" parameter sent to the Authorization Server indicating // a maximum acceptable time in seconds since the user's last authentication // before requiring the user to reauthenticate. 0 indicates an immediate // need to reauthenticate. - MaxAge *wrapperspb.UInt32Value `protobuf:"bytes,60,opt,name=max_age,proto3" json:"max_age,omitempty"` + MaxAge *wrapperspb.UInt32Value `protobuf:"bytes,60,opt,name=max_age,proto3" json:"max_age,omitempty" class:"public"` // @gotags: `class:"public"` // The signing algorithms allowed for the auth method. - SigningAlgorithms []string `protobuf:"bytes,70,rep,name=signing_algorithms,proto3" json:"signing_algorithms,omitempty"` + SigningAlgorithms []string `protobuf:"bytes,70,rep,name=signing_algorithms,proto3" json:"signing_algorithms,omitempty" class:"public"` // @gotags: `class:"public"` // The prefix that should be used for any URLs needed during the // authentication flow. This includes the callback URL, the token retrieval // URL, and the redirection URL used by the OIDC Authorization Server. - ApiUrlPrefix *wrapperspb.StringValue `protobuf:"bytes,80,opt,name=api_url_prefix,proto3" json:"api_url_prefix,omitempty"` + ApiUrlPrefix *wrapperspb.StringValue `protobuf:"bytes,80,opt,name=api_url_prefix,proto3" json:"api_url_prefix,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The callback URL that should be configured on the // Authorization Server to use during the authentication flow. - CallbackUrl string `protobuf:"bytes,90,opt,name=callback_url,proto3" json:"callback_url,omitempty"` + CallbackUrl string `protobuf:"bytes,90,opt,name=callback_url,proto3" json:"callback_url,omitempty" class:"public"` // @gotags: `class:"public"` // Optional PEM-encoded X.509 CA certificates that can be used as trust anchors // when connecting to an OIDC provider. - IdpCaCerts []string `protobuf:"bytes,100,rep,name=idp_ca_certs,proto3" json:"idp_ca_certs,omitempty"` + IdpCaCerts []string `protobuf:"bytes,100,rep,name=idp_ca_certs,proto3" json:"idp_ca_certs,omitempty" class:"public"` // @gotags: `class:"public"` // Allowed audience claims for this auth method. - AllowedAudiences []string `protobuf:"bytes,110,rep,name=allowed_audiences,proto3" json:"allowed_audiences,omitempty"` + AllowedAudiences []string `protobuf:"bytes,110,rep,name=allowed_audiences,proto3" json:"allowed_audiences,omitempty" class:"public"` // @gotags: `class:"public"` // Optional claims scopes that will be requested during authentication. // see: https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims - ClaimsScopes []string `protobuf:"bytes,112,rep,name=claims_scopes,proto3" json:"claims_scopes,omitempty"` + ClaimsScopes []string `protobuf:"bytes,112,rep,name=claims_scopes,proto3" json:"claims_scopes,omitempty" class:"public"` // @gotags: `class:"public"` // account_claim_maps are optional claim maps from custom claims to the // standard claims of sub, name and email. These maps are represented as // key=value where the key equals the from_claim and the value equals the // to_claim. For example "oid=sub". - AccountClaimMaps []string `protobuf:"bytes,113,rep,name=account_claim_maps,proto3" json:"account_claim_maps,omitempty"` + AccountClaimMaps []string `protobuf:"bytes,113,rep,name=account_claim_maps,proto3" json:"account_claim_maps,omitempty" class:"public"` // @gotags: `class:"public"` // If the Authorization Server's discovered configuration contains values // that do not match the configuration set on this auth method, this can be // set to force the local configuration to override the discovered values. @@ -346,14 +346,14 @@ type OidcAuthMethodAttributes struct { // will be treated the same as "false"; that is, every time the method is // updated or the state is changed, this value must be set to "true" or it // will be disabled. - DisableDiscoveredConfigValidation bool `protobuf:"varint,120,opt,name=disable_discovered_config_validation,proto3" json:"disable_discovered_config_validation,omitempty"` + DisableDiscoveredConfigValidation bool `protobuf:"varint,120,opt,name=disable_discovered_config_validation,proto3" json:"disable_discovered_config_validation,omitempty" class:"public"` // @gotags: `class:"public"` // dry_run, when set on an update request, indicates that the changes should // not be persisted. Boundary will still perform the normal checks to confirm // the auth method is complete and validated against the discovered config. // This value will also be set on the returned resource when set in the request // along with the updated fields applied to the resource (but not persisted) as // a result of the update request. - DryRun bool `protobuf:"varint,130,opt,name=dry_run,proto3" json:"dry_run,omitempty"` + DryRun bool `protobuf:"varint,130,opt,name=dry_run,proto3" json:"dry_run,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *OidcAuthMethodAttributes) Reset() { @@ -690,7 +690,7 @@ type OidcAuthMethodAuthenticateTokenRequest struct { unknownFields protoimpl.UnknownFields // The ID of the pending token - TokenId string `protobuf:"bytes,10,opt,name=token_id,proto3" json:"token_id,omitempty" class:"private"` // @gotags: `class:"private"` + TokenId string `protobuf:"bytes,10,opt,name=token_id,proto3" json:"token_id,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *OidcAuthMethodAuthenticateTokenRequest) Reset() { From c8be4a9890f07d7c4d924f7cc799a0e6d8b8bf8d Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Wed, 13 Apr 2022 16:27:48 -0400 Subject: [PATCH 44/45] refact(target): Switch subtype attributes to oneof This updates the target resources to use a oneof for attributes. This allows requests to the targets service to leverage the new subtypes.AttributeTransformerInterceptor so that attributes are strongly typed prior to the service handler. --- .../api/resources/targets/v1/target.proto | 16 +- .../controller/handlers/targets/options.go | 44 -- .../controller/handlers/targets/registry.go | 48 +- .../handlers/targets/target_service.go | 25 +- .../targets/tcp/target_service_test.go | 80 ++- .../controller/handlers/targets/tcp/tcp.go | 26 +- internal/target/registry.go | 20 +- internal/tests/api/targets/target_test.go | 15 +- internal/types/subtypes/registry_global.go | 21 + .../api/resources/targets/target.pb.go | 594 ++++++++++-------- 10 files changed, 483 insertions(+), 406 deletions(-) delete mode 100644 internal/servers/controller/handlers/targets/options.go diff --git a/internal/proto/controller/api/resources/targets/v1/target.proto b/internal/proto/controller/api/resources/targets/v1/target.proto index eb0afac98..1059bb91c 100644 --- a/internal/proto/controller/api/resources/targets/v1/target.proto +++ b/internal/proto/controller/api/resources/targets/v1/target.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/struct.proto"; +import "google/api/visibility.proto"; import "controller/api/resources/scopes/v1/scope.proto"; import "controller/custom_options/v1/options.proto"; @@ -158,8 +159,19 @@ message Target { // Output only. The egress credential sources associated with this Target. repeated CredentialSource egress_credential_sources = 510 [json_name = "egress_credential_sources"]; - // The attributes that are applicable for the specific Target. - google.protobuf.Struct attributes = 200 [(custom_options.v1.generate_sdk_option) = true]; + oneof attrs { + // The attributes that are applicable for the specific Target. + google.protobuf.Struct attributes = 200 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "default" + ]; + TcpTargetAttributes tcp_target_attributes = 201 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "tcp" + ]; + } // Output only. The available actions on this resource for this user. repeated string authorized_actions = 300 [json_name = "authorized_actions"]; diff --git a/internal/servers/controller/handlers/targets/options.go b/internal/servers/controller/handlers/targets/options.go deleted file mode 100644 index 887a2cff3..000000000 --- a/internal/servers/controller/handlers/targets/options.go +++ /dev/null @@ -1,44 +0,0 @@ -package targets - -import ( - "github.com/hashicorp/boundary/internal/target" - "google.golang.org/protobuf/types/known/structpb" -) - -func getOpts(opt ...option) options { - opts := getDefaultOptions() - for _, o := range opt { - o(&opts) - } - return opts -} - -// Option - how Options are passed as arguments -type option func(*options) - -// options = how options are represented -type options struct { - withTarget target.Target - withStruct *structpb.Struct -} - -func getDefaultOptions() options { - return options{ - withTarget: nil, - withStruct: nil, - } -} - -// withTarget provides an option to provide a target.Target. -func withTarget(t target.Target) option { - return func(o *options) { - o.withTarget = t - } -} - -// withStruct provides an option to provide a structpb.Struct. -func withStruct(s *structpb.Struct) option { - return func(o *options) { - o.withStruct = s - } -} diff --git a/internal/servers/controller/handlers/targets/registry.go b/internal/servers/controller/handlers/targets/registry.go index 61f279f31..8b50b1ec3 100644 --- a/internal/servers/controller/handlers/targets/registry.go +++ b/internal/servers/controller/handlers/targets/registry.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/boundary/internal/servers/controller/handlers" "github.com/hashicorp/boundary/internal/target" "github.com/hashicorp/boundary/internal/types/subtypes" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/targets" "google.golang.org/protobuf/proto" ) @@ -21,11 +22,14 @@ type Attributes interface { Vet() map[string]string } -type attributeFunc func(target.Target) Attributes +type attributeFunc func(interface{}) Attributes + +type setAttributeFunc func(target.Target, *pb.Target) error type registryEntry struct { maskManager handlers.MaskManager attrFunc attributeFunc + setAttrFunc setAttributeFunc } type registry struct { @@ -56,45 +60,39 @@ func (r registry) maskManager(s subtypes.Subtype) (handlers.MaskManager, error) // newAttribute creates an Attribute for the given subtype. It delegates the // allocation of the Attribute to the registered attrFunc for the given -// subtype. An error is returned if the provided subtype is not registered. It -// supports the options of: -// -// - withTarget: The Attribute will be initialized based on the given -// target.Target. This initialization is delegated to the attrFunc. -// -// - withStruct: The Attribute will be initialized based on the given -// structpb.Struct. This is *not* delegated. -// -// These two options are mutually exclusive. If both are provided, and error is returned. -// If no options are provided an empty Attribute will be returned. -func (r registry) newAttribute(s subtypes.Subtype, opt ...option) (Attributes, error) { +// subtype. An error is returned if the provided subtype is not registered +func (r registry) newAttribute(s subtypes.Subtype, m interface{}) (Attributes, error) { re, err := r.get(s) if err != nil { return nil, err } - opts := getOpts(opt...) - if opts.withTarget != nil && opts.withStruct != nil { - return nil, fmt.Errorf("cannot use both withTarget and withStruct") - } - - attr := re.attrFunc(opts.withTarget) - if opts.withStruct != nil { - if err := handlers.StructToProto(opts.withStruct, attr); err != nil { - return nil, fmt.Errorf("Provided attributes don't match expected format.") - } - } + attr := re.attrFunc(m) return attr, nil } +// setAttributes is used to set the Attrs field on a pb.Target. It delegates the +// setting of the specific attribute type to the registered setAttributeFunc for +// the given subtype. An error is returned if the provided subtype is not +// registered. +func (r registry) setAttributes(s subtypes.Subtype, in target.Target, out *pb.Target) error { + re, err := r.get(s) + if err != nil { + return err + } + + return re.setAttrFunc(in, out) +} + var subtypeRegistry = registry{} // Register registers a subtype for used by the service handler. -func Register(s subtypes.Subtype, maskManager handlers.MaskManager, af attributeFunc) { +func Register(s subtypes.Subtype, maskManager handlers.MaskManager, af attributeFunc, sf setAttributeFunc) { if _, existed := subtypeRegistry.LoadOrStore(s, ®istryEntry{ maskManager: maskManager, attrFunc: af, + setAttrFunc: sf, }); existed { panic(fmt.Sprintf("subtype %s already registered", s)) } diff --git a/internal/servers/controller/handlers/targets/target_service.go b/internal/servers/controller/handlers/targets/target_service.go index ac020ae23..e8ab63f4d 100644 --- a/internal/servers/controller/handlers/targets/target_service.go +++ b/internal/servers/controller/handlers/targets/target_service.go @@ -211,14 +211,18 @@ func (s Service) ListTargets(ctx context.Context, req *pbs.ListTargetsRequest) ( return nil, err } - if filter.Match(item) { + filterable, err := subtypes.Filterable(item) + if err != nil { + return nil, err + } + if filter.Match(filterable) { finalItems = append(finalItems, item) } } return &pbs.ListTargetsResponse{Items: finalItems}, nil } -// GetTargets implements the interface pbs.TargetServiceServer. +// GetTarget implements the interface pbs.TargetServiceServer. func (s Service) GetTarget(ctx context.Context, req *pbs.GetTargetRequest) (*pbs.GetTargetResponse, error) { const op = "targets.(Service).GetTarget" @@ -1243,7 +1247,7 @@ func (s Service) createInRepo(ctx context.Context, item *pb.Target) (target.Targ opts = append(opts, target.WithWorkerFilter(item.GetWorkerFilter().GetValue())) } - attr, err := subtypeRegistry.newAttribute(target.SubtypeFromType(item.GetType()), withStruct(item.GetAttributes())) + attr, err := subtypeRegistry.newAttribute(target.SubtypeFromType(item.GetType()), item.GetAttrs()) if err != nil { return nil, nil, nil, handlers.ApiErrorWithCodeAndMessage(codes.InvalidArgument, err.Error()) } @@ -1287,7 +1291,7 @@ func (s Service) updateInRepo(ctx context.Context, scopeId, id string, mask []st } subtype := target.SubtypeFromId(id) - attr, err := subtypeRegistry.newAttribute(subtype, withStruct(item.GetAttributes())) + attr, err := subtypeRegistry.newAttribute(subtype, item.GetAttrs()) if err != nil { return nil, nil, nil, handlers.ApiErrorWithCodeAndMessage(codes.InvalidArgument, err.Error()) } @@ -1655,16 +1659,9 @@ func toProto(ctx context.Context, in target.Target, hostSources []target.HostSou } } if outputFields.Has(globals.AttributesField) { - attr, err := subtypeRegistry.newAttribute(in.GetType(), withTarget(in)) - if err != nil { + if err := subtypeRegistry.setAttributes(in.GetType(), in, &out); err != nil { return nil, errors.Wrap(ctx, err, op) } - - st, err := handlers.ProtoToStruct(attr) - if err != nil { - return nil, handlers.ApiErrorWithCodeAndMessage(codes.Internal, "failed building password attribute struct: %v", err) - } - out.Attributes = st } return &out, nil } @@ -1715,7 +1712,7 @@ func validateCreateRequest(req *pbs.CreateTargetRequest) error { if err != nil { badFields[globals.TypeField] = "Unknown type provided." } else { - a, err := subtypeRegistry.newAttribute(subtype, withStruct(req.GetItem().GetAttributes())) + a, err := subtypeRegistry.newAttribute(subtype, req.GetItem().GetAttrs()) if err != nil { badFields[globals.AttributesField] = "Attribute fields do not match the expected format." } else { @@ -1760,7 +1757,7 @@ func validateUpdateRequest(req *pbs.UpdateTargetRequest) error { badFields[globals.TypeField] = "Cannot modify the resource type." } - a, err := subtypeRegistry.newAttribute(subtype, withStruct(req.GetItem().GetAttributes())) + a, err := subtypeRegistry.newAttribute(subtype, req.GetItem().GetAttrs()) if err != nil { badFields[globals.AttributesField] = "Attribute fields do not match the expected format." } else { diff --git a/internal/servers/controller/handlers/targets/tcp/target_service_test.go b/internal/servers/controller/handlers/targets/tcp/target_service_test.go index b9ffe2936..5467c0d26 100644 --- a/internal/servers/controller/handlers/targets/tcp/target_service_test.go +++ b/internal/servers/controller/handlers/targets/tcp/target_service_test.go @@ -133,7 +133,7 @@ func TestGet(t *testing.T) { Type: tcp.Subtype.String(), HostSetIds: []string{hs[0].GetPublicId(), hs[1].GetPublicId()}, HostSourceIds: []string{hs[0].GetPublicId(), hs[1].GetPublicId()}, - Attributes: new(structpb.Struct), + Attrs: &pb.Target_TcpTargetAttributes{}, SessionMaxSeconds: wrapperspb.UInt32(28800), SessionConnectionLimit: wrapperspb.Int32(1), AuthorizedActions: testAuthorizedActions, @@ -227,7 +227,7 @@ func TestList(t *testing.T) { UpdatedTime: tar.GetUpdateTime().GetTimestamp(), Version: tar.GetVersion(), Type: tcp.Subtype.String(), - Attributes: new(structpb.Struct), + Attrs: &pb.Target_TcpTargetAttributes{}, SessionMaxSeconds: wrapperspb.UInt32(28800), SessionConnectionLimit: wrapperspb.Int32(1), AuthorizedActions: testAuthorizedActions, @@ -243,7 +243,7 @@ func TestList(t *testing.T) { UpdatedTime: tar.GetUpdateTime().GetTimestamp(), Version: tar.GetVersion(), Type: tcp.Subtype.String(), - Attributes: new(structpb.Struct), + Attrs: &pb.Target_TcpTargetAttributes{}, SessionMaxSeconds: wrapperspb.UInt32(28800), SessionConnectionLimit: wrapperspb.Int32(1), AuthorizedActions: testAuthorizedActions, @@ -323,7 +323,7 @@ func TestList(t *testing.T) { require.Nil(item.SessionMaxSeconds) require.Nil(item.SessionConnectionLimit) require.Empty(item.WorkerFilter) - require.Nil(item.Attributes) + require.Nil(item.Attrs) } }) } @@ -447,9 +447,11 @@ func TestCreate(t *testing.T) { Name: wrapperspb.String("name"), Description: wrapperspb.String("desc"), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, WorkerFilter: wrapperspb.String(`type == "bar"`), }}, res: &pbs.CreateTargetResponse{ @@ -460,9 +462,11 @@ func TestCreate(t *testing.T) { Name: wrapperspb.String("name"), Description: wrapperspb.String("desc"), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, SessionMaxSeconds: wrapperspb.UInt32(28800), SessionConnectionLimit: wrapperspb.Int32(1), AuthorizedActions: testAuthorizedActions, @@ -476,9 +480,11 @@ func TestCreate(t *testing.T) { Name: wrapperspb.String("name"), Description: wrapperspb.String("desc"), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(0), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, }}, err: handlers.ApiErrorWithCode(codes.InvalidArgument), }, @@ -654,9 +660,11 @@ func TestUpdate(t *testing.T) { Name: wrapperspb.String("name"), Description: wrapperspb.String("desc"), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, CreatedTime: tar.GetCreateTime().GetTimestamp(), HostSetIds: hsIds, HostSets: hostSets, @@ -689,9 +697,11 @@ func TestUpdate(t *testing.T) { Description: wrapperspb.String("desc"), CreatedTime: tar.GetCreateTime().GetTimestamp(), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, HostSetIds: hsIds, HostSets: hostSets, HostSourceIds: hostSourceIds, @@ -728,9 +738,11 @@ func TestUpdate(t *testing.T) { req: &pbs.UpdateTargetRequest{ UpdateMask: &field_mask.FieldMask{Paths: []string{"default_port"}}, Item: &pb.Target{ - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(0), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(0), + }, + }, }, }, err: handlers.ApiErrorWithCode(codes.InvalidArgument), @@ -776,9 +788,11 @@ func TestUpdate(t *testing.T) { Name: wrapperspb.String("default"), CreatedTime: tar.GetCreateTime().GetTimestamp(), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, HostSetIds: hsIds, HostSets: hostSets, HostSourceIds: hostSourceIds, @@ -809,9 +823,11 @@ func TestUpdate(t *testing.T) { Description: wrapperspb.String("default"), CreatedTime: tar.GetCreateTime().GetTimestamp(), Type: tcp.Subtype.String(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, HostSetIds: hsIds, HostSets: hostSets, HostSourceIds: hostSourceIds, @@ -841,9 +857,11 @@ func TestUpdate(t *testing.T) { Name: wrapperspb.String("default"), Description: wrapperspb.String("notignored"), CreatedTime: tar.GetCreateTime().GetTimestamp(), - Attributes: &structpb.Struct{Fields: map[string]*structpb.Value{ - "default_port": structpb.NewNumberValue(2), - }}, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: wrapperspb.UInt32(2), + }, + }, Type: tcp.Subtype.String(), HostSetIds: hsIds, HostSets: hostSets, diff --git a/internal/servers/controller/handlers/targets/tcp/tcp.go b/internal/servers/controller/handlers/targets/tcp/tcp.go index 1fca85bbc..be182e94a 100644 --- a/internal/servers/controller/handlers/targets/tcp/tcp.go +++ b/internal/servers/controller/handlers/targets/tcp/tcp.go @@ -30,18 +30,32 @@ func (a *attribute) Vet() map[string]string { return badFields } -func newAttribute(t target.Target) targets.Attributes { +func newAttribute(m interface{}) targets.Attributes { a := &attribute{ &pb.TcpTargetAttributes{}, } - if t != nil { - if t.GetDefaultPort() > 0 { - a.DefaultPort = &wrappers.UInt32Value{Value: t.GetDefaultPort()} - } + if tcpAttr, ok := m.(*pb.Target_TcpTargetAttributes); ok { + a.TcpTargetAttributes = tcpAttr.TcpTargetAttributes } return a } +func setAttributes(t target.Target, out *pb.Target) error { + if t == nil { + return nil + } + + attrs := &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{}, + } + if t.GetDefaultPort() > 0 { + attrs.TcpTargetAttributes.DefaultPort = &wrappers.UInt32Value{Value: t.GetDefaultPort()} + } + + out.Attrs = attrs + return nil +} + func init() { var maskManager handlers.MaskManager var err error @@ -53,5 +67,5 @@ func init() { panic(err) } - targets.Register(tcp.Subtype, maskManager, newAttribute) + targets.Register(tcp.Subtype, maskManager, newAttribute, setAttributes) } diff --git a/internal/target/registry.go b/internal/target/registry.go index 226025e83..46a6854be 100644 --- a/internal/target/registry.go +++ b/internal/target/registry.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/boundary/internal/types/subtypes" ) +const domain = "target" + // NewFunc is a function that creates a Target with the provided scope and options. type NewFunc func(scopeId string, opt ...Option) (Target, error) @@ -32,8 +34,7 @@ type registryEntry struct { } type registry struct { - m map[subtypes.Subtype]*registryEntry - subtypes *subtypes.Registry + m map[subtypes.Subtype]*registryEntry sync.RWMutex } @@ -47,7 +48,7 @@ func (r *registry) set(s subtypes.Subtype, entry *registryEntry) { panic(fmt.Sprintf("target subtype %s already registered", s)) } - if err := r.subtypes.Register(s, entry.prefix); err != nil { + if err := subtypes.Register(domain, s, entry.prefix); err != nil { panic(err) } @@ -106,29 +107,24 @@ func (r *registry) idPrefix(s subtypes.Subtype) (string, bool) { } var subtypeRegistry = registry{ - m: make(map[subtypes.Subtype]*registryEntry), - subtypes: subtypes.NewRegistry(), + m: make(map[subtypes.Subtype]*registryEntry), } // 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 { - subtypeRegistry.RLock() - defer subtypeRegistry.RUnlock() - return subtypeRegistry.subtypes.SubtypeFromType(t) + return subtypes.SubtypeFromType(domain, 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 { - subtypeRegistry.RLock() - defer subtypeRegistry.RUnlock() - return subtypeRegistry.subtypes.SubtypeFromId(id) + return subtypes.SubtypeFromId(domain, id) } // Prefixes returns the list of all known target Prefixes. func Prefixes() []string { - return subtypeRegistry.subtypes.Prefixes() + return subtypes.Prefixes(domain) } // New creates a Target of the given subtype and scopeId. diff --git a/internal/tests/api/targets/target_test.go b/internal/tests/api/targets/target_test.go index 855b176e6..f2d9d7d92 100644 --- a/internal/tests/api/targets/target_test.go +++ b/internal/tests/api/targets/target_test.go @@ -169,7 +169,13 @@ func TestList(t *testing.T) { assert.ElementsMatch(comparableSlice(expected[:1]), comparableSlice(ul.Items)) for i := 1; i < 10; i++ { - tcr, err = tarClient.Create(tc.Context(), "tcp", proj.GetPublicId(), targets.WithName(expected[i].Name)) + tcr, err = tarClient.Create( + tc.Context(), + "tcp", + proj.GetPublicId(), + targets.WithName(expected[i].Name), + targets.WithTcpTargetDefaultPort(uint32(i)), + ) require.NoError(err) expected[i] = tcr.Item } @@ -183,6 +189,13 @@ func TestList(t *testing.T) { require.NoError(err) assert.Len(ul.Items, 1) assert.Equal(filterItem.Id, ul.Items[0].Id) + + filterstr := fmt.Sprintf(`"/item/attributes/default_port"==%d`, uint32(filterItem.Attributes["default_port"].(float64))) + ul, err = tarClient.List(tc.Context(), proj.GetPublicId(), + targets.WithFilter(filterstr)) + require.NoError(err) + assert.Len(ul.Items, 1) + assert.Equal(filterItem.Id, ul.Items[0].Id) } func comparableSlice(in []*targets.Target) []targets.Target { diff --git a/internal/types/subtypes/registry_global.go b/internal/types/subtypes/registry_global.go index 85bdfc9a7..9c8a1804c 100644 --- a/internal/types/subtypes/registry_global.go +++ b/internal/types/subtypes/registry_global.go @@ -70,6 +70,22 @@ func (r *registry) subtypeFromId(domain, id string) Subtype { return subtype } +func (r *registry) prefixes(domain string) []string { + r.RLock() + defer r.RUnlock() + + subtypePrefixes, ok := r.subtypesPrefixes[domain] + if !ok { + return nil + } + + ret := make([]string, 0, len(subtypePrefixes)) + for p := range subtypePrefixes { + ret = append(ret, p) + } + return ret +} + // 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. @@ -123,6 +139,11 @@ func SubtypeFromId(domain, id string) Subtype { return globalRegistry.subtypeFromId(domain, id) } +// Prefixes returns the list of all known Prefixes for a domain. +func Prefixes(domain string) []string { + return globalRegistry.prefixes(domain) +} + // 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. diff --git a/sdk/pbs/controller/api/resources/targets/target.pb.go b/sdk/pbs/controller/api/resources/targets/target.pb.go index 225d1f410..001e04dc3 100644 --- a/sdk/pbs/controller/api/resources/targets/target.pb.go +++ b/sdk/pbs/controller/api/resources/targets/target.pb.go @@ -9,6 +9,7 @@ package targets import ( 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" @@ -510,8 +511,10 @@ type Target struct { EgressCredentialSourceIds []string `protobuf:"bytes,500,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty"` // Output only. The egress credential sources associated with this Target. EgressCredentialSources []*CredentialSource `protobuf:"bytes,510,rep,name=egress_credential_sources,proto3" json:"egress_credential_sources,omitempty"` - // The attributes that are applicable for the specific Target. - Attributes *structpb.Struct `protobuf:"bytes,200,opt,name=attributes,proto3" json:"attributes,omitempty"` + // Types that are assignable to Attrs: + // *Target_Attributes + // *Target_TcpTargetAttributes + Attrs isTarget_Attrs `protobuf_oneof:"attrs"` // 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"` } @@ -704,13 +707,27 @@ func (x *Target) GetEgressCredentialSources() []*CredentialSource { return nil } +func (m *Target) GetAttrs() isTarget_Attrs { + if m != nil { + return m.Attrs + } + return nil +} + func (x *Target) GetAttributes() *structpb.Struct { - if x != nil { + if x, ok := x.GetAttrs().(*Target_Attributes); ok { return x.Attributes } return nil } +func (x *Target) GetTcpTargetAttributes() *TcpTargetAttributes { + if x, ok := x.GetAttrs().(*Target_TcpTargetAttributes); ok { + return x.TcpTargetAttributes + } + return nil +} + func (x *Target) GetAuthorizedActions() []string { if x != nil { return x.AuthorizedActions @@ -718,6 +735,23 @@ func (x *Target) GetAuthorizedActions() []string { return nil } +type isTarget_Attrs interface { + isTarget_Attrs() +} + +type Target_Attributes struct { + // The attributes that are applicable for the specific Target. + Attributes *structpb.Struct `protobuf:"bytes,200,opt,name=attributes,proto3,oneof"` +} + +type Target_TcpTargetAttributes struct { + TcpTargetAttributes *TcpTargetAttributes `protobuf:"bytes,201,opt,name=tcp_target_attributes,json=tcpTargetAttributes,proto3,oneof"` +} + +func (*Target_Attributes) isTarget_Attrs() {} + +func (*Target_TcpTargetAttributes) isTarget_Attrs() {} + // TcpTargetAttributes contains attributes relevant to Targets of type "tcp" type TcpTargetAttributes struct { state protoimpl.MessageState @@ -1166,270 +1200,283 @@ var file_controller_api_resources_targets_v1_target_proto_rawDesc = []byte{ 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, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x46, 0x0a, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 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, 0x22, 0x43, 0x0a, 0x07, 0x48, 0x6f, - 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, - 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x22, - 0xc7, 0x01, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x13, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x11, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x28, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, - 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x3c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x54, 0x0a, 0x0d, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x72, 0x61, 0x77, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x61, 0x77, 0x12, 0x31, - 0x0a, 0x07, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, - 0x64, 0x22, 0xe7, 0x02, 0x0a, 0x11, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x62, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x10, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x69, 0x0a, 0x12, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x42, - 0x02, 0x18, 0x01, 0x52, 0x11, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, - 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x12, 0x37, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, - 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xa4, 0x0e, 0x0a, 0x06, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, - 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, - 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x62, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x32, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x42, 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x50, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x12, 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, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, - 0x74, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x52, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, - 0x73, 0x12, 0x29, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x5f, 0x69, 0x64, 0x73, 0x18, 0xa4, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, - 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x54, 0x0a, 0x0c, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0xae, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 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, + 0x46, 0x0a, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x22, 0x43, 0x0a, 0x07, 0x48, 0x6f, 0x73, 0x74, 0x53, + 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, + 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x22, 0xc7, 0x01, 0x0a, + 0x10, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x28, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, + 0x0f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x1e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x13, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x5f, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x3c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x54, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x61, 0x77, 0x12, 0x31, 0x0a, 0x07, 0x64, + 0x65, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x07, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x22, 0xe7, + 0x02, 0x0a, 0x11, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x12, 0x62, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x10, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x69, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 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, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x42, 0x02, 0x18, 0x01, + 0x52, 0x11, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x12, 0x4a, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x14, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x32, 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, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x12, 0x80, 0x01, 0x0a, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, - 0x61, 0x78, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x30, - 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x28, 0x0a, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x11, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, - 0x52, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x65, - 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x94, 0x01, 0x0a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, - 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x3a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x32, - 0x0a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x52, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x6a, 0x0a, 0x0d, - 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x8c, 0x01, - 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, 0x0d, 0x77, 0x6f, - 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x0c, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x65, - 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x53, 0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x96, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x87, 0x01, - 0x0a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, - 0x65, 0x73, 0x18, 0xb4, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x42, 0x02, 0x18, 0x01, 0x52, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, - 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x90, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x7e, 0x0a, 0x1e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x9a, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x1e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, - 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0xf4, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, - 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x74, 0x0a, 0x19, 0x65, - 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0xfe, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x19, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x12, 0x3e, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, - 0xc8, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, - 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x13, 0x54, 0x63, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x70, 0x0a, 0x0c, 0x64, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 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, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x2e, - 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x26, 0x0a, 0x17, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x0b, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0c, - 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x26, 0x0a, 0x0a, - 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x22, 0xed, 0x03, 0x0a, 0x18, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, - 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x12, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, + 0x37, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x28, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xd9, 0x0f, 0x0a, 0x06, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x18, 0x28, 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, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x5a, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, - 0x69, 0x6d, 0x69, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x65, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x70, 0x72, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x6f, 0x73, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x8c, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x73, - 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, - 0x8d, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x12, 0x52, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x96, 0x01, 0x20, 0x03, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, - 0x69, 0x6e, 0x66, 0x6f, 0x22, 0xeb, 0x03, 0x0a, 0x14, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, - 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, - 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 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, + 0x63, 0x6f, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x42, 0x14, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x0c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x62, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x32, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, + 0x22, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x1a, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 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, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x32, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x68, 0x6f, - 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x3c, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, - 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, - 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x22, 0x50, 0x0a, 0x16, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, - 0x72, 0x64, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1a, 0x0a, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x42, 0x50, 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, - 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x3b, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, + 0x6e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, + 0x53, 0x65, 0x74, 0x52, 0x09, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x12, 0x29, + 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x73, 0x18, 0xa4, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x54, 0x0a, 0x0c, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0xae, 0x03, 0x20, 0x03, 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, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, + 0x80, 0x01, 0x0a, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x5f, + 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x30, 0xa0, 0xda, 0x29, + 0x01, 0xc2, 0xdd, 0x29, 0x28, 0x0a, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, + 0x61, 0x78, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x11, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x13, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, + 0x64, 0x73, 0x12, 0x94, 0x01, 0x0a, 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, + 0x82, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x42, 0x3a, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x32, 0x0a, 0x18, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, + 0x18, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x6a, 0x0a, 0x0d, 0x77, 0x6f, 0x72, + 0x6b, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x8c, 0x01, 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, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x65, + 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x0c, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0d, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x53, 0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, + 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x96, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x87, 0x01, 0x0a, 0x20, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, + 0xb4, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x42, 0x02, + 0x18, 0x01, 0x52, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x69, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x90, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x73, 0x12, 0x7e, 0x0a, 0x1e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x9a, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x1e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, + 0x69, 0x64, 0x73, 0x18, 0xf4, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, 0x67, 0x72, 0x65, + 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x74, 0x0a, 0x19, 0x65, 0x67, 0x72, 0x65, + 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0xfe, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x52, 0x19, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x5b, + 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0xc8, 0x01, 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, 0x1f, 0xa0, 0xda, + 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0xfa, 0xd2, 0xe4, + 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x8c, 0x01, 0x0a, 0x15, + 0x74, 0x63, 0x70, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x54, 0x63, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x42, 0x1b, 0xa0, 0xda, 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x03, + 0x74, 0x63, 0x70, 0xfa, 0xd2, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, + 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, 0x13, 0x74, 0x63, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, 0x0a, 0x12, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0xac, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x61, + 0x74, 0x74, 0x72, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x13, 0x54, 0x63, 0x70, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x70, 0x0a, 0x0c, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 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, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x42, 0x2e, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x26, 0x0a, 0x17, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x0b, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x6f, 0x72, 0x74, + 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x26, + 0x0a, 0x0a, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0xed, 0x03, 0x0a, 0x18, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, + 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x28, 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, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x5a, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x78, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x82, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, + 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x68, + 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x8c, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, + 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x8d, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x96, 0x01, 0x20, 0x03, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x57, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, + 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0xeb, 0x03, 0x0a, 0x14, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x12, + 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 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, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x28, 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, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x32, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, + 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x3c, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x46, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x13, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x61, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1a, + 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x6e, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x36, 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, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x73, 0x22, 0x50, 0x0a, 0x16, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1a, + 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0x50, 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, + 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x3b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1485,18 +1532,19 @@ var file_controller_api_resources_targets_v1_target_proto_depIdxs = []int32{ 2, // 16: controller.api.resources.targets.v1.Target.application_credential_sources:type_name -> controller.api.resources.targets.v1.CredentialSource 2, // 17: controller.api.resources.targets.v1.Target.egress_credential_sources:type_name -> controller.api.resources.targets.v1.CredentialSource 12, // 18: controller.api.resources.targets.v1.Target.attributes:type_name -> google.protobuf.Struct - 16, // 19: controller.api.resources.targets.v1.TcpTargetAttributes.default_port:type_name -> google.protobuf.UInt32Value - 13, // 20: controller.api.resources.targets.v1.SessionAuthorizationData.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo - 15, // 21: controller.api.resources.targets.v1.SessionAuthorizationData.created_time:type_name -> google.protobuf.Timestamp - 8, // 22: controller.api.resources.targets.v1.SessionAuthorizationData.worker_info:type_name -> controller.api.resources.targets.v1.WorkerInfo - 13, // 23: controller.api.resources.targets.v1.SessionAuthorization.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo - 15, // 24: controller.api.resources.targets.v1.SessionAuthorization.created_time:type_name -> google.protobuf.Timestamp - 5, // 25: controller.api.resources.targets.v1.SessionAuthorization.credentials:type_name -> controller.api.resources.targets.v1.SessionCredential - 26, // [26:26] is the sub-list for method output_type - 26, // [26:26] is the sub-list for method input_type - 26, // [26:26] is the sub-list for extension type_name - 26, // [26:26] is the sub-list for extension extendee - 0, // [0:26] is the sub-list for field type_name + 7, // 19: controller.api.resources.targets.v1.Target.tcp_target_attributes:type_name -> controller.api.resources.targets.v1.TcpTargetAttributes + 16, // 20: controller.api.resources.targets.v1.TcpTargetAttributes.default_port:type_name -> google.protobuf.UInt32Value + 13, // 21: controller.api.resources.targets.v1.SessionAuthorizationData.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo + 15, // 22: controller.api.resources.targets.v1.SessionAuthorizationData.created_time:type_name -> google.protobuf.Timestamp + 8, // 23: controller.api.resources.targets.v1.SessionAuthorizationData.worker_info:type_name -> controller.api.resources.targets.v1.WorkerInfo + 13, // 24: controller.api.resources.targets.v1.SessionAuthorization.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo + 15, // 25: controller.api.resources.targets.v1.SessionAuthorization.created_time:type_name -> google.protobuf.Timestamp + 5, // 26: controller.api.resources.targets.v1.SessionAuthorization.credentials:type_name -> controller.api.resources.targets.v1.SessionCredential + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_controller_api_resources_targets_v1_target_proto_init() } @@ -1650,6 +1698,10 @@ func file_controller_api_resources_targets_v1_target_proto_init() { } } } + file_controller_api_resources_targets_v1_target_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*Target_Attributes)(nil), + (*Target_TcpTargetAttributes)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ From 3be5c44907ddf56cdcd7d9f7a62adbc5907ac7db Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 14 Apr 2022 14:34:58 -0400 Subject: [PATCH 45/45] feat(target): Classify resources for audit events --- Makefile | 1 + .../api/services/target_service.pb.go | 1034 +++++++++-------- .../api/resources/targets/v1/target.proto | 89 +- .../api/services/v1/target_service.proto | 109 +- .../handlers/targets/target_service.go | 5 +- .../tests/api/targets/classification_test.go | 353 ++++++ .../api/resources/targets/target.pb.go | 83 +- 7 files changed, 1017 insertions(+), 657 deletions(-) create mode 100644 internal/tests/api/targets/classification_test.go diff --git a/Makefile b/Makefile index 2711390b2..0296e5f6f 100644 --- a/Makefile +++ b/Makefile @@ -156,6 +156,7 @@ protobuild: @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/scopes/scope.pb.go @protoc-go-inject-tag -input=./internal/gen/controller/servers/services/session_service.pb.go @protoc-go-inject-tag -input=./sdk/pbs/controller/api/resources/targets/target.pb.go + @protoc-go-inject-tag -input=./internal/gen/controller/api/services/target_service.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 diff --git a/internal/gen/controller/api/services/target_service.pb.go b/internal/gen/controller/api/services/target_service.pb.go index afbef79c3..d2d6f9b3b 100644 --- a/internal/gen/controller/api/services/target_service.pb.go +++ b/internal/gen/controller/api/services/target_service.pb.go @@ -9,6 +9,7 @@ package services import ( _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" targets "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/targets" + _ "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 GetTargetRequest 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 *GetTargetRequest) Reset() { @@ -123,9 +124,9 @@ type ListTargetsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` - Filter string `protobuf:"bytes,30,opt,name=filter,proto3" json:"filter,omitempty"` + ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` + Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,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 *ListTargetsRequest) Reset() { @@ -280,7 +281,7 @@ type CreateTargetResponse 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 *targets.Target `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` } @@ -335,7 +336,7 @@ type UpdateTargetRequest 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 *targets.Target `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"` } @@ -445,7 +446,7 @@ type DeleteTargetRequest 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 *DeleteTargetRequest) Reset() { @@ -530,11 +531,11 @@ type AddTargetHostSetsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - HostSetIds []string `protobuf:"bytes,3,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + HostSetIds []string `protobuf:"bytes,3,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddTargetHostSetsRequest) Reset() { @@ -642,11 +643,11 @@ type SetTargetHostSetsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - HostSetIds []string `protobuf:"bytes,3,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + HostSetIds []string `protobuf:"bytes,3,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetTargetHostSetsRequest) Reset() { @@ -754,11 +755,11 @@ type RemoveTargetHostSetsRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - HostSetIds []string `protobuf:"bytes,3,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + HostSetIds []string `protobuf:"bytes,3,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveTargetHostSetsRequest) Reset() { @@ -866,11 +867,11 @@ type AddTargetHostSourcesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - HostSourceIds []string `protobuf:"bytes,3,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + HostSourceIds []string `protobuf:"bytes,3,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddTargetHostSourcesRequest) Reset() { @@ -978,11 +979,11 @@ type SetTargetHostSourcesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - HostSourceIds []string `protobuf:"bytes,3,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + HostSourceIds []string `protobuf:"bytes,3,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetTargetHostSourcesRequest) Reset() { @@ -1090,11 +1091,11 @@ type RemoveTargetHostSourcesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - HostSourceIds []string `protobuf:"bytes,3,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + HostSourceIds []string `protobuf:"bytes,3,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveTargetHostSourcesRequest) Reset() { @@ -1202,11 +1203,11 @@ type AddTargetCredentialLibrariesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - ApplicationCredentialLibraryIds []string `protobuf:"bytes,3,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + ApplicationCredentialLibraryIds []string `protobuf:"bytes,3,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddTargetCredentialLibrariesRequest) Reset() { @@ -1317,11 +1318,11 @@ type SetTargetCredentialLibrariesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - ApplicationCredentialLibraryIds []string `protobuf:"bytes,3,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + ApplicationCredentialLibraryIds []string `protobuf:"bytes,3,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetTargetCredentialLibrariesRequest) Reset() { @@ -1429,11 +1430,11 @@ type RemoveTargetCredentialLibrariesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - ApplicationCredentialLibraryIds []string `protobuf:"bytes,3,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + ApplicationCredentialLibraryIds []string `protobuf:"bytes,3,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveTargetCredentialLibrariesRequest) Reset() { @@ -1541,12 +1542,12 @@ type AddTargetCredentialSourcesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - ApplicationCredentialSourceIds []string `protobuf:"bytes,3,rep,name=application_credential_source_ids,proto3" json:"application_credential_source_ids,omitempty"` - EgressCredentialSourceIds []string `protobuf:"bytes,4,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + ApplicationCredentialSourceIds []string `protobuf:"bytes,3,rep,name=application_credential_source_ids,proto3" json:"application_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` + EgressCredentialSourceIds []string `protobuf:"bytes,4,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AddTargetCredentialSourcesRequest) Reset() { @@ -1663,12 +1664,12 @@ type SetTargetCredentialSourcesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - ApplicationCredentialSourceIds []string `protobuf:"bytes,3,rep,name=application_credential_source_ids,proto3" json:"application_credential_source_ids,omitempty"` - EgressCredentialSourceIds []string `protobuf:"bytes,4,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + ApplicationCredentialSourceIds []string `protobuf:"bytes,3,rep,name=application_credential_source_ids,proto3" json:"application_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` + EgressCredentialSourceIds []string `protobuf:"bytes,4,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *SetTargetCredentialSourcesRequest) Reset() { @@ -1783,12 +1784,12 @@ type RemoveTargetCredentialSourcesRequest 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"` // Version is used 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,2,opt,name=version,proto3" json:"version,omitempty"` - ApplicationCredentialSourceIds []string `protobuf:"bytes,3,rep,name=application_credential_source_ids,json=application_credential_source_id,proto3" json:"application_credential_source_ids,omitempty"` - EgressCredentialSourceIds []string `protobuf:"bytes,4,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty"` + Version uint32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty" class:"public"` // @gotags: `class:"public"` + ApplicationCredentialSourceIds []string `protobuf:"bytes,3,rep,name=application_credential_source_ids,json=application_credential_source_id,proto3" json:"application_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` + EgressCredentialSourceIds []string `protobuf:"bytes,4,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *RemoveTargetCredentialSourcesRequest) Reset() { @@ -1904,15 +1905,15 @@ type AuthorizeSessionRequest struct { unknownFields protoimpl.UnknownFields // The ID of the target. Required unless some combination of scope_id/scope_name and name are set. - 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"` // The name of the target. When using this, scope_id or scope_name must be set. - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // The scope ID containing the target, if specifying the target by name. - ScopeId string `protobuf:"bytes,4,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,4,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty" class:"public"` // @gotags: `class:"public"` // The scope name containing the target, if specifying the target by name. - ScopeName string `protobuf:"bytes,5,opt,name=scope_name,json=scopeName,proto3" json:"scope_name,omitempty"` + ScopeName string `protobuf:"bytes,5,opt,name=scope_name,json=scopeName,proto3" json:"scope_name,omitempty" class:"public"` // @gotags: `class:"public"` // An optional parameter allowing specification of the particular Host within the Target's configured Host Sets to connect to during this Session. - HostId string `protobuf:"bytes,2,opt,name=host_id,proto3" json:"host_id,omitempty"` + HostId string `protobuf:"bytes,2,opt,name=host_id,proto3" json:"host_id,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *AuthorizeSessionRequest) Reset() { @@ -2046,529 +2047,532 @@ var file_controller_api_services_v1_target_service_proto_rawDesc = []byte{ 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x22, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x54, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 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, 0x22, 0x0a, 0x10, 0x47, + 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 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, + 0x54, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x65, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, + 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, + 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, + 0x73, 0x69, 0x76, 0x65, 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, 0x58, 0x0a, 0x13, + 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x56, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3f, 0x0a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x69, + 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa4, 0x01, 0x0a, 0x13, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x57, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x65, 0x0a, 0x12, 0x4c, 0x69, 0x73, - 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, - 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, - 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 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, 0x58, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x56, 0x0a, 0x13, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x69, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, - 0x65, 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, 0x3f, 0x0a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa4, 0x01, - 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, + 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x25, 0x0a, 0x13, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, + 0x0a, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, + 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x19, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x22, 0x68, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, + 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, + 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, + 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x19, 0x53, 0x65, + 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6b, 0x0a, 0x1b, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, + 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5f, 0x0a, 0x1c, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x57, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x25, 0x0a, - 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 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, 0x16, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x68, 0x0a, 0x18, - 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, - 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, - 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5c, 0x0a, 0x19, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, - 0x69, 0x74, 0x65, 0x6d, 0x22, 0x68, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x6f, - 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5c, - 0x0a, 0x19, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x6b, 0x0a, 0x1b, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, - 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, - 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, 0x73, - 0x74, 0x5f, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5f, 0x0a, 0x1c, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, + 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x71, 0x0a, 0x1b, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5f, 0x0a, 0x1c, 0x41, 0x64, 0x64, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x71, 0x0a, 0x1b, 0x41, 0x64, - 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x71, 0x0a, 0x1b, 0x53, 0x65, + 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x5f, 0x0a, - 0x1c, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, + 0x1c, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x71, - 0x0a, 0x1b, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x73, 0x22, 0x5f, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, - 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0x74, 0x0a, 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, - 0x0a, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x62, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x9f, 0x01, 0x0a, - 0x23, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4e, - 0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, - 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x67, - 0x0a, 0x24, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x9f, 0x01, 0x0a, 0x23, 0x53, 0x65, 0x74, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, - 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x22, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, - 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x67, 0x0a, 0x24, 0x53, 0x65, 0x74, + 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x74, + 0x0a, 0x1e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, + 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x68, 0x6f, + 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x73, 0x22, 0x62, 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x9f, 0x01, 0x0a, 0x23, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x22, 0xa2, 0x01, 0x0a, 0x26, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, - 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, - 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x6a, 0x0a, 0x27, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x22, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x67, 0x0a, 0x24, 0x41, 0x64, + 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x22, 0xdf, 0x01, 0x0a, 0x21, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x74, 0x65, 0x6d, 0x22, 0x9f, 0x01, 0x0a, 0x23, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, + 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x67, 0x0a, 0x24, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xa2, + 0x01, 0x0a, 0x26, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x21, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x6f, 0x6e, 0x12, 0x4e, 0x0a, 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x22, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, + 0x69, 0x64, 0x73, 0x22, 0x6a, 0x0a, 0x27, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, + 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, + 0xdf, 0x01, 0x0a, 0x21, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x4c, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, + 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x21, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x42, 0x0a, + 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x73, 0x12, 0x42, 0x0a, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, - 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x65, 0x0a, 0x22, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xdf, 0x01, 0x0a, - 0x21, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x21, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x42, 0x0a, 0x1c, 0x65, 0x67, - 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x65, - 0x0a, 0x22, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xe1, 0x01, 0x0a, 0x24, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x73, 0x22, 0x65, 0x0a, 0x22, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0xdf, 0x01, 0x0a, 0x21, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4b, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4c, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x03, 0x28, 0x09, 0x52, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, - 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, 0x67, 0x72, - 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x68, 0x0a, 0x25, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, - 0x74, 0x65, 0x6d, 0x22, 0x91, 0x01, 0x0a, 0x17, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, - 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x69, 0x0a, 0x18, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x39, 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, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x32, 0x97, 0x20, 0x0a, 0x0d, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0xa2, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 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, - 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 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, 0x47, 0x65, - 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x38, 0x92, 0x41, 0x17, 0x12, 0x15, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, - 0x67, 0x6c, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x18, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, - 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x9a, 0x01, 0x0a, 0x0b, 0x4c, 0x69, - 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 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, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x92, 0x41, 0x14, 0x12, - 0x12, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0xaf, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2f, 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, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x92, 0x41, 0x1a, 0x12, - 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, - 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, - 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xad, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2f, 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, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x92, 0x41, - 0x13, 0x12, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x32, 0x10, 0x2f, 0x76, 0x31, 0x2f, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa1, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2f, 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, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x92, 0x41, - 0x13, 0x12, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x2a, 0x10, 0x2f, 0x76, 0x31, 0x2f, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xcc, 0x01, 0x0a, - 0x10, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4d, 0x92, 0x41, - 0x17, 0x12, 0x15, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x73, 0x20, 0x61, 0x20, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x22, 0x22, - 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x3a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x2d, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xda, 0x01, 0x0a, 0x11, - 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, - 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, - 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x58, - 0x92, 0x41, 0x26, 0x12, 0x24, 0x41, 0x64, 0x64, 0x73, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, - 0x6e, 0x67, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x61, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, - 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, - 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, - 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xd7, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x74, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x34, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x12, 0x42, 0x0a, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, + 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, 0x67, + 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x65, 0x0a, 0x22, 0x53, 0x65, + 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3f, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 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, 0x53, 0x65, 0x74, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, + 0x6d, 0x22, 0xe1, 0x01, 0x0a, 0x24, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4b, 0x0a, 0x21, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x12, 0x42, 0x0a, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1c, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, + 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x68, 0x0a, 0x25, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, + 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, + 0x91, 0x01, 0x0a, 0x17, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, + 0x6f, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x63, 0x6f, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x6f, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x22, 0x69, 0x0a, 0x18, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4d, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x39, 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, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0x97, + 0x20, 0x0a, 0x0d, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0xa2, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 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, 0x47, 0x65, 0x74, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 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, 0x47, 0x65, 0x74, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x92, 0x41, 0x17, + 0x12, 0x15, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x10, 0x2f, + 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x9a, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 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, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 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, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x92, 0x41, 0x14, 0x12, 0x12, 0x4c, 0x69, 0x73, + 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x12, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x73, 0x12, 0xaf, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x2f, 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, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, - 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x92, 0x41, 0x23, - 0x12, 0x21, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, - 0x53, 0x65, 0x74, 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, - 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x12, 0xe4, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x37, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, - 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, - 0x92, 0x41, 0x24, 0x12, 0x22, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x48, 0x6f, 0x73, - 0x74, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x22, 0x21, 0x2f, - 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, - 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, - 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xe9, 0x01, 0x0a, 0x14, 0x41, 0x64, - 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x92, 0x41, 0x1a, 0x12, 0x18, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x0b, 0x2f, 0x76, 0x31, + 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xad, 0x01, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2f, 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, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x92, 0x41, 0x13, 0x12, 0x11, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x32, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa1, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2f, 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, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 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, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x92, 0x41, 0x13, 0x12, 0x11, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x20, 0x61, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x2a, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xcc, 0x01, 0x0a, 0x10, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, + 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 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, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x92, 0x41, 0x29, 0x12, 0x27, 0x41, 0x64, 0x64, 0x73, - 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x54, 0x61, 0x72, 0x67, + 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4d, 0x92, 0x41, 0x17, 0x12, 0x15, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x73, 0x20, 0x61, 0x20, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x2d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x01, + 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xda, 0x01, 0x0a, 0x11, 0x41, 0x64, 0x64, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x34, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x58, 0x92, 0x41, 0x26, 0x12, + 0x24, 0x41, 0x64, 0x64, 0x73, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x48, + 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, 0x1e, 0x2f, 0x76, 0x31, + 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x64, + 0x64, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0xd7, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x92, 0x41, 0x23, 0x12, 0x21, 0x53, 0x65, + 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, 0x74, 0x73, + 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x68, 0x6f, 0x73, 0x74, + 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xe4, + 0x01, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x12, 0x37, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x38, 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, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, 0x92, 0x41, 0x24, 0x12, + 0x22, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x65, + 0x74, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x22, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x2d, - 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xe9, 0x01, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x01, 0x2a, 0x62, + 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xe9, 0x01, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x37, 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, 0x53, 0x65, 0x74, 0x54, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x5e, 0x92, 0x41, 0x29, 0x12, 0x27, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, + 0x65, 0x22, 0x5e, 0x92, 0x41, 0x29, 0x12, 0x27, 0x41, 0x64, 0x64, 0x73, 0x20, 0x65, 0x78, 0x69, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x22, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x68, 0x6f, 0x73, 0x74, + 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x12, 0xf3, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3a, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x6d, 0x12, 0xe9, 0x01, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x37, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x38, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x92, + 0x41, 0x29, 0x12, 0x27, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x6f, 0x6e, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x2c, 0x22, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, + 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xf3, 0x01, + 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, + 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3a, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x92, 0x41, 0x27, 0x12, 0x25, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x73, 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x2d, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, - 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x98, 0x02, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, - 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3f, 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, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 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, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x88, 0x02, 0x01, - 0x92, 0x41, 0x35, 0x12, 0x33, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3a, - 0x20, 0x75, 0x73, 0x65, 0x20, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, - 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x22, 0x29, - 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x3a, 0x61, 0x64, 0x64, 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, - 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x12, 0x98, 0x02, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x69, 0x65, 0x73, 0x12, 0x3f, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, + 0x6f, 0x73, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x5f, 0x92, 0x41, 0x27, 0x12, 0x25, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, + 0x20, 0x48, 0x6f, 0x73, 0x74, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x66, 0x72, + 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2f, 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x68, 0x6f, + 0x73, 0x74, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x12, 0x98, 0x02, 0x0a, 0x1c, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x69, 0x65, 0x73, 0x12, 0x3f, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x31, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x88, 0x02, 0x01, 0x92, 0x41, 0x35, 0x12, 0x33, - 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3a, 0x20, 0x75, 0x73, 0x65, 0x20, - 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, - 0x61, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x22, 0x29, 0x2f, 0x76, 0x31, 0x2f, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, - 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, - 0x72, 0x69, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa7, 0x02, - 0x0a, 0x1f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, - 0x73, 0x12, 0x42, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x40, 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, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x88, 0x02, 0x01, 0x92, 0x41, 0x35, 0x12, + 0x33, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3a, 0x20, 0x75, 0x73, 0x65, + 0x20, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x73, 0x74, + 0x65, 0x61, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x22, 0x29, 0x2f, 0x76, 0x31, 0x2f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x64, 0x64, + 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x98, + 0x02, 0x0a, 0x1c, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, + 0x3f, 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, 0x53, 0x65, 0x74, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x40, 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, 0x53, 0x65, + 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x75, 0x88, 0x02, 0x01, 0x92, 0x41, 0x35, 0x12, 0x33, 0x44, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3a, 0x20, 0x75, 0x73, 0x65, 0x20, 0x53, 0x65, 0x74, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x22, 0x29, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x63, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, + 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0xa7, 0x02, 0x0a, 0x1f, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x12, 0x42, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, + 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x43, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x43, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, - 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7b, 0x88, 0x02, 0x01, 0x92, - 0x41, 0x38, 0x12, 0x36, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3a, 0x20, - 0x75, 0x73, 0x65, 0x20, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x20, 0x69, 0x6e, 0x73, 0x74, 0x65, 0x61, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, - 0x22, 0x2c, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, - 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x01, - 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x87, 0x02, 0x0a, 0x1a, 0x41, 0x64, 0x64, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3d, 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, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 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, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6a, 0x92, 0x41, 0x2f, 0x12, 0x2d, 0x41, 0x64, 0x64, 0x73, - 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, - 0x61, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x22, - 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, - 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x12, 0x84, 0x02, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x12, 0x3d, 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, 0x53, 0x65, - 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x3e, 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, 0x53, 0x65, 0x74, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x67, 0x92, 0x41, 0x2c, 0x12, 0x2a, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x22, 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x63, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, - 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x91, 0x02, 0x0a, 0x1d, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x40, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 0x2e, 0x63, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7b, 0x88, 0x02, 0x01, 0x92, 0x41, 0x38, 0x12, 0x36, + 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x3a, 0x20, 0x75, 0x73, 0x65, 0x20, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x69, 0x6e, + 0x73, 0x74, 0x65, 0x61, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x22, 0x2c, 0x2f, 0x76, + 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x2d, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x12, 0x87, 0x02, 0x0a, 0x1a, 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x12, 0x3d, 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, + 0x41, 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x3e, 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, 0x41, + 0x64, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x6a, 0x92, 0x41, 0x2f, 0x12, 0x2d, 0x41, 0x64, 0x64, 0x73, 0x20, 0x65, 0x78, 0x69, + 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, + 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x20, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x22, 0x27, 0x2f, 0x76, 0x31, + 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x64, + 0x64, 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x12, 0x84, 0x02, + 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3d, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x6b, 0x92, 0x41, 0x2d, 0x12, 0x2b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x43, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x35, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3e, 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, 0x53, 0x65, 0x74, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x67, 0x92, 0x41, 0x2c, + 0x12, 0x2a, 0x53, 0x65, 0x74, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x6f, 0x6e, + 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x32, 0x22, 0x27, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x73, 0x65, 0x74, 0x2d, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x01, 0x2a, 0x62, 0x04, + 0x69, 0x74, 0x65, 0x6d, 0x12, 0x91, 0x02, 0x0a, 0x1d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x40, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x41, 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, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6b, 0x92, 0x41, 0x2d, + 0x12, 0x2b, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x20, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x20, 0x66, 0x72, 0x6f, + 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x35, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, + 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x2d, 0x63, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2d, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, + 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x42, 0x57, 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, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/proto/controller/api/resources/targets/v1/target.proto b/internal/proto/controller/api/resources/targets/v1/target.proto index 1059bb91c..1f7be9b64 100644 --- a/internal/proto/controller/api/resources/targets/v1/target.proto +++ b/internal/proto/controller/api/resources/targets/v1/target.proto @@ -13,62 +13,62 @@ import "controller/custom_options/v1/options.proto"; message HostSource { // Output only. The ID of the Host Set. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The Host Catalog to which this Host Source belongs. - string host_catalog_id = 20 [json_name = "host_catalog_id"]; + string host_catalog_id = 20 [json_name = "host_catalog_id"]; // @gotags: `class:"public"` } message HostSet { // Output only. The ID of the Host Set. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The Host Catalog to which this Host Set belongs. - string host_catalog_id = 20 [json_name = "host_catalog_id"]; + string host_catalog_id = 20 [json_name = "host_catalog_id"]; // @gotags: `class:"public"` } message CredentialSource { // The ID of the Credential. May be empty if the credential is dynamically generated from a library. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The name of the Credential source. - string name = 20; + string name = 20; // @gotags: `class:"public"` // Output only. The description of the Credential source. - string description = 30; + string description = 30; // @gotags: `class:"public"` // Output only. The Credential Store to which this Credential source belongs. - string credential_store_id = 40 [json_name = "credential_store_id"]; + string credential_store_id = 40 [json_name = "credential_store_id"]; // @gotags: `class:"public"` // Output only. The type of the credential source (e.g. "vault"; not the type of the credential itself). - string type = 60; + string type = 60; // @gotags: `class:"public"` // Output only. The type of the credential, empty if unspecified. - string credential_type = 70; + string credential_type = 70; // @gotags: `class:"public"` } message CredentialLibrary { // The ID of the Credential Library. - string id = 10; + string id = 10; // @gotags: `class:"public"` // Output only. The name of the Credential Library. - string name = 20; + string name = 20; // @gotags: `class:"public"` // Output only. The description of the Credential Library. - string description = 30; + string description = 30; // @gotags: `class:"public"` // Output only. The Credential Store to which this Credential Library belongs. - string credential_store_id = 40 [json_name = "credential_store_id"]; + string credential_store_id = 40 [json_name = "credential_store_id"]; // @gotags: `class:"public"` // Output only. The type of the credential library. - string type = 60; + string type = 60; // @gotags: `class:"public"` } // The actual secret for a session credential. message SessionSecret { // Output only. The base64-encoded value representing the raw bytes from the // credential provider. - string raw = 10; + string raw = 10; // @gotags: `class:"secret"` // Output only. The decoded raw string, if a JSON object. google.protobuf.Struct decoded = 20; @@ -93,95 +93,94 @@ message SessionCredential { // Target contains all fields related to a Target resource message Target { // Output only. The ID of the resource. - string id = 10; + string id = 10; // @gotags: `class:"public"` // The Scope of of this resource. This must be defined for creation of this resource, but is otherwise output only. - string scope_id = 20 [json_name = "scope_id"]; + string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public"` // Output only. Scope information for this resource. resources.scopes.v1.ScopeInfo scope = 30; // Required 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 Target. - string type = 90; + string type = 90; // @gotags: `class:"public"` // Output only. The IDs of the Host Sets associated with this Target. - 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"` // Output only. The Host Sets associated with this Target. repeated HostSet host_sets = 110 [json_name = "host_sets"]; // Output only. The IDs of the Host Sources associated with this Target. - repeated string host_source_ids = 420 [json_name = "host_source_ids"]; + repeated string host_source_ids = 420 [json_name = "host_source_ids"]; // @gotags: `class:"public"` // Output only. The Host Sources associated with this Target. repeated HostSource host_sources = 430 [json_name = "host_sources"]; // Maximum total lifetime of a created Session, in seconds. google.protobuf.UInt32Value session_max_seconds = 120 - [json_name = "session_max_seconds", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "session_max_seconds" that: "SessionMaxSeconds" }]; + [json_name = "session_max_seconds", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "session_max_seconds" that: "SessionMaxSeconds" }]; // @gotags: `class:"public"` // Maximum number of connections allowed in a Session. Unlimited is indicated by the value -1. google.protobuf.Int32Value session_connection_limit = 130 - [json_name = "session_connection_limit", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "session_connection_limit" that: "SessionConnectionLimit" }]; + [json_name = "session_connection_limit", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "session_connection_limit" that: "SessionConnectionLimit" }]; // @gotags: `class:"public"` // Optional boolean expression to filter the workers that are allowed to satisfy this request. google.protobuf.StringValue worker_filter = 140 - [json_name = "worker_filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "worker_filter" that: "WorkerFilter" }]; + [json_name = "worker_filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "worker_filter" that: "WorkerFilter" }]; // @gotags: `class:"public"` // Output only. The IDs of the application credential library ids associated with this Target. Deprecated: use application_credential_source_ids instead. - repeated string application_credential_library_ids = 150 [json_name = "application_credential_library_ids", deprecated = true]; + repeated string application_credential_library_ids = 150 [json_name = "application_credential_library_ids", deprecated = true]; // @gotags: `class:"public"` // Output only. The application credential libraries associated with this Target. Deprecated: use application_credential_sources instead. repeated CredentialLibrary application_credential_libraries = 180 [json_name = "application_credential_libraries", deprecated = true]; // Output only. The IDs of the application credential source ids associated with this Target. - repeated string application_credential_source_ids = 400 [json_name = "application_credential_source_ids"]; + repeated string application_credential_source_ids = 400 [json_name = "application_credential_source_ids"]; // @gotags: `class:"public"` // Output only. The application credential sources associated with this Target. repeated CredentialSource application_credential_sources = 410 [json_name = "application_credential_sources"]; // Output only. The IDs of the egress credential source ids associated with this Target. - repeated string egress_credential_source_ids = 500 [json_name = "egress_credential_source_ids"]; + repeated string egress_credential_source_ids = 500 [json_name = "egress_credential_source_ids"]; // @gotags: `class:"public"` // Output only. The egress credential sources associated with this Target. repeated CredentialSource egress_credential_sources = 510 [json_name = "egress_credential_sources"]; oneof attrs { // The attributes that are applicable for the specific Target. google.protobuf.Struct attributes = 200 [ - (google.api.field_visibility).restriction = "INTERNAL", (custom_options.v1.generate_sdk_option) = true, - (custom_options.v1.subtype) = "default" + (custom_options.v1.subtype) = "default" + ]; + TcpTargetAttributes tcp_target_attributes = 201 [ + (google.api.field_visibility).restriction = "INTERNAL", + (custom_options.v1.generate_sdk_option) = true, + (custom_options.v1.subtype) = "tcp" ]; - TcpTargetAttributes tcp_target_attributes = 201 [ - (google.api.field_visibility).restriction = "INTERNAL", - (custom_options.v1.generate_sdk_option) = true, - (custom_options.v1.subtype) = "tcp" - ]; } // 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"` } // TcpTargetAttributes contains attributes relevant to Targets of type "tcp" message TcpTargetAttributes { // The default TCP port that will be used when connecting to the endpoint unless overridden by a Host Set or Host. google.protobuf.UInt32Value default_port = 10 - [json_name = "default_port", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.default_port" that: "DefaultPort" }]; + [json_name = "default_port", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.default_port" that: "DefaultPort" }]; // @gotags: `class:"public"` } // WorkerInfo contains information about workers, returned in to the client in SessionAuthorization @@ -211,7 +210,7 @@ message SessionAuthorizationData { int32 connection_limit = 90 [json_name = "connection_limit"]; // Output only. The certificate to use when connecting. Raw DER bytes. - bytes certificate = 120; // @gotags: `class:"secret"` + bytes certificate = 120; // @gotags: `class:"sensitive"` // Output only. The private key to use when connecting. We are using Ed25519, so this is purely raw bytes, no marshaling. bytes private_key = 130 [json_name = "private_key"]; // @gotags: `class:"secret"` @@ -262,11 +261,11 @@ message SessionAuthorization { repeated SessionCredential credentials = 110 [json_name = "credentials"]; } -// The layout of the struct for "credential" field in SessionCredential for a user_password credential type. +// The layout of the struct for "credential" field in SessionCredential for a user_password credential type. message UserPasswordCredential { // Username of the credential - string username = 1; + string username = 1; // @gotags: `class:"sensitive"` // Password of the credential - string password = 2; + string password = 2; // @gotags: `class:"secret"` } diff --git a/internal/proto/controller/api/services/v1/target_service.proto b/internal/proto/controller/api/services/v1/target_service.proto index 22f6d27d1..4b0521df7 100644 --- a/internal/proto/controller/api/services/v1/target_service.proto +++ b/internal/proto/controller/api/services/v1/target_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/targets/v1/target.proto"; +import "controller/custom_options/v1/options.proto"; + +option (custom_options.v1.domain) = "target"; service TargetService { @@ -83,7 +86,7 @@ service TargetService { summary: "Deletes a Target." }; } - + // AuthorizeSession creates authorization information from a given Target. rpc AuthorizeSession(AuthorizeSessionRequest) returns (AuthorizeSessionResponse) { option (google.api.http) = { @@ -316,7 +319,7 @@ service TargetService { } message GetTargetRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message GetTargetResponse { @@ -324,9 +327,9 @@ message GetTargetResponse { } message ListTargetsRequest { - string scope_id = 1; - bool recursive = 20 [json_name="recursive"]; - string filter = 30 [json_name="filter"]; + string scope_id = 1; // @gotags: `class:"public"` + bool recursive = 20 [json_name="recursive"]; // @gotags: `class:"public"` + string filter = 30 [json_name="filter"]; // @gotags: `class:"public"` } message ListTargetsResponse { @@ -338,12 +341,12 @@ message CreateTargetRequest { } message CreateTargetResponse { - string uri = 1; + string uri = 1; // @gotags: `class:"public"` resources.targets.v1.Target item = 2; } message UpdateTargetRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` resources.targets.v1.Target item = 2; google.protobuf.FieldMask update_mask = 3 [json_name="update_mask"]; } @@ -353,17 +356,17 @@ message UpdateTargetResponse { } message DeleteTargetRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` } message DeleteTargetResponse {} message AddTargetHostSetsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string host_set_ids = 3 [json_name="host_set_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string host_set_ids = 3 [json_name="host_set_ids"]; // @gotags: `class:"public"` } message AddTargetHostSetsResponse { @@ -371,11 +374,11 @@ message AddTargetHostSetsResponse { } message SetTargetHostSetsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string host_set_ids = 3 [json_name="host_set_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string host_set_ids = 3 [json_name="host_set_ids"]; // @gotags: `class:"public"` } message SetTargetHostSetsResponse { @@ -383,11 +386,11 @@ message SetTargetHostSetsResponse { } message RemoveTargetHostSetsRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string host_set_ids = 3 [json_name="host_set_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string host_set_ids = 3 [json_name="host_set_ids"]; // @gotags: `class:"public"` } message RemoveTargetHostSetsResponse { @@ -395,11 +398,11 @@ message RemoveTargetHostSetsResponse { } message AddTargetHostSourcesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string host_source_ids = 3 [json_name="host_source_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string host_source_ids = 3 [json_name="host_source_ids"]; // @gotags: `class:"public"` } message AddTargetHostSourcesResponse { @@ -407,11 +410,11 @@ message AddTargetHostSourcesResponse { } message SetTargetHostSourcesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string host_source_ids = 3 [json_name="host_source_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string host_source_ids = 3 [json_name="host_source_ids"]; // @gotags: `class:"public"` } message SetTargetHostSourcesResponse { @@ -419,11 +422,11 @@ message SetTargetHostSourcesResponse { } message RemoveTargetHostSourcesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string host_source_ids = 3 [json_name="host_source_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string host_source_ids = 3 [json_name="host_source_ids"]; // @gotags: `class:"public"` } message RemoveTargetHostSourcesResponse { @@ -431,11 +434,11 @@ message RemoveTargetHostSourcesResponse { } message AddTargetCredentialLibrariesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string application_credential_library_ids = 3 [json_name="application_credential_library_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string application_credential_library_ids = 3 [json_name="application_credential_library_ids"]; // @gotags: `class:"public"` } message AddTargetCredentialLibrariesResponse { @@ -446,11 +449,11 @@ message AddTargetCredentialLibrariesResponse { // credential_library_id field that is not set in the request will result in // those fields being cleared. message SetTargetCredentialLibrariesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string application_credential_library_ids = 3 [json_name="application_credential_library_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string application_credential_library_ids = 3 [json_name="application_credential_library_ids"]; // @gotags: `class:"public"` } message SetTargetCredentialLibrariesResponse { @@ -458,11 +461,11 @@ message SetTargetCredentialLibrariesResponse { } message RemoveTargetCredentialLibrariesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string application_credential_library_ids = 3 [json_name="application_credential_library_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string application_credential_library_ids = 3 [json_name="application_credential_library_ids"]; // @gotags: `class:"public"` } message RemoveTargetCredentialLibrariesResponse { @@ -470,12 +473,12 @@ message RemoveTargetCredentialLibrariesResponse { } message AddTargetCredentialSourcesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string application_credential_source_ids = 3 [json_name="application_credential_source_ids"]; - repeated string egress_credential_source_ids = 4 [json_name="egress_credential_source_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string application_credential_source_ids = 3 [json_name="application_credential_source_ids"]; // @gotags: `class:"public"` + repeated string egress_credential_source_ids = 4 [json_name="egress_credential_source_ids"]; // @gotags: `class:"public"` } message AddTargetCredentialSourcesResponse { @@ -485,12 +488,12 @@ message AddTargetCredentialSourcesResponse { // Sets the values for credential sources. Any credential_source_id field that // is not set in the request will result in those fields being cleared. message SetTargetCredentialSourcesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string application_credential_source_ids = 3 [json_name="application_credential_source_ids"]; - repeated string egress_credential_source_ids = 4 [json_name="egress_credential_source_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string application_credential_source_ids = 3 [json_name="application_credential_source_ids"]; // @gotags: `class:"public"` + repeated string egress_credential_source_ids = 4 [json_name="egress_credential_source_ids"]; // @gotags: `class:"public"` } message SetTargetCredentialSourcesResponse { @@ -498,12 +501,12 @@ message SetTargetCredentialSourcesResponse { } message RemoveTargetCredentialSourcesRequest { - string id = 1; + string id = 1; // @gotags: `class:"public"` // Version is used to ensure this resource has not changed. // The mutation will fail if the version does not match the latest known good version. - uint32 version = 2; - repeated string application_credential_source_ids = 3 [json_name="application_credential_source_id"]; - repeated string egress_credential_source_ids = 4 [json_name="egress_credential_source_ids"]; + uint32 version = 2; // @gotags: `class:"public"` + repeated string application_credential_source_ids = 3 [json_name="application_credential_source_id"]; // @gotags: `class:"public"` + repeated string egress_credential_source_ids = 4 [json_name="egress_credential_source_ids"]; // @gotags: `class:"public"` } message RemoveTargetCredentialSourcesResponse { @@ -512,19 +515,19 @@ message RemoveTargetCredentialSourcesResponse { message AuthorizeSessionRequest { // The ID of the target. Required unless some combination of scope_id/scope_name and name are set. - string id = 1; + string id = 1; // @gotags: `class:"public"` // The name of the target. When using this, scope_id or scope_name must be set. - string name = 3; + string name = 3; // @gotags: `class:"public"` // The scope ID containing the target, if specifying the target by name. - string scope_id = 4; - + string scope_id = 4; // @gotags: `class:"public"` + // The scope name containing the target, if specifying the target by name. - string scope_name = 5; + string scope_name = 5; // @gotags: `class:"public"` // An optional parameter allowing specification of the particular Host within the Target's configured Host Sets to connect to during this Session. - string host_id = 2 [json_name="host_id"]; + string host_id = 2 [json_name="host_id"]; // @gotags: `class:"public"` } message AuthorizeSessionResponse { diff --git a/internal/servers/controller/handlers/targets/target_service.go b/internal/servers/controller/handlers/targets/target_service.go index e8ab63f4d..e0b49fa7d 100644 --- a/internal/servers/controller/handlers/targets/target_service.go +++ b/internal/servers/controller/handlers/targets/target_service.go @@ -48,6 +48,7 @@ import ( const ( credentialDomain = "credential" + hostDomain = "host" ) var ( @@ -969,7 +970,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 subtypes.SubtypeFromId("host", hsId) { + switch subtypes.SubtypeFromId(hostDomain, hsId) { case static.Subtype: eps, err := staticHostRepo.Endpoints(ctx, hsId) if err != nil { @@ -2108,7 +2109,7 @@ func validateAuthorizeSessionRequest(req *pbs.AuthorizeSessionRequest) error { } } if req.GetHostId() != "" { - switch subtypes.SubtypeFromId("host", req.GetHostId()) { + switch subtypes.SubtypeFromId(hostDomain, req.GetHostId()) { case static.Subtype, plugin.Subtype: default: badFields[globals.HostIdField] = "Incorrectly formatted identifier." diff --git a/internal/tests/api/targets/classification_test.go b/internal/tests/api/targets/classification_test.go new file mode 100644 index 000000000..a0086553a --- /dev/null +++ b/internal/tests/api/targets/classification_test.go @@ -0,0 +1,353 @@ +package targets_test + +import ( + "context" + "encoding/json" + "testing" + "time" + + pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services" + "github.com/hashicorp/boundary/sdk/pbs/controller/api" + "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/scopes" + pb "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/targets" + "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/structpb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +func TestTargets(t *testing.T) { + ctx := context.Background() + now := time.Now() + pbNow := timestamppb.Now() + wrapper := wrapper.TestWrapper(t) + testEncryptingFilter := api.NewEncryptFilter(t, wrapper) + + tests := []struct { + name string + in *eventlogger.Event + want *eventlogger.Event + }{ + { + name: "target", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Target{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "id", + Type: "type", + Name: "name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + Type: "type", + HostSetIds: []string{ + "host-set-id", + }, + HostSets: []*pb.HostSet{ + { + Id: "id", + HostCatalogId: "host-catalog-id", + }, + }, + HostSourceIds: []string{ + "host-source-id", + }, + HostSources: []*pb.HostSource{ + { + Id: "id", + HostCatalogId: "host-catalog-id", + }, + }, + SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 0}, + SessionConnectionLimit: &wrapperspb.Int32Value{Value: 0}, + WorkerFilter: &wrapperspb.StringValue{Value: "worker-filter"}, + ApplicationCredentialLibraryIds: []string{"application-credential-library-id"}, + ApplicationCredentialLibraries: []*pb.CredentialLibrary{ + { + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + }, + }, + ApplicationCredentialSourceIds: []string{"application-credential-source-id"}, + ApplicationCredentialSources: []*pb.CredentialSource{ + { + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + CredentialType: "credential-type", + }, + }, + EgressCredentialSourceIds: []string{"egress-credential-source-id"}, + EgressCredentialSources: []*pb.CredentialSource{ + { + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + CredentialType: "credential-type", + }, + }, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: &wrapperspb.UInt32Value{Value: 26}, + }, + }, + AuthorizedActions: []string{"action-1"}, + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pb.Target{ + Id: "id", + ScopeId: "scope-id", + Scope: &scopes.ScopeInfo{ + Id: "id", + Type: "type", + Name: "name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + Name: &wrapperspb.StringValue{Value: "name"}, + Description: &wrapperspb.StringValue{Value: "description"}, + CreatedTime: pbNow, + UpdatedTime: pbNow, + Version: 0, + Type: "type", + HostSetIds: []string{ + "host-set-id", + }, + HostSets: []*pb.HostSet{ + { + Id: "id", + HostCatalogId: "host-catalog-id", + }, + }, + HostSourceIds: []string{ + "host-source-id", + }, + HostSources: []*pb.HostSource{ + { + Id: "id", + HostCatalogId: "host-catalog-id", + }, + }, + SessionMaxSeconds: &wrapperspb.UInt32Value{Value: 0}, + SessionConnectionLimit: &wrapperspb.Int32Value{Value: 0}, + WorkerFilter: &wrapperspb.StringValue{Value: "worker-filter"}, + ApplicationCredentialLibraryIds: []string{"application-credential-library-id"}, + ApplicationCredentialLibraries: []*pb.CredentialLibrary{ + { + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + }, + }, + ApplicationCredentialSourceIds: []string{"application-credential-source-id"}, + ApplicationCredentialSources: []*pb.CredentialSource{ + { + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + CredentialType: "credential-type", + }, + }, + EgressCredentialSourceIds: []string{"egress-credential-source-id"}, + EgressCredentialSources: []*pb.CredentialSource{ + { + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + CredentialType: "credential-type", + }, + }, + Attrs: &pb.Target_TcpTargetAttributes{ + TcpTargetAttributes: &pb.TcpTargetAttributes{ + DefaultPort: &wrapperspb.UInt32Value{Value: 26}, + }, + }, + AuthorizedActions: []string{"action-1"}, + }, + }, + }, + { + name: "authorize-session-request", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pbs.AuthorizeSessionRequest{ + Id: "id", + Name: "name", + ScopeId: "scope-id", + ScopeName: "scope-name", + HostId: "host-id", + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pbs.AuthorizeSessionRequest{ + Id: "id", + Name: "name", + ScopeId: "scope-id", + ScopeName: "scope-name", + HostId: "host-id", + }, + }, + }, + { + name: "authorize-session-response", + in: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pbs.AuthorizeSessionResponse{ + Item: &pb.SessionAuthorization{ + SessionId: "session-id", + TargetId: "target-id", + Scope: &scopes.ScopeInfo{ + Id: "id", + Type: "type", + Name: "name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + CreatedTime: pbNow, + UserId: "user-id", + HostSetId: "host-set-id", + HostId: "host-id", + Type: "type", + AuthorizationToken: "authorization-token", + Endpoint: "endpoint", + Credentials: []*pb.SessionCredential{ + { + CredentialSource: &pb.CredentialSource{ + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + CredentialType: "credential-type", + }, + CredentialLibrary: &pb.CredentialLibrary{ + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + }, + Secret: &pb.SessionSecret{ + Raw: "raw-secrets", + Decoded: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key1": structpb.NewStringValue("value-1"), + }, + }, + }, + Credential: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key1": structpb.NewStringValue("value-1"), + }, + }, + }, + }, + }, + }, + }, + want: &eventlogger.Event{ + Type: "test", + CreatedAt: now, + Payload: &pbs.AuthorizeSessionResponse{ + Item: &pb.SessionAuthorization{ + SessionId: "session-id", + TargetId: "target-id", + Scope: &scopes.ScopeInfo{ + Id: "id", + Type: "type", + Name: "name", + Description: "description", + ParentScopeId: "parent-scope-id", + }, + CreatedTime: pbNow, + UserId: "user-id", + HostSetId: "host-set-id", + HostId: "host-id", + Type: "type", + AuthorizationToken: encrypt.RedactedData, + Endpoint: "endpoint", + Credentials: []*pb.SessionCredential{ + { + CredentialSource: &pb.CredentialSource{ + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + CredentialType: "credential-type", + }, + CredentialLibrary: &pb.CredentialLibrary{ + Id: "id", + Name: "name", + Description: "description", + CredentialStoreId: "credential-store-id", + Type: "type", + }, + Secret: &pb.SessionSecret{ + Raw: encrypt.RedactedData, + Decoded: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key1": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + Credential: &structpb.Struct{ + Fields: map[string]*structpb.Value{ + "key1": structpb.NewStringValue(encrypt.RedactedData), + }, + }, + }, + }, + }, + }, + }, + }, + } + 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.in) + require.NoError(err) + require.NotNil(got) + gotJSON, err := json.Marshal(got) + require.NoError(err) + + wantJSON, err := json.Marshal(tt.want) + require.NoError(err) + assert.JSONEq(string(wantJSON), string(gotJSON)) + }) + } +} diff --git a/sdk/pbs/controller/api/resources/targets/target.pb.go b/sdk/pbs/controller/api/resources/targets/target.pb.go index 001e04dc3..dfd9334ed 100644 --- a/sdk/pbs/controller/api/resources/targets/target.pb.go +++ b/sdk/pbs/controller/api/resources/targets/target.pb.go @@ -32,9 +32,9 @@ type HostSource struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Host Set. - 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"` // Output only. The Host Catalog to which this Host Source belongs. - 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"` } func (x *HostSource) Reset() { @@ -89,9 +89,9 @@ type HostSet struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the Host Set. - 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"` // Output only. The Host Catalog to which this Host Set belongs. - 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"` } func (x *HostSet) Reset() { @@ -146,17 +146,17 @@ type CredentialSource struct { unknownFields protoimpl.UnknownFields // The ID of the Credential. May be empty if the credential is dynamically generated from a library. - 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"` // Output only. The name of the Credential source. - Name string `protobuf:"bytes,20,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,20,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The description of the Credential source. - Description string `protobuf:"bytes,30,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,30,opt,name=description,proto3" json:"description,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Credential Store to which this Credential source belongs. - CredentialStoreId string `protobuf:"bytes,40,opt,name=credential_store_id,proto3" json:"credential_store_id,omitempty"` + CredentialStoreId string `protobuf:"bytes,40,opt,name=credential_store_id,proto3" json:"credential_store_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The type of the credential source (e.g. "vault"; not the type of the credential itself). - Type string `protobuf:"bytes,60,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,60,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The type of the credential, empty if unspecified. - CredentialType string `protobuf:"bytes,70,opt,name=credential_type,json=credentialType,proto3" json:"credential_type,omitempty"` + CredentialType string `protobuf:"bytes,70,opt,name=credential_type,json=credentialType,proto3" json:"credential_type,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *CredentialSource) Reset() { @@ -239,15 +239,15 @@ type CredentialLibrary struct { unknownFields protoimpl.UnknownFields // The ID of the Credential Library. - 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"` // Output only. The name of the Credential Library. - Name string `protobuf:"bytes,20,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,20,opt,name=name,proto3" json:"name,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The description of the Credential Library. - Description string `protobuf:"bytes,30,opt,name=description,proto3" json:"description,omitempty"` + Description string `protobuf:"bytes,30,opt,name=description,proto3" json:"description,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Credential Store to which this Credential Library belongs. - CredentialStoreId string `protobuf:"bytes,40,opt,name=credential_store_id,proto3" json:"credential_store_id,omitempty"` + CredentialStoreId string `protobuf:"bytes,40,opt,name=credential_store_id,proto3" json:"credential_store_id,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The type of the credential library. - Type string `protobuf:"bytes,60,opt,name=type,proto3" json:"type,omitempty"` + Type string `protobuf:"bytes,60,opt,name=type,proto3" json:"type,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *CredentialLibrary) Reset() { @@ -325,7 +325,7 @@ type SessionSecret struct { // Output only. The base64-encoded value representing the raw bytes from the // credential provider. - Raw string `protobuf:"bytes,10,opt,name=raw,proto3" json:"raw,omitempty"` + Raw string `protobuf:"bytes,10,opt,name=raw,proto3" json:"raw,omitempty" class:"secret"` // @gotags: `class:"secret"` // Output only. The decoded raw string, if a JSON object. Decoded *structpb.Struct `protobuf:"bytes,20,opt,name=decoded,proto3" json:"decoded,omitempty"` } @@ -463,52 +463,52 @@ type Target struct { unknownFields protoimpl.UnknownFields // Output only. The ID of the resource. - 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 Scope of of this resource. This must be defined for creation of this resource, but is otherwise output only. - ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_id,omitempty"` + ScopeId string `protobuf:"bytes,20,opt,name=scope_id,proto3" json:"scope_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"` // Required 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 Target. - 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. The IDs of the Host Sets associated with this Target. - HostSetIds []string `protobuf:"bytes,100,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty"` + HostSetIds []string `protobuf:"bytes,100,rep,name=host_set_ids,proto3" json:"host_set_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Host Sets associated with this Target. HostSets []*HostSet `protobuf:"bytes,110,rep,name=host_sets,proto3" json:"host_sets,omitempty"` // Output only. The IDs of the Host Sources associated with this Target. - HostSourceIds []string `protobuf:"bytes,420,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty"` + HostSourceIds []string `protobuf:"bytes,420,rep,name=host_source_ids,proto3" json:"host_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The Host Sources associated with this Target. HostSources []*HostSource `protobuf:"bytes,430,rep,name=host_sources,proto3" json:"host_sources,omitempty"` // Maximum total lifetime of a created Session, in seconds. - SessionMaxSeconds *wrapperspb.UInt32Value `protobuf:"bytes,120,opt,name=session_max_seconds,proto3" json:"session_max_seconds,omitempty"` + SessionMaxSeconds *wrapperspb.UInt32Value `protobuf:"bytes,120,opt,name=session_max_seconds,proto3" json:"session_max_seconds,omitempty" class:"public"` // @gotags: `class:"public"` // Maximum number of connections allowed in a Session. Unlimited is indicated by the value -1. - SessionConnectionLimit *wrapperspb.Int32Value `protobuf:"bytes,130,opt,name=session_connection_limit,proto3" json:"session_connection_limit,omitempty"` + SessionConnectionLimit *wrapperspb.Int32Value `protobuf:"bytes,130,opt,name=session_connection_limit,proto3" json:"session_connection_limit,omitempty" class:"public"` // @gotags: `class:"public"` // Optional boolean expression to filter the workers that are allowed to satisfy this request. - WorkerFilter *wrapperspb.StringValue `protobuf:"bytes,140,opt,name=worker_filter,proto3" json:"worker_filter,omitempty"` + WorkerFilter *wrapperspb.StringValue `protobuf:"bytes,140,opt,name=worker_filter,proto3" json:"worker_filter,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The IDs of the application credential library ids associated with this Target. Deprecated: use application_credential_source_ids instead. // // Deprecated: Do not use. - ApplicationCredentialLibraryIds []string `protobuf:"bytes,150,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty"` + ApplicationCredentialLibraryIds []string `protobuf:"bytes,150,rep,name=application_credential_library_ids,proto3" json:"application_credential_library_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The application credential libraries associated with this Target. Deprecated: use application_credential_sources instead. // // Deprecated: Do not use. ApplicationCredentialLibraries []*CredentialLibrary `protobuf:"bytes,180,rep,name=application_credential_libraries,proto3" json:"application_credential_libraries,omitempty"` // Output only. The IDs of the application credential source ids associated with this Target. - ApplicationCredentialSourceIds []string `protobuf:"bytes,400,rep,name=application_credential_source_ids,proto3" json:"application_credential_source_ids,omitempty"` + ApplicationCredentialSourceIds []string `protobuf:"bytes,400,rep,name=application_credential_source_ids,proto3" json:"application_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The application credential sources associated with this Target. ApplicationCredentialSources []*CredentialSource `protobuf:"bytes,410,rep,name=application_credential_sources,proto3" json:"application_credential_sources,omitempty"` // Output only. The IDs of the egress credential source ids associated with this Target. - EgressCredentialSourceIds []string `protobuf:"bytes,500,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty"` + EgressCredentialSourceIds []string `protobuf:"bytes,500,rep,name=egress_credential_source_ids,proto3" json:"egress_credential_source_ids,omitempty" class:"public"` // @gotags: `class:"public"` // Output only. The egress credential sources associated with this Target. EgressCredentialSources []*CredentialSource `protobuf:"bytes,510,rep,name=egress_credential_sources,proto3" json:"egress_credential_sources,omitempty"` // Types that are assignable to Attrs: @@ -516,7 +516,7 @@ type Target struct { // *Target_TcpTargetAttributes Attrs isTarget_Attrs `protobuf_oneof:"attrs"` // 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 *Target) Reset() { @@ -759,7 +759,7 @@ type TcpTargetAttributes struct { unknownFields protoimpl.UnknownFields // The default TCP port that will be used when connecting to the endpoint unless overridden by a Host Set or Host. - DefaultPort *wrapperspb.UInt32Value `protobuf:"bytes,10,opt,name=default_port,proto3" json:"default_port,omitempty"` + DefaultPort *wrapperspb.UInt32Value `protobuf:"bytes,10,opt,name=default_port,proto3" json:"default_port,omitempty" class:"public"` // @gotags: `class:"public"` } func (x *TcpTargetAttributes) Reset() { @@ -869,7 +869,7 @@ type SessionAuthorizationData struct { // Output only. The connection limit being applied to this session. -1 means unlimited. This is not actually enforced on the client side but it provides for better listener handling by including it. ConnectionLimit int32 `protobuf:"varint,90,opt,name=connection_limit,proto3" json:"connection_limit,omitempty"` // Output only. The certificate to use when connecting. Raw DER bytes. - Certificate []byte `protobuf:"bytes,120,opt,name=certificate,proto3" json:"certificate,omitempty" class:"secret"` // @gotags: `class:"secret"` + Certificate []byte `protobuf:"bytes,120,opt,name=certificate,proto3" json:"certificate,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` // Output only. The private key to use when connecting. We are using Ed25519, so this is purely raw bytes, no marshaling. PrivateKey []byte `protobuf:"bytes,130,opt,name=private_key,proto3" json:"private_key,omitempty" class:"secret"` // @gotags: `class:"secret"` // Output only. The host ID...not used for security purposes, but for some special command handling (e.g. ssh host key aliasing). @@ -1135,9 +1135,9 @@ type UserPasswordCredential struct { unknownFields protoimpl.UnknownFields // Username of the credential - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty" class:"sensitive"` // @gotags: `class:"sensitive"` // Password of the credential - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" class:"secret"` // @gotags: `class:"secret"` } func (x *UserPasswordCredential) Reset() { @@ -1267,7 +1267,7 @@ var file_controller_api_resources_targets_v1_target_proto_rawDesc = []byte{ 0x37, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0a, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xd9, 0x0f, 0x0a, 0x06, 0x54, 0x61, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0xc9, 0x0f, 0x0a, 0x06, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x12, @@ -1374,12 +1374,11 @@ var file_controller_api_resources_targets_v1_target_proto_rawDesc = []byte{ 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x19, 0x65, 0x67, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x5b, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0xc8, 0x01, 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, 0x1f, 0xa0, 0xda, - 0x29, 0x01, 0x9a, 0xe3, 0x29, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0xfa, 0xd2, 0xe4, - 0x93, 0x02, 0x0a, 0x12, 0x08, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x48, 0x00, 0x52, + 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, 0x8c, 0x01, 0x0a, 0x15, 0x74, 0x63, 0x70, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x63,