awsmysql

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 6 Imported by: 0

README

Package awsmysql provides shortcut functions to retrieve MySQL credentials from AWS Secrets Manager profile.

Usage example:

cfg, err := awsmysql.Config(ctx, "production/dbhost")
if err != nil {
    return err
}
// adjust config setting timeouts, database name, etc:
// see https://godoc.org/github.com/go-sql-driver/mysql#Config
cfg.DBName = "data"
connector, err := mysql.NewConnector(cfg) // package github.com/go-sql-driver/mysql
if err != nil {
    return err
}
db := sql.OpenDB(connector)

More details at: https://pkg.go.dev/github.com/artyom/awsmysql

Documentation

Overview

Package awsmysql provides shortcut functions to retrieve MySQL credentials from AWS Secrets Manager profile.

Usage:

cfg, err := awsmysql.Config(ctx, "production/dbhost")
if err != nil {
    return err
}
// adjust config setting timeouts, database name, etc:
// see https://godoc.org/github.com/go-sql-driver/mysql#Config
cfg.DBName = "data"
connector, err := mysql.NewConnector(cfg) // package github.com/go-sql-driver/mysql
if err != nil {
    return err
}
db := sql.OpenDB(connector)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(ctx context.Context, profile string) (*mysql.Config, error)

Config is a shortcut function that creates AWS SDK session and fetches MySQL credentials from specific AWS Secrets Manager profile.

func ConfigFromSecrets

func ConfigFromSecrets(ctx context.Context, svc *secretsmanager.SecretsManager, profile string) (*mysql.Config, error)

ConfigFromSecrets fetches MySQL credentials from specific AWS Secrets Manager profile using provided SecretsManager SDK service instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

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