-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcmd_activate.go
46 lines (32 loc) · 1019 Bytes
/
cmd_activate.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
package main
import (
"log"
"strings"
common "github.com/apiheat/akamai-cli-common/v4"
service "github.com/apiheat/go-edgegrid/v6/service/netlistv2"
"github.com/urfave/cli/v2"
)
func cmdActivateNetList(c *cli.Context) error {
return activateNetList(c)
}
func activateNetList(c *cli.Context) error {
activationEnvironment := service.Staging
if c.Bool("prd") {
activationEnvironment = service.Production
}
if len(c.StringSlice("notificationRecipients")) < 1 {
log.Fatal("Please provide notificationRecipients!")
}
notificationRecipients := strings.Split(c.StringSlice("notificationRecipients")[0], ",")
actNetworkListOpts := service.NetworkListActivationOptsv2{
Comments: "",
Fast: c.Bool("fast"),
NotificationRecipients: notificationRecipients,
}
netListsActivation, err := apiClient.ActivateNetworkList(c.String("id"), activationEnvironment, actNetworkListOpts)
if err != nil {
return err
}
common.OutputJSON(netListsActivation)
return nil
}