-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.go
38 lines (28 loc) · 854 Bytes
/
cmd.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
package main
import (
common "github.com/apiheat/akamai-cli-common"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
func cmdReport(c *cli.Context) error {
return reportProperty(c)
}
func cmdReset(c *cli.Context) error {
return resetProperty(c)
}
func reportProperty(c *cli.Context) error {
report, err := apiClient.A2.ReportProperty(common.SetIntID(c, "Please provide ID for property"))
common.ErrorCheck(err)
common.PrintJSON(report.Body)
return nil
}
func resetProperty(c *cli.Context) error {
report, err := apiClient.A2.ResetProperty(common.SetIntID(c, "Please provide ID for property"))
common.ErrorCheck(err)
if report.Response.StatusCode == 204 {
log.Info("Reset request was completed successfully")
} else {
log.Info("Something went wrong! Response code is: %v", report.Response.StatusCode)
}
return nil
}