/
gtm_hostnames.go
40 lines (31 loc) · 1.04 KB
/
gtm_hostnames.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
package cmd
import (
"github.com/akamai/cli-diagnostics/internal"
"github.com/spf13/cobra"
)
var (
testTargetIp string
)
var gtmHostnamesCmd = &cobra.Command{
Use: gtmHostnamesUse,
Example: gtmHostnamesExample,
Aliases: []string{"gtm"},
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
eghc := internal.NewEdgeGridHttpClient(globalFlags.edgeRcPath, globalFlags.edgeRcSection, globalFlags.accountSwitchKey)
api := internal.NewApiClient(*eghc)
svc := internal.NewService(*api, cmd, globalFlags.json)
if testTargetIp != "" {
svc.GtmTestTargetIp(testTargetIp)
} else {
svc.GtmHostnames()
}
},
}
func init() {
rootCmd.AddCommand(gtmHostnamesCmd)
gtmHostnamesCmd.Flags().SortFlags = false
gtmHostnamesCmd.Flags().StringVarP(&testTargetIp, "test-target-ip", "t", "", internal.GetMessageForKey(gtmHostnamesCmd, internal.TestTargetIp))
gtmHostnamesCmd.Short = internal.GetMessageForKey(gtmHostnamesCmd, internal.Short)
gtmHostnamesCmd.Long = internal.GetMessageForKey(gtmHostnamesCmd, internal.Long)
}