Skip to content

Commit

Permalink
Merge the apg generated CLI into the registry tool. (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
timburks authored May 18, 2022
1 parent 6fa691b commit a3d3990
Show file tree
Hide file tree
Showing 54 changed files with 98 additions and 116 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ ifeq (, $(shell which protoc))
endif

all: protos
./tools/GENERATE-APG.sh
./tools/GENERATE-CLI.sh
go install ./...

apg: protoc
./tools/GENERATE-APG.sh
go install ./cmd/apg

protos: protoc
./tools/GENERATE-RPC.sh
./tools/GENERATE-GRPC.sh
Expand Down
18 changes: 0 additions & 18 deletions cmd/apg/README.md

This file was deleted.

20 changes: 20 additions & 0 deletions cmd/registry/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ import (
"github.com/apigee/registry/cmd/registry/cmd/resolve"
"github.com/apigee/registry/cmd/registry/cmd/upload"
"github.com/apigee/registry/cmd/registry/cmd/vocabulary"

"github.com/apigee/registry/cmd/registry/cmd/rpc"

"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -57,6 +60,23 @@ func Command() *cobra.Command {
cmd.AddCommand(list.Command())
cmd.AddCommand(upload.Command())
cmd.AddCommand(vocabulary.Command())
cmd.AddCommand(RPCCommand())
return cmd
}

func RPCCommand() *cobra.Command {
cmd := rpc.RegistryServiceCmd
cmd.Use = "rpc"
cmd.Short = "Make direct calls to RPC methods"
cmd.Long = cmd.Short
cmd.PersistentFlags().BoolVarP(&rpc.Verbose, "verbose", "v", false, "Print verbose output")
cmd.PersistentFlags().BoolVarP(&rpc.OutputJSON, "json", "j", false, "Print JSON output")

rpc.AdminServiceCmd.Use = "admin"
rpc.AdminServiceCmd.Short = "Make direct calls to Admin RPC methods (self-hosted installations only)"
rpc.AdminServiceCmd.Long = rpc.AdminServiceCmd.Short
rpc.AdminServiceCmd.Hidden = true
cmd.AddCommand(rpc.AdminServiceCmd)

return cmd
}
2 changes: 2 additions & 0 deletions cmd/registry/cmd/rpc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The files in this directory are automatically generated by
[tools/GENERATE-CLI](/tools/GENERATE-CLI.sh).
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"fmt"
Expand Down Expand Up @@ -34,21 +34,6 @@ func init() {
AdminConfig.SetEnvPrefix("APG_REGISTRY")
AdminConfig.AutomaticEnv()

AdminServiceCmd.PersistentFlags().Bool("insecure", false, "Make insecure client connection. Or use APG_REGISTRY_INSECURE. Must be used with \"address\" option")
AdminConfig.BindPFlag("insecure", AdminServiceCmd.PersistentFlags().Lookup("insecure"))
AdminConfig.BindEnv("insecure")

AdminServiceCmd.PersistentFlags().String("address", "", "Set API address used by client. Or use APG_REGISTRY_ADDRESS.")
AdminConfig.BindPFlag("address", AdminServiceCmd.PersistentFlags().Lookup("address"))
AdminConfig.BindEnv("address")

AdminServiceCmd.PersistentFlags().String("token", "", "Set Bearer token used by the client. Or use APG_REGISTRY_TOKEN.")
AdminConfig.BindPFlag("token", AdminServiceCmd.PersistentFlags().Lookup("token"))
AdminConfig.BindEnv("token")

AdminServiceCmd.PersistentFlags().String("api_key", "", "Set API Key used by the client. Or use APG_REGISTRY_API_KEY.")
AdminConfig.BindPFlag("api_key", AdminServiceCmd.PersistentFlags().Lookup("api_key"))
AdminConfig.BindEnv("api_key")
}

var AdminServiceCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cmd/apg/apg.go → cmd/registry/cmd/rpc/apg.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"os"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion cmd/apg/get-api.go → cmd/registry/cmd/rpc/get-api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion cmd/apg/list-apis.go → cmd/registry/cmd/rpc/list-apis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Code generated. DO NOT EDIT.

package main
package rpc

import (
"github.com/spf13/cobra"
Expand Down
Loading

0 comments on commit a3d3990

Please sign in to comment.