Create User Service Handler and SDK (#106)

* Create user handler stuff.

* Fixing Not Found errors from DB.

* Fixing param names.

* Update the proto's go package generation.

* Generate the user resource.

* Adding SDK methods for users.

* Fix the base type of Users and add tests.

* Connect user service to the controller handler.

* Attach the default org to the Test Controller's client.

* Take into account the provided request paths when the client builds the org/project path prefix.

* Adding comments to the API.

* rename repo function to repoFn.

* Fix typo in update mask errors.

* Clean up tests.

* Remove special checks for request url content in the api client and fix CORS test.
This commit is contained in:
Todd Knight authored and GitHub committed 2020-06-09 11:20:59 -07:00
1 parent 2c3fbe3024
commit df6ca5289f
25 files changed
+3845 -9

No files matched your search

+8
View File
@@ -21,6 +21,7 @@ import (
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/host_sets"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/hosts"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/projects"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/users"
)
type HandlerProperties struct {
@@ -84,6 +85,13 @@ func handleGrpcGateway(c *Controller) (http.Handler, error) {
if err := services.RegisterProjectServiceHandlerServer(ctx, mux, ps); err != nil {
return nil, fmt.Errorf("failed to register project service handler: %w", err)
}
us, err := users.NewService(c.IamRepoFn)
if err != nil {
return nil, fmt.Errorf("failed to create user handler service: %w", err)
}
if err := services.RegisterUserServiceHandlerServer(ctx, mux, us); err != nil {
return nil, fmt.Errorf("failed to register user service handler: %w", err)
}
return mux, nil
}