-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession.go
More file actions
33 lines (27 loc) · 859 Bytes
/
session.go
File metadata and controls
33 lines (27 loc) · 859 Bytes
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
27
28
29
30
31
32
33
package ggprov
import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/greengrass"
"github.com/aws/aws-sdk-go/service/greengrass/greengrassiface"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/iam/iamiface"
"github.com/aws/aws-sdk-go/service/iot"
"github.com/aws/aws-sdk-go/service/iot/iotiface"
)
// Svcs holds aws session and svcs
type Svcs struct {
GreengrassAPI greengrassiface.GreengrassAPI
IAMAPI iamiface.IAMAPI
IoTAPI iotiface.IoTAPI
Session *session.Session
}
// CreateSvcs create an aws session and configure the svcs
func CreateSvcs() (*Svcs, error) {
svcs := &Svcs{}
sess := session.Must(session.NewSession())
svcs.GreengrassAPI = greengrass.New(sess)
svcs.IAMAPI = iam.New(sess)
svcs.IoTAPI = iot.New(sess)
svcs.Session = sess
return svcs, nil
}