mongodb

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (interface{}, error)

New returns a new MongoDB instance

func Run

func Run(apiTLSConfig *api.TLSConfig) error

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

Types

type MongoDB

MongoDB is an implementation of Database interface

func (*MongoDB) CreateUser

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

CreateUser generates the username/password on the underlying secret backend as instructed by the CreationStatement provided. The creation statement is a JSON blob that has a db value, and an array of roles that accepts a role, and an optional db value pair. This array will be normalized the format specified in the mongoDB docs: https://docs.mongodb.com/manual/reference/command/createUser/#dbcmd.createUser

JSON Example:

{ "db": "admin", "roles": [{ "role": "readWrite" }, {"role": "read", "db": "foo"}] }

func (*MongoDB) RenewUser

func (m *MongoDB) RenewUser(ctx context.Context, statements dbplugin.Statements, username string, expiration time.Time) error

RenewUser is not supported on MongoDB, so this is a no-op.

func (*MongoDB) RevokeUser

func (m *MongoDB) RevokeUser(ctx context.Context, statements dbplugin.Statements, username string) error

RevokeUser drops the specified user from the authentication database. If none is provided in the revocation statement, the default "admin" authentication database will be assumed.

func (*MongoDB) Type

func (m *MongoDB) Type() (string, error)

Type returns the TypeName for this backend

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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