Documentation ¶
Index ¶
- Constants
- func GetAdminSecretKey(adminSecretName string, namespace string) secrets.SecretKey
- func MakeSecretKey(secretClient secrets.SecretClient, instance *v1alpha1.AzureSQLUser) secrets.SecretKey
- type AzureSqlUserManager
- func (m *AzureSqlUserManager) ConnectToSqlDb(ctx context.Context, drivername string, server string, database string, ...) (*sql.DB, error)
- func (m *AzureSqlUserManager) CreateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) (string, error)
- func (s *AzureSqlUserManager) Delete(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
- func (m *AzureSqlUserManager) DeleteSecrets(ctx context.Context, instance *v1alpha1.AzureSQLUser, ...) (bool, error)
- func (m *AzureSqlUserManager) DropUser(ctx context.Context, db *sql.DB, user string) error
- func (s *AzureSqlUserManager) Ensure(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
- func (m *AzureSqlUserManager) GetDB(ctx context.Context, subscriptionID string, resourceGroupName string, ...) (azuresql.Database, error)
- func (m *AzureSqlUserManager) GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.AzureSQLUser, ...) map[string][]byte
- func (s *AzureSqlUserManager) GetParents(obj runtime.Object) ([]resourcemanager.KubeParent, error)
- func (s *AzureSqlUserManager) GetStatus(obj runtime.Object) (*v1alpha1.ASOStatus, error)
- func (m *AzureSqlUserManager) GrantUserRoles(ctx context.Context, user string, roles []string, db *sql.DB) error
- func (m *AzureSqlUserManager) UpdateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) error
- func (m *AzureSqlUserManager) UserExists(ctx context.Context, db *sql.DB, username string) (bool, error)
- type SqlUserManager
Constants ¶
View Source
const DriverName = "sqlserver"
DriverName is driver name for db connection
View Source
const SecretPasswordKey = "password"
SecretPasswordKey is the password key in secret
View Source
const SecretUsernameKey = "username"
SecretUsernameKey is the username key in secret
View Source
const SqlServerPort = 1433
SqlServerPort is the default server port for sql server
Variables ¶
This section is empty.
Functions ¶
func GetAdminSecretKey ¶
func MakeSecretKey ¶
func MakeSecretKey(secretClient secrets.SecretClient, instance *v1alpha1.AzureSQLUser) secrets.SecretKey
Types ¶
type AzureSqlUserManager ¶
type AzureSqlUserManager struct { Creds config.Credentials SecretClient secrets.SecretClient Scheme *runtime.Scheme }
func NewAzureSqlUserManager ¶
func NewAzureSqlUserManager(creds config.Credentials, secretClient secrets.SecretClient, scheme *runtime.Scheme) *AzureSqlUserManager
func (*AzureSqlUserManager) ConnectToSqlDb ¶
func (m *AzureSqlUserManager) ConnectToSqlDb(ctx context.Context, drivername string, server string, database string, port int, user string, password string) (*sql.DB, error)
ConnectToSqlDb connects to the SQL db using the given credentials
func (*AzureSqlUserManager) CreateUser ¶
func (m *AzureSqlUserManager) CreateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) (string, error)
CreateUser creates user with secret credentials
func (*AzureSqlUserManager) Delete ¶
func (s *AzureSqlUserManager) Delete(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
Delete deletes a user
func (*AzureSqlUserManager) DeleteSecrets ¶
func (m *AzureSqlUserManager) DeleteSecrets(ctx context.Context, instance *v1alpha1.AzureSQLUser, secretClient secrets.SecretClient) (bool, error)
DeleteSecrets deletes the secrets associated with a SQLUser
func (*AzureSqlUserManager) Ensure ¶
func (s *AzureSqlUserManager) Ensure(ctx context.Context, obj runtime.Object, opts ...resourcemanager.ConfigOption) (bool, error)
Ensure that user exists
func (*AzureSqlUserManager) GetDB ¶
func (m *AzureSqlUserManager) GetDB(ctx context.Context, subscriptionID string, resourceGroupName string, serverName string, databaseName string) (azuresql.Database, error)
GetDB retrieves a database
func (*AzureSqlUserManager) GetOrPrepareSecret ¶
func (m *AzureSqlUserManager) GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.AzureSQLUser, secretClient secrets.SecretClient) map[string][]byte
GetOrPrepareSecret gets or creates a secret
func (*AzureSqlUserManager) GetParents ¶
func (s *AzureSqlUserManager) GetParents(obj runtime.Object) ([]resourcemanager.KubeParent, error)
GetParents gets the parents of the user
func (*AzureSqlUserManager) GrantUserRoles ¶
func (m *AzureSqlUserManager) GrantUserRoles(ctx context.Context, user string, roles []string, db *sql.DB) error
GrantUserRoles grants roles to a user for a given database
func (*AzureSqlUserManager) UpdateUser ¶
func (m *AzureSqlUserManager) UpdateUser(ctx context.Context, secret map[string][]byte, db *sql.DB) error
UpdateUser - Updates user password
func (*AzureSqlUserManager) UserExists ¶
func (m *AzureSqlUserManager) UserExists(ctx context.Context, db *sql.DB, username string) (bool, error)
UserExists checks if db contains user
type SqlUserManager ¶
type SqlUserManager interface { GetDB(ctx context.Context, resourceGroupName string, serverName string, databaseName string) (azuresql.Database, error) ConnectToSqlDb(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.AzureSQLUser, secretClient secrets.SecretClient) (bool, error) GetOrPrepareSecret(ctx context.Context, instance *v1alpha1.AzureSQLUser, secretClient secrets.SecretClient) map[string][]byte // also embed methods from AsyncClient resourcemanager.ARMClient }
Click to show internal directories.
Click to hide internal directories.