mysqluser

package
v0.0.0-...-72b2b2c Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const MSecretPasswordKey = "password"

MSecretPasswordKey is the password key in secret

View Source
const MSecretUsernameKey = "username"

MSecretUsernameKey is the username key in secret

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLUser

type MySQLUser interface {
	GetDB(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (mysql.Database, error)
	ConnectToMySqlDb(ctx context.Context, drivername string, server string, dbname string, port int, username string, password string) (*sql.DB, error)
	GrantUserRoles(ctx context.Context, user string, database string, roles []string, db *sql.DB) error
	CreateUser(ctx context.Context, server string, secret map[string][]byte, db *sql.DB) (string, error)
	UserExists(ctx context.Context, db *sql.DB, username string) (bool, error)
	DropUser(ctx context.Context, db *sql.DB, user string) error
	DeleteSecrets(ctx context.Context, instance *v1alpha1.MySQLUser, secretClient secrets.SecretClient) (bool, error)
	GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.MySQLUser, secretClient secrets.SecretClient) map[string][]byte

	// also embed methods from AsyncClient
	resourcemanager.ARMClient
}

MySQLUser interface provides the functions of mySQLUser

type MySqlUserManager

type MySqlUserManager struct {
	Creds        config.Credentials
	SecretClient secrets.SecretClient
	Scheme       *runtime.Scheme
}

MySqlUserManager for mysqluser manager

func NewMySqlUserManager

func NewMySqlUserManager(creds config.Credentials, secretClient secrets.SecretClient, scheme *runtime.Scheme) *MySqlUserManager

NewMySqlUserManager creates a new MySqlUserManager

func (*MySqlUserManager) CreateUser

func (m *MySqlUserManager) CreateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) (string, error)

CreateUser creates user with secret credentials

func (*MySqlUserManager) Delete

Delete deletes a user

func (*MySqlUserManager) DeleteSecrets

func (m *MySqlUserManager) DeleteSecrets(ctx context.Context, instance *v1alpha2.MySQLUser, secretClient secrets.SecretClient) (bool, error)

DeleteSecrets deletes the secrets associated with a SQLUser

func (*MySqlUserManager) Ensure

Ensure that user exists

func (*MySqlUserManager) GetDB

func (m *MySqlUserManager) GetDB(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (db mysqlmgmt.Database, err error)

GetDB retrieves a database

func (*MySqlUserManager) GetOrPrepareSecret

func (m *MySqlUserManager) GetOrPrepareSecret(ctx context.Context, instance *v1alpha2.MySQLUser, secretClient secrets.SecretClient) map[string][]byte

GetOrPrepareSecret gets or creates a secret

func (*MySqlUserManager) GetParents

GetParents gets the parents of the user

func (*MySqlUserManager) GetServer

func (m *MySqlUserManager) GetServer(ctx context.Context, resourceGroupName, serverName string) (mysqlmgmt.Server, error)

GetServer retrieves a server

func (*MySqlUserManager) GetStatus

func (s *MySqlUserManager) GetStatus(obj runtime.Object) (*v1alpha1.ASOStatus, error)

GetStatus gets the status

Jump to

Keyboard shortcuts

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