vault/sdk/database/dbplugin/v5/proto/database.proto
Christopher Swenson 70278c2787
Add plugin version to GRPC interface (#17088)
Add plugin version to GRPC interface

Added a version interface in the sdk/logical so that it can be shared between all plugin types, and then wired it up to RunningVersion in the mounts, auth list, and database systems.

I've tested that this works with auth, database, and secrets plugin types, with the following logic to populate RunningVersion:

If a plugin has a PluginVersion() method implemented, then that is used
If not, and the plugin is built into the Vault binary, then the go.mod version is used
Otherwise, the it will be the empty string.
My apologies for the length of this PR.

* Placeholder backend should be external

We use a placeholder backend (previously a framework.Backend) before a
GRPC plugin is lazy-loaded. This makes us later think the plugin is a
builtin plugin.

So we added a `placeholderBackend` type that overrides the
`IsExternal()` method so that later we know that the plugin is external,
and don't give it a default builtin version.
2022-09-15 16:37:59 -07:00

104 lines
2.2 KiB
Protocol Buffer

syntax = "proto3";
package dbplugin.v5;
option go_package = "github.com/hashicorp/vault/sdk/database/dbplugin/v5/proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
/////////////////
// Initialize()
/////////////////
message InitializeRequest {
google.protobuf.Struct config_data = 1;
bool verify_connection = 2;
}
message InitializeResponse {
google.protobuf.Struct config_data = 1;
}
/////////////////
// NewUser()
/////////////////
message NewUserRequest {
UsernameConfig username_config = 1;
string password = 2;
google.protobuf.Timestamp expiration = 3;
Statements statements = 4;
Statements rollback_statements = 5;
int32 credential_type = 6;
bytes public_key = 7;
}
message UsernameConfig {
string display_name = 1;
string role_name = 2;
}
message NewUserResponse {
string username = 1;
}
/////////////////
// UpdateUser()
/////////////////
message UpdateUserRequest {
string username = 1;
ChangePassword password = 2;
ChangeExpiration expiration = 3;
ChangePublicKey public_key = 4;
int32 credential_type = 5;
}
message ChangePassword {
string new_password = 1;
Statements statements = 2;
}
message ChangePublicKey {
bytes new_public_key = 1;
Statements statements = 2;
}
message ChangeExpiration {
google.protobuf.Timestamp new_expiration = 1;
Statements statements = 2;
}
message UpdateUserResponse {}
/////////////////
// DeleteUser()
/////////////////
message DeleteUserRequest {
string username = 1;
Statements statements = 2;
}
message DeleteUserResponse {}
/////////////////
// Type()
/////////////////
message TypeResponse {
string Type = 1;
}
/////////////////
// General purpose
/////////////////
message Statements {
repeated string Commands = 1;
}
message Empty {}
service Database {
rpc Initialize(InitializeRequest) returns (InitializeResponse);
rpc NewUser(NewUserRequest) returns (NewUserResponse);
rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse);
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse);
rpc Type(Empty) returns (TypeResponse);
rpc Close(Empty) returns (Empty);
}