mongodb

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrivilegeAttributeTypes = map[string]attr.Type{
	"resource": types.ObjectType{
		AttrTypes: map[string]attr.Type{
			"db":         types.StringType,
			"collection": types.StringType,
		},
	},
	"actions": types.SetType{
		ElemType: types.StringType,
	},
}
View Source
var ShortRoleAttributeTypes = map[string]attr.Type{
	"role": types.StringType,
	"db":   types.StringType,
}

Functions

This section is empty.

Types

type Client

type Client struct {
	ClientOptions
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, options *ClientOptions) (*Client, error)

func (*Client) DeleteRole

func (c *Client) DeleteRole(ctx context.Context, options *DeleteRoleOptions) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, options *DeleteUserOptions) error

func (*Client) GetRole

func (c *Client) GetRole(ctx context.Context, options *GetRoleOptions) (*Role, error)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, options *GetUserOptions) (*User, error)

func (*Client) UpsertRole

func (c *Client) UpsertRole(ctx context.Context, role *Role) (*Role, error)

func (*Client) UpsertUser

func (c *Client) UpsertUser(ctx context.Context, user *User) (*User, error)

type ClientOptions

type ClientOptions struct {
	Hosts              []string
	Username           string
	Password           string
	AuthSource         string
	ReplicaSet         string
	TLS                bool
	InsecureSkipVerify bool
	Certificate        string
}

type DeleteRoleOptions

type DeleteRoleOptions struct {
	Name     string
	Database string
}

type DeleteUserOptions

type DeleteUserOptions struct {
	Username string
	Database string
}

type FailedCommandError

type FailedCommandError struct {
	Cmd string
}

func (FailedCommandError) Error

func (e FailedCommandError) Error() string

type GetRoleOptions

type GetRoleOptions struct {
	Name     string
	Database string
}

type GetUserOptions

type GetUserOptions struct {
	Username string
	Database string
}

type NotFoundError

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

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Privilege

type Privilege struct {
	Resource Resource `bson:"resource" tfsdk:"resource"`
	Actions  []string `bson:"actions"  tfsdk:"actions"`
}

type Privileges

type Privileges []Privilege

func (*Privileges) ToTerraformSet

func (p *Privileges) ToTerraformSet(ctx context.Context) (*types.Set, diag.Diagnostics)

type Resource added in v0.1.0

type Resource struct {
	DB         string `bson:"db"         tfsdk:"db"`
	Collection string `bson:"collection" tfsdk:"collection"`
}

type Result

type Result struct {
	Ok int `bson:"ok"`
}

type Role

type Role struct {
	Name       string     `bson:"role"`
	Database   string     `bson:"db"`
	Privileges Privileges `bson:"privileges"`
	Roles      ShortRoles `bson:"roles"`
}

type ShortRole

type ShortRole struct {
	Role string `bson:"role" tfsdk:"role"`
	DB   string `bson:"db"   tfsdk:"db"`
}

type ShortRoles

type ShortRoles []ShortRole

func (*ShortRoles) ToTerraformSet

func (r *ShortRoles) ToTerraformSet(ctx context.Context) (*types.Set, diag.Diagnostics)

type TooManyError

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

func (TooManyError) Error

func (e TooManyError) Error() string

type User

type User struct {
	Username string `bson:"user"`
	Password string

	Database   string     `bson:"db"`
	Roles      ShortRoles `bson:"roles"`
	Mechanisms []string   `bson:"mechanisms"`
}

Jump to

Keyboard shortcuts

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