database

package
v0.0.0-...-e8682ef Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MPL-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const SecretCredsType = "creds"

Variables

This section is empty.

Functions

func Backend

func Backend(conf *logical.BackendConfig) *databaseBackend

func Factory

func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error)

func New

func New() (interface{}, error)

New returns a new in-memory instance

func NewV4

func NewV4() (interface{}, error)

New returns a new in-memory instance

func RunV4

func RunV4(apiTLSConfig *api.TLSConfig) error

RunV4 instantiates a MongoDB object, and runs the RPC server for the plugin

func RunV5

func RunV5() error

Run instantiates a MongoDB object, and runs the RPC server for the plugin

func RunV6Multiplexed

func RunV6Multiplexed() error

Run instantiates a MongoDB object, and runs the RPC server for the plugin

Types

type ClientCertificateGenerator

type ClientCertificateGenerator struct {
	// CommonNameTemplate is username template to be used for the client certificate common name.
	CommonNameTemplate string `mapstructure:"common_name_template,omitempty"`

	// CAPrivateKey is the PEM-encoded private key for the given ca_cert.
	CAPrivateKey string `mapstructure:"ca_private_key,omitempty"`

	// CACert is the PEM-encoded CA certificate.
	CACert string `mapstructure:"ca_cert,omitempty"`

	// KeyType specifies the desired key type.
	// Options include: 'rsa', 'ed25519', 'ec'.
	KeyType string `mapstructure:"key_type,omitempty"`

	// KeyBits is the number of bits to use for the generated keys.
	// Options include: with key_type=rsa, 2048 (default), 3072, 4096;
	// With key_type=ec, allowed values are: 224, 256 (default), 384, 521;
	// Ignored with key_type=ed25519.
	KeyBits int `mapstructure:"key_bits,omitempty"`

	// SignatureBits is the number of bits to use in the signature algorithm.
	// Options include: 256 (default), 384, 512.
	SignatureBits int `mapstructure:"signature_bits,omitempty"`
	// contains filtered or unexported fields
}

type DatabaseConfig

type DatabaseConfig struct {
	PluginName    string `json:"plugin_name" structs:"plugin_name" mapstructure:"plugin_name"`
	PluginVersion string `json:"plugin_version" structs:"plugin_version" mapstructure:"plugin_version"`
	// ConnectionDetails stores the database specific connection settings needed
	// by each database type.
	ConnectionDetails map[string]interface{} `json:"connection_details" structs:"connection_details" mapstructure:"connection_details"`
	AllowedRoles      []string               `json:"allowed_roles" structs:"allowed_roles" mapstructure:"allowed_roles"`

	RootCredentialsRotateStatements []string `` /* 136-byte string literal not displayed */

	PasswordPolicy string `json:"password_policy" structs:"password_policy" mapstructure:"password_policy"`
}

DatabaseConfig is used by the Factory function to configure a Database object.

func (*DatabaseConfig) SupportsCredentialType

func (c *DatabaseConfig) SupportsCredentialType(credentialType v5.CredentialType) bool

type MockDatabaseV4

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

MockDatabaseV4 is an implementation of Database interface

func (MockDatabaseV4) Close

func (m MockDatabaseV4) Close() error

func (MockDatabaseV4) CreateUser

func (m MockDatabaseV4) CreateUser(ctx context.Context, statements v4.Statements, usernameConfig v4.UsernameConfig, expiration time.Time) (username string, password string, err error)

func (MockDatabaseV4) GenerateCredentials

func (m MockDatabaseV4) GenerateCredentials(ctx context.Context) (password string, err error)

func (MockDatabaseV4) Init

func (m MockDatabaseV4) Init(ctx context.Context, config map[string]interface{}, verifyConnection bool) (saveConfig map[string]interface{}, err error)

func (MockDatabaseV4) Initialize

func (m MockDatabaseV4) Initialize(ctx context.Context, config map[string]interface{}, verifyConnection bool) (err error)

func (MockDatabaseV4) RenewUser

func (m MockDatabaseV4) RenewUser(ctx context.Context, statements v4.Statements, username string, expiration time.Time) error

func (MockDatabaseV4) RevokeUser

func (m MockDatabaseV4) RevokeUser(ctx context.Context, statements v4.Statements, username string) error

func (MockDatabaseV4) RotateRootCredentials

func (m MockDatabaseV4) RotateRootCredentials(ctx context.Context, statements []string) (config map[string]interface{}, err error)

func (MockDatabaseV4) SetCredentials

func (m MockDatabaseV4) SetCredentials(ctx context.Context, statements v4.Statements, staticConfig v4.StaticUserConfig) (username string, password string, err error)

func (MockDatabaseV4) Type

func (m MockDatabaseV4) Type() (string, error)

type MockDatabaseV5

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

MockDatabaseV5 is an implementation of Database interface

func (MockDatabaseV5) Close

func (m MockDatabaseV5) Close() error

func (MockDatabaseV5) DeleteUser

func (MockDatabaseV5) Initialize

func (MockDatabaseV5) NewUser

func (MockDatabaseV5) Type

func (m MockDatabaseV5) Type() (string, error)

func (MockDatabaseV5) UpdateUser

Jump to

Keyboard shortcuts

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