/
client.go
26 lines (23 loc) · 937 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package rds
import (
"github.com/YaleSpinup/rds-api/pkg/common"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/rds"
"github.com/aws/aws-sdk-go/service/rds/rdsiface"
)
// Client struct contains the initialized RDS service and other RDS-related parameters
type Client struct {
Service rdsiface.RDSAPI
DefaultSubnetGroup string
DefaultDBParameterGroupName map[string]string
DefaultDBClusterParameterGroupName map[string]string
}
// NewSession creates an AWS session for RDS and returns an RDSClient
func NewSession(sess *session.Session, c common.CommonConfig) *Client {
return &Client{
Service: rds.New(sess),
DefaultSubnetGroup: c.DefaultSubnetGroup,
DefaultDBParameterGroupName: c.DefaultDBParameterGroupName,
DefaultDBClusterParameterGroupName: c.DefaultDBClusterParameterGroupName,
}
}