mirror of
https://github.com/openziti/zrok.git
synced 2025-01-08 23:20:04 +01:00
lint
This commit is contained in:
parent
4cd61f85ca
commit
4d427894ea
@ -1,30 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/openziti-test-kitchen/zrok/rest_client_zrok/metadata"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
apiCmd.AddCommand(apiVersionCmd)
|
||||
rootCmd.AddCommand(apiCmd)
|
||||
}
|
||||
|
||||
var apiCmd = &cobra.Command{
|
||||
Use: "api",
|
||||
Short: "Exercise API calls",
|
||||
}
|
||||
|
||||
var apiVersionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Get API version",
|
||||
Run: func(_ *cobra.Command, args []string) {
|
||||
zrok := newZrokClient()
|
||||
resp, err := zrok.Metadata.Version(metadata.NewVersionParams())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
logrus.Infof("found api version [%v]", resp.Payload)
|
||||
},
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/x509"
|
||||
"github.com/openziti/edge/rest_management_api_client/identity"
|
||||
"github.com/openziti/edge/rest_util"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
edgeCmd.AddCommand(edgePingCmd)
|
||||
edgeCmd.PersistentFlags().StringVarP(&edgeCmdUsername, "username", "u", "admin", "Edge API username")
|
||||
edgeCmd.PersistentFlags().StringVarP(&edgeCmdPassword, "password", "p", "admin", "Edge API password")
|
||||
rootCmd.AddCommand(edgeCmd)
|
||||
}
|
||||
|
||||
var edgeCmd = &cobra.Command{
|
||||
Use: "edge",
|
||||
Short: "Exercise the edge management API",
|
||||
}
|
||||
var edgeCmdUsername string
|
||||
var edgeCmdPassword string
|
||||
|
||||
var edgePingCmd = &cobra.Command{
|
||||
Use: "ping",
|
||||
Short: "Validate edge management connectivity",
|
||||
Run: func(_ *cobra.Command, args []string) {
|
||||
ctrlAddress := "https://linux:1280"
|
||||
caCerts, err := rest_util.GetControllerWellKnownCas(ctrlAddress)
|
||||
if err != nil {
|
||||
panic(errors.Wrap(err, "error getting cas"))
|
||||
}
|
||||
caPool := x509.NewCertPool()
|
||||
for _, ca := range caCerts {
|
||||
caPool.AddCert(ca)
|
||||
}
|
||||
client, err := rest_util.NewEdgeManagementClientWithUpdb(edgeCmdUsername, edgeCmdPassword, ctrlAddress, caPool)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
resp, err := client.Identity.ListIdentities(identity.NewListIdentitiesParams(), nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, id := range resp.Payload.Data {
|
||||
if id.Name != nil {
|
||||
logrus.Infof("identity = '%s'", *id.Name)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user