Documentation ¶
Index ¶
- Constants
- type PSqlUserManager
- type PostgreSqlUserManager
- func (m *PostgreSqlUserManager) ConnectToSqlDb(ctx context.Context, drivername string, fullservername string, database string, ...) (*sql.DB, error)
- func (m *PostgreSqlUserManager) CreateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) (string, error)
- func (m *PostgreSqlUserManager) Delete(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
- func (m *PostgreSqlUserManager) DeleteSecrets(ctx context.Context, instance *v1alpha1.PostgreSQLUser, ...) (bool, error)
- func (m *PostgreSqlUserManager) DropUser(ctx context.Context, db *sql.DB, user string) error
- func (m *PostgreSqlUserManager) Ensure(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
- func (m *PostgreSqlUserManager) GetDB(ctx context.Context, resourceGroupName string, serverName string, ...) (db psql.Database, err error)
- func (m *PostgreSqlUserManager) GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.PostgreSQLUser, ...) map[string][]byte
- func (m *PostgreSqlUserManager) GetParents(obj runtime.Object) ([]resourcemanager.KubeParent, error)
- func (m *PostgreSqlUserManager) GetStatus(obj runtime.Object) (*v1alpha1.ASOStatus, error)
- func (m *PostgreSqlUserManager) GrantUserRoles(ctx context.Context, user string, roles []string, db *sql.DB) error
- func (m *PostgreSqlUserManager) UpdateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) error
- func (m *PostgreSqlUserManager) UserExists(ctx context.Context, db *sql.DB, username string) (bool, error)
Constants ¶
const PDriverName = "postgres"
PDriverName is driver name for psqldb connection
const PSecretPasswordKey = "password"
PSecretPasswordKey is the password key in secret
const PSecretUsernameKey = "username"
PSecretUsernameKey is the username key in secret
const PSqlServerPort = 5432
PSqlServerPort is the default server port for sql server
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PSqlUserManager ¶
type PSqlUserManager interface { GetDB(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (psql.Database, error) ConnectToPostgreSqlDb(ctx context.Context, drivername string, server string, dbname string, port int, username string, password string) (*sql.DB, error) GrantUserRoles(ctx context.Context, user string, roles []string, db *sql.DB) error CreateUser(ctx context.Context, 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.PostgreSQLUser, secretClient secrets.SecretClient) (bool, error) GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.PostgreSQLUser, secretClient secrets.SecretClient) map[string][]byte // also embed methods from AsyncClient resourcemanager.ARMClient }
type PostgreSqlUserManager ¶
type PostgreSqlUserManager struct { Creds config.Credentials SecretClient secrets.SecretClient Scheme *runtime.Scheme }
PostgreSqlUserManager for psqluser manager
func NewPostgreSqlUserManager ¶
func NewPostgreSqlUserManager(creds config.Credentials, secretClient secrets.SecretClient, scheme *runtime.Scheme) *PostgreSqlUserManager
NewPostgreSqlUserManager creates a new PostgreSqlUserManager
func (*PostgreSqlUserManager) ConnectToSqlDb ¶
func (m *PostgreSqlUserManager) ConnectToSqlDb(ctx context.Context, drivername string, fullservername string, database string, port int, user string, password string) (*sql.DB, error)
ConnectToSqlDb connects to the PostgreSQL db using the given credentials
func (*PostgreSqlUserManager) CreateUser ¶
func (m *PostgreSqlUserManager) CreateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) (string, error)
CreateUser creates user with secret credentials
func (*PostgreSqlUserManager) Delete ¶
func (m *PostgreSqlUserManager) Delete(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
Delete deletes a user
func (*PostgreSqlUserManager) DeleteSecrets ¶
func (m *PostgreSqlUserManager) DeleteSecrets(ctx context.Context, instance *v1alpha1.PostgreSQLUser, secretClient secrets.SecretClient) (bool, error)
DeleteSecrets deletes the secrets associated with a SQLUser
func (*PostgreSqlUserManager) Ensure ¶
func (m *PostgreSqlUserManager) Ensure(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
Ensure that user exists
func (*PostgreSqlUserManager) GetDB ¶
func (m *PostgreSqlUserManager) GetDB(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (db psql.Database, err error)
GetDB retrieves a database
func (*PostgreSqlUserManager) GetOrPrepareSecret ¶
func (m *PostgreSqlUserManager) GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.PostgreSQLUser, secretClient secrets.SecretClient) map[string][]byte
GetOrPrepareSecret gets or creates a secret
func (*PostgreSqlUserManager) GetParents ¶
func (m *PostgreSqlUserManager) GetParents(obj runtime.Object) ([]resourcemanager.KubeParent, error)
GetParents gets the parents of the user
func (*PostgreSqlUserManager) GrantUserRoles ¶
func (m *PostgreSqlUserManager) GrantUserRoles(ctx context.Context, user string, roles []string, db *sql.DB) error
GrantUserRoles grants roles to a user for a given database
func (*PostgreSqlUserManager) UpdateUser ¶
func (m *PostgreSqlUserManager) UpdateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) error
UpdateUser - Updates user password
func (*PostgreSqlUserManager) UserExists ¶
func (m *PostgreSqlUserManager) UserExists(ctx context.Context, db *sql.DB, username string) (bool, error)
UserExists checks if db contains user