Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBPW 1/5] Add Database v5 interface with gRPC client & server #9641

Merged
merged 19 commits into from
Aug 28, 2020

Conversation

pcman312
Copy link
Contributor

@pcman312 pcman312 commented Jul 30, 2020

Overview

This PR is part of a larger feature adding support for password policies into the combined database engine. This feature is being split into multiple PRs to make for smaller reviews & earlier feedback.

Creates a new Database interface for use in the combined database engine. This new interface will be v5 of the engine and is designed to support password policies. It also changes the pattern of the previous interface to a more gRPC style for better future compatibility. This is done so changes to the interface in the future are hopefully less painful.

Nothing is referencing this package yet. That will happen in a subsequent PR

Files

sdk/database/newdbplugin/ - New package for keeping all of the v5 database code. This is a temporary location. This package will replace the existing sdk/database/dbplugin package in a subsequent PR. The existing sdk/database/dbplugin package will be renamed to indicate it is deprecated.
database.go - New v5 interface & associated request/response objects
proto/database.proto - New v5 interface as defined in gRPC
grpc_client.go - gRPC client implementation of proto/database.proto. This does the conversion between Go types in database.go to protobuf-generated types.
grpc_server.go - gRPC server implementation of proto/database.proto. This does the conversion between protobuf-generated types and Go types in database.go.

Related PRs

Original password policies PR
2/X - Middleware
3/X - Plugin handling
4/X - Database engine

@pcman312 pcman312 changed the title [DBPW] Add Database v5 interface with gRPC client & server [DBPW 1/X] Add Database v5 interface with gRPC client & server Jul 30, 2020
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some questions about statements.

@hashicorp hashicorp deleted a comment Aug 24, 2020
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's some missing statements logic.

sdk/database/newdbplugin/grpc_server.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/grpc_server.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/database.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/grpc_client.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/grpc_server.go Outdated Show resolved Hide resolved
Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good overall! Just a few small comments and suggestions.

sdk/database/newdbplugin/database.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/database.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/database.go Outdated Show resolved Hide resolved
sdk/database/newdbplugin/grpc_server.go Show resolved Hide resolved
Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pcman312 pcman312 merged commit 6478665 into master Aug 28, 2020
@pcman312 pcman312 deleted the new-database-interface branch August 28, 2020 17:22

func getUpdateUserRequest(req *proto.UpdateUserRequest) (UpdateUserRequest, error) {
var password *ChangePassword
if req.GetPassword() != nil && req.GetPassword().GetNewPassword() != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetNewPassword() has a built-in nil check on the receiver so you shouldn't need req.GetPassword() != nil to protect against potential panic, but it's good to be explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants