Skip to content

Commit f70d9ad

Browse files
RafPepartamonov
authored andcommitted
Fix get all include elements #18 (#19)
* Fix #18 * Fix #20 * Fix credentials logic #19 * Bumps akamai-cli version file * Bumps cli.json version #19
1 parent e5abe63 commit f70d9ad

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"netl",
1010
"nl"
1111
],
12-
"version": "6.0.2",
12+
"version": "6.0.4",
1313
"description": "Network Lists management",
1414
"bin": "https://github.com/apiheat/akamai-cli-netlist/releases/download/v{{.Version}}/akamai-cli-{{.Name}}_{{.OS}}_{{.Arch}}{{.BinSuffix}}"
1515
}

cmd_list.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ func cmdlistNetListName(c *cli.Context) error {
2727
func listNetLists(c *cli.Context) error {
2828

2929
listNetListOptsv2 := service.ListNetworkListsOptionsv2{}
30+
listNetListOptsv2.IncludeElements = c.Bool("includeElements")
31+
listNetListOptsv2.Extended = c.Bool("extended")
3032

3133
// Since we are listing all we do not filter results
3234
listNetListOptsv2.Search = ""

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.13
44

55
require (
66
github.com/apiheat/akamai-cli-common v3.1.0+incompatible
7-
github.com/apiheat/go-edgegrid/v6 v6.1.8
7+
github.com/apiheat/go-edgegrid/v6 v6.1.10
88
github.com/google/go-querystring v1.0.0 // indirect
99
github.com/kr/pretty v0.1.0 // indirect
1010
github.com/mitchellh/go-homedir v1.1.0 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ github.com/apiheat/go-edgegrid v6.0.1+incompatible h1:JvwqSU89onb4/EcH32DFrp4dNu
55
github.com/apiheat/go-edgegrid v6.0.1+incompatible/go.mod h1:+gACyrB9+3TRIxCzdihSiCzrLSdhWvJAXq74KMfPzMs=
66
github.com/apiheat/go-edgegrid/v6 v6.1.8 h1:7ukNtaGVo/G3DvQ++Ngd0EV0Kb8W0ntGCMehTP+IEBw=
77
github.com/apiheat/go-edgegrid/v6 v6.1.8/go.mod h1:At9IQFFbIBGaRkyqQ08gvaHB7+HEvO/GgtICYuLUZkU=
8+
github.com/apiheat/go-edgegrid/v6 v6.1.9 h1:fyPbo5039al6AH0wMhGOYzp3IZMEDIi7Lr26eRQKIZc=
9+
github.com/apiheat/go-edgegrid/v6 v6.1.9/go.mod h1:At9IQFFbIBGaRkyqQ08gvaHB7+HEvO/GgtICYuLUZkU=
10+
github.com/apiheat/go-edgegrid/v6 v6.1.10 h1:1tuDurGfJa+/t+c5MnnFlrLeSJn5d06z9RZFd8UcCr0=
11+
github.com/apiheat/go-edgegrid/v6 v6.1.10/go.mod h1:At9IQFFbIBGaRkyqQ08gvaHB7+HEvO/GgtICYuLUZkU=
812
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f h1:y2hSFdXeA1y5z5f0vfNO0Dg5qVY036qzlz3Pds0B92o=
913
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
1014
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=

main.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,23 @@ func main() {
2222
app.Flags = common.CreateFlags()
2323
app.Before = func(c *cli.Context) error {
2424

25-
creds := edgegrid.NewCredentials().AutoLoad(c.GlobalString("section"))
25+
var creds *edgegrid.Credentials
26+
27+
if c.GlobalString("config") != common.HomeDir() {
28+
var err error
29+
creds, err = edgegrid.NewCredentials().FromFile(c.GlobalString("config")).Section(c.GlobalString("section"))
30+
31+
if err != nil {
32+
return err
33+
}
34+
} else {
35+
creds = edgegrid.NewCredentials().AutoLoad(c.GlobalString("section"))
36+
}
37+
38+
if creds == nil {
39+
return fmt.Errorf("Cannot load credentials")
40+
}
41+
2642
config := edgegrid.NewConfig().
2743
WithCredentials(creds).
2844
WithLogVerbosity(c.GlobalString("debug")).

0 commit comments

Comments
 (0)