dbplugin

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2018 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package dbplugin is a generated protocol buffer package.

It is generated from these files:

builtin/logical/database/dbplugin/database.proto

It has these top-level messages:

InitializeRequest
CreateUserRequest
RenewUserRequest
RevokeUserRequest
Statements
UsernameConfig
CreateUserResponse
TypeResponse
Empty

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPluginShutdown = errors.New("plugin shutdown")
)

Functions

func RegisterDatabaseServer added in v0.9.1

func RegisterDatabaseServer(s *grpc.Server, srv DatabaseServer)

func Serve

func Serve(db Database, tlsProvider func() (*tls.Config, error))

Serve is called from within a plugin and wraps the provided Database implementation in a databasePluginRPCServer object and starts a RPC server.

func ServeConfig added in v0.9.1

func ServeConfig(db Database, tlsProvider func() (*tls.Config, error)) *plugin.ServeConfig

Types

type CreateUserRequest

type CreateUserRequest struct {
	Statements     *Statements                `protobuf:"bytes,1,opt,name=statements" json:"statements,omitempty"`
	UsernameConfig *UsernameConfig            `protobuf:"bytes,2,opt,name=username_config,json=usernameConfig" json:"username_config,omitempty"`
	Expiration     *google_protobuf.Timestamp `protobuf:"bytes,3,opt,name=expiration" json:"expiration,omitempty"`
}

func (*CreateUserRequest) Descriptor added in v0.9.1

func (*CreateUserRequest) Descriptor() ([]byte, []int)

func (*CreateUserRequest) GetExpiration added in v0.9.1

func (m *CreateUserRequest) GetExpiration() *google_protobuf.Timestamp

func (*CreateUserRequest) GetStatements added in v0.9.1

func (m *CreateUserRequest) GetStatements() *Statements

func (*CreateUserRequest) GetUsernameConfig added in v0.9.1

func (m *CreateUserRequest) GetUsernameConfig() *UsernameConfig

func (*CreateUserRequest) ProtoMessage added in v0.9.1

func (*CreateUserRequest) ProtoMessage()

func (*CreateUserRequest) Reset added in v0.9.1

func (m *CreateUserRequest) Reset()

func (*CreateUserRequest) String added in v0.9.1

func (m *CreateUserRequest) String() string

type CreateUserRequestRPC added in v0.9.1

type CreateUserRequestRPC struct {
	Statements     Statements
	UsernameConfig UsernameConfig
	Expiration     time.Time
}

type CreateUserResponse

type CreateUserResponse struct {
	Username string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"`
}

func (*CreateUserResponse) Descriptor added in v0.9.1

func (*CreateUserResponse) Descriptor() ([]byte, []int)

func (*CreateUserResponse) GetPassword added in v0.9.1

func (m *CreateUserResponse) GetPassword() string

func (*CreateUserResponse) GetUsername added in v0.9.1

func (m *CreateUserResponse) GetUsername() string

func (*CreateUserResponse) ProtoMessage added in v0.9.1

func (*CreateUserResponse) ProtoMessage()

func (*CreateUserResponse) Reset added in v0.9.1

func (m *CreateUserResponse) Reset()

func (*CreateUserResponse) String added in v0.9.1

func (m *CreateUserResponse) String() string

type Database

type Database interface {
	Type() (string, error)
	CreateUser(ctx context.Context, statements Statements, usernameConfig UsernameConfig, expiration time.Time) (username string, password string, err error)
	RenewUser(ctx context.Context, statements Statements, username string, expiration time.Time) error
	RevokeUser(ctx context.Context, statements Statements, username string) error

	Initialize(ctx context.Context, config map[string]interface{}, verifyConnection bool) error
	Close() error
}

Database is the interface that all database objects must implement.

func PluginFactory

func PluginFactory(ctx context.Context, pluginName string, sys pluginutil.LookRunnerUtil, logger log.Logger) (Database, error)

PluginFactory is used to build plugin database types. It wraps the database object in a logging and metrics middleware.

type DatabaseClient added in v0.9.1

type DatabaseClient interface {
	Type(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TypeResponse, error)
	CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
	RenewUser(ctx context.Context, in *RenewUserRequest, opts ...grpc.CallOption) (*Empty, error)
	RevokeUser(ctx context.Context, in *RevokeUserRequest, opts ...grpc.CallOption) (*Empty, error)
	Initialize(ctx context.Context, in *InitializeRequest, opts ...grpc.CallOption) (*Empty, error)
	Close(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
}

func NewDatabaseClient added in v0.9.1

func NewDatabaseClient(cc *grpc.ClientConn) DatabaseClient

type DatabasePlugin

type DatabasePlugin struct {
	// contains filtered or unexported fields
}

DatabasePlugin implements go-plugin's Plugin interface. It has methods for retrieving a server and a client instance of the plugin.

func (DatabasePlugin) Client

func (DatabasePlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (DatabasePlugin) GRPCClient added in v0.9.1

func (DatabasePlugin) GRPCClient(doneCtx context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (DatabasePlugin) GRPCServer added in v0.9.1

func (d DatabasePlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

func (DatabasePlugin) Server

func (d DatabasePlugin) Server(*plugin.MuxBroker) (interface{}, error)

type DatabasePluginClient

type DatabasePluginClient struct {
	sync.Mutex

	Database
	// contains filtered or unexported fields
}

DatabasePluginClient embeds a databasePluginRPCClient and wraps it's Close method to also call Kill() on the plugin.Client.

func (*DatabasePluginClient) Close

func (dc *DatabasePluginClient) Close() error

This wraps the Close call and ensures we both close the database connection and kill the plugin.

type DatabaseServer added in v0.9.1

type DatabaseServer interface {
	Type(context.Context, *Empty) (*TypeResponse, error)
	CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
	RenewUser(context.Context, *RenewUserRequest) (*Empty, error)
	RevokeUser(context.Context, *RevokeUserRequest) (*Empty, error)
	Initialize(context.Context, *InitializeRequest) (*Empty, error)
	Close(context.Context, *Empty) (*Empty, error)
}

type Empty added in v0.9.1

type Empty struct {
}

func (*Empty) Descriptor added in v0.9.1

func (*Empty) Descriptor() ([]byte, []int)

func (*Empty) ProtoMessage added in v0.9.1

func (*Empty) ProtoMessage()

func (*Empty) Reset added in v0.9.1

func (m *Empty) Reset()

func (*Empty) String added in v0.9.1

func (m *Empty) String() string

type InitializeRequest

type InitializeRequest struct {
	Config           []byte `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	VerifyConnection bool   `protobuf:"varint,2,opt,name=verify_connection,json=verifyConnection" json:"verify_connection,omitempty"`
}

func (*InitializeRequest) Descriptor added in v0.9.1

func (*InitializeRequest) Descriptor() ([]byte, []int)

func (*InitializeRequest) GetConfig added in v0.9.1

func (m *InitializeRequest) GetConfig() []byte

func (*InitializeRequest) GetVerifyConnection added in v0.9.1

func (m *InitializeRequest) GetVerifyConnection() bool

func (*InitializeRequest) ProtoMessage added in v0.9.1

func (*InitializeRequest) ProtoMessage()

func (*InitializeRequest) Reset added in v0.9.1

func (m *InitializeRequest) Reset()

func (*InitializeRequest) String added in v0.9.1

func (m *InitializeRequest) String() string

type InitializeRequestRPC added in v0.9.1

type InitializeRequestRPC struct {
	Config           map[string]interface{}
	VerifyConnection bool
}

type RenewUserRequest

type RenewUserRequest struct {
	Statements *Statements                `protobuf:"bytes,1,opt,name=statements" json:"statements,omitempty"`
	Username   string                     `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
	Expiration *google_protobuf.Timestamp `protobuf:"bytes,3,opt,name=expiration" json:"expiration,omitempty"`
}

func (*RenewUserRequest) Descriptor added in v0.9.1

func (*RenewUserRequest) Descriptor() ([]byte, []int)

func (*RenewUserRequest) GetExpiration added in v0.9.1

func (m *RenewUserRequest) GetExpiration() *google_protobuf.Timestamp

func (*RenewUserRequest) GetStatements added in v0.9.1

func (m *RenewUserRequest) GetStatements() *Statements

func (*RenewUserRequest) GetUsername added in v0.9.1

func (m *RenewUserRequest) GetUsername() string

func (*RenewUserRequest) ProtoMessage added in v0.9.1

func (*RenewUserRequest) ProtoMessage()

func (*RenewUserRequest) Reset added in v0.9.1

func (m *RenewUserRequest) Reset()

func (*RenewUserRequest) String added in v0.9.1

func (m *RenewUserRequest) String() string

type RenewUserRequestRPC added in v0.9.1

type RenewUserRequestRPC struct {
	Statements Statements
	Username   string
	Expiration time.Time
}

type RevokeUserRequest

type RevokeUserRequest struct {
	Statements *Statements `protobuf:"bytes,1,opt,name=statements" json:"statements,omitempty"`
	Username   string      `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
}

func (*RevokeUserRequest) Descriptor added in v0.9.1

func (*RevokeUserRequest) Descriptor() ([]byte, []int)

func (*RevokeUserRequest) GetStatements added in v0.9.1

func (m *RevokeUserRequest) GetStatements() *Statements

func (*RevokeUserRequest) GetUsername added in v0.9.1

func (m *RevokeUserRequest) GetUsername() string

func (*RevokeUserRequest) ProtoMessage added in v0.9.1

func (*RevokeUserRequest) ProtoMessage()

func (*RevokeUserRequest) Reset added in v0.9.1

func (m *RevokeUserRequest) Reset()

func (*RevokeUserRequest) String added in v0.9.1

func (m *RevokeUserRequest) String() string

type RevokeUserRequestRPC added in v0.9.1

type RevokeUserRequestRPC struct {
	Statements Statements
	Username   string
}

type Statements

type Statements struct {
	CreationStatements   string `protobuf:"bytes,1,opt,name=creation_statements,json=creationStatements" json:"creation_statements,omitempty"`
	RevocationStatements string `protobuf:"bytes,2,opt,name=revocation_statements,json=revocationStatements" json:"revocation_statements,omitempty"`
	RollbackStatements   string `protobuf:"bytes,3,opt,name=rollback_statements,json=rollbackStatements" json:"rollback_statements,omitempty"`
	RenewStatements      string `protobuf:"bytes,4,opt,name=renew_statements,json=renewStatements" json:"renew_statements,omitempty"`
}

func (*Statements) Descriptor added in v0.9.1

func (*Statements) Descriptor() ([]byte, []int)

func (*Statements) GetCreationStatements added in v0.9.1

func (m *Statements) GetCreationStatements() string

func (*Statements) GetRenewStatements added in v0.9.1

func (m *Statements) GetRenewStatements() string

func (*Statements) GetRevocationStatements added in v0.9.1

func (m *Statements) GetRevocationStatements() string

func (*Statements) GetRollbackStatements added in v0.9.1

func (m *Statements) GetRollbackStatements() string

func (*Statements) ProtoMessage added in v0.9.1

func (*Statements) ProtoMessage()

func (*Statements) Reset added in v0.9.1

func (m *Statements) Reset()

func (*Statements) String added in v0.9.1

func (m *Statements) String() string

type TypeResponse added in v0.9.1

type TypeResponse struct {
	Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
}

func (*TypeResponse) Descriptor added in v0.9.1

func (*TypeResponse) Descriptor() ([]byte, []int)

func (*TypeResponse) GetType added in v0.9.1

func (m *TypeResponse) GetType() string

func (*TypeResponse) ProtoMessage added in v0.9.1

func (*TypeResponse) ProtoMessage()

func (*TypeResponse) Reset added in v0.9.1

func (m *TypeResponse) Reset()

func (*TypeResponse) String added in v0.9.1

func (m *TypeResponse) String() string

type UsernameConfig added in v0.7.3

type UsernameConfig struct {
	DisplayName string `protobuf:"bytes,1,opt,name=DisplayName" json:"DisplayName,omitempty"`
	RoleName    string `protobuf:"bytes,2,opt,name=RoleName" json:"RoleName,omitempty"`
}

func (*UsernameConfig) Descriptor added in v0.9.1

func (*UsernameConfig) Descriptor() ([]byte, []int)

func (*UsernameConfig) GetDisplayName added in v0.9.1

func (m *UsernameConfig) GetDisplayName() string

func (*UsernameConfig) GetRoleName added in v0.9.1

func (m *UsernameConfig) GetRoleName() string

func (*UsernameConfig) ProtoMessage added in v0.9.1

func (*UsernameConfig) ProtoMessage()

func (*UsernameConfig) Reset added in v0.9.1

func (m *UsernameConfig) Reset()

func (*UsernameConfig) String added in v0.9.1

func (m *UsernameConfig) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL