-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy.go
68 lines (58 loc) · 1.7 KB
/
deploy.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package gghelper
import (
"fmt"
"github.com/aws/aws-sdk-go/service/greengrass"
)
// CreateDeployment - Create a deployment
func (ggSession *GreengrassSession) CreateDeployment() error {
deployments, err := ggSession.greengrass.ListDeployments(&greengrass.ListDeploymentsInput{
GroupId: &ggSession.config.Group.ID,
})
if err != nil {
return err
}
fmt.Printf("deployments: %v\n", deployments)
newDeployment := "NewDeployment"
create, err := ggSession.greengrass.CreateDeployment(&greengrass.CreateDeploymentInput{
DeploymentType: &newDeployment,
GroupId: &ggSession.config.Group.ID,
GroupVersionId: &ggSession.config.Group.Version,
})
if err != nil {
return err
}
fmt.Printf("%v\n", create)
return nil
}
// ListDeployment - lists the current deployment status
func (ggSession *GreengrassSession) ListDeployment() error {
deployments, err := ggSession.greengrass.ListDeployments(&greengrass.ListDeploymentsInput{
GroupId: &ggSession.config.Group.ID,
})
if err != nil {
return err
}
fmt.Printf("deployments: %v\n", deployments)
for _, d := range deployments.Deployments {
deployment, err := ggSession.greengrass.GetDeploymentStatus(&greengrass.GetDeploymentStatusInput{
DeploymentId: d.DeploymentId,
GroupId: &ggSession.config.Group.ID,
})
if err != nil {
return err
}
fmt.Printf("deployment: %v\n", deployment)
}
return nil
}
// ResetDeployment - reset deployments status
func (ggSession *GreengrassSession) ResetDeployment(force bool) error {
reset, err := ggSession.greengrass.ResetDeployments(&greengrass.ResetDeploymentsInput{
GroupId: &ggSession.config.Group.ID,
})
if err != nil {
return err
}
fmt.Printf("deployment reset: %v\n", reset)
return nil
}