diff --git a/Gopkg.lock b/Gopkg.lock index 2bb75cd..a311fee 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -20,17 +20,15 @@ "gen-go/apache/aurora", "response" ] - revision = "9631aa3aab9964631946814fa0d8b99a133c982f" - version = "v1.1.0" + revision = "dbb08ded90109302f32ae52821d7a28919406389" + version = "v1.2.0" [[projects]] name = "github.com/pkg/errors" packages = ["."] - revision = "645ef00459ed84a119197bfb8d8205042c6df63d" - version = "v0.8.0" + revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc" [[projects]] - branch = "master" name = "github.com/samuel/go-zookeeper" packages = ["zk"] revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5" @@ -49,6 +47,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "e80e920e8ce403740797f4b5428c7e3380244d0b4cba4faa9e22cf1bee6beeea" + inputs-digest = "2c5d0cedd3956478027941d8fd3f3a18b72a8ffd26f3fa3567a7dc7eaae16d50" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index d644063..069ad5b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,29 +1,8 @@ -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - required = ["git.apache.org/thrift.git/lib/go/thrift"] [[constraint]] name = "github.com/paypal/gorealis" - version = "1.1.0" + version = "1.2.0" [[constraint]] name = "github.com/spf13/cobra" diff --git a/cmd/fetch.go b/cmd/fetch.go new file mode 100644 index 0000000..5958038 --- /dev/null +++ b/cmd/fetch.go @@ -0,0 +1,48 @@ +package cmd + +import ( + "fmt" + "os" + + "github.com/paypal/gorealis/gen-go/apache/aurora" + "github.com/spf13/cobra" +) + +func init() { + rootCmd.AddCommand(fetchCmd) + + // Sub-commands + fetchCmd.AddCommand(taskConfigCmd) + taskConfigCmd.Flags().StringVarP(&env, "environment", "e", "", "Aurora Environment") + taskConfigCmd.Flags().StringVarP(&role, "role", "r", "", "Aurora Role") + taskConfigCmd.Flags().StringVarP(&name, "name", "n", "", "Aurora Name") +} + +var fetchCmd = &cobra.Command{ + Use: "fetch", + Short: "Fetch information from Aurora", +} + +var taskConfigCmd = &cobra.Command{ + Use: "config" , + Short: "Fetch a list of task configurations from Aurora.", + Long: `To be written.`, + Run: fetchTasks, +} + +func fetchTasks(cmd *cobra.Command, args []string) { + fmt.Printf("Fetching job configuration for [%s/%s/%s] \n", env, role, name) + + //TODO: Add filtering down by status + taskQuery := &aurora.TaskQuery{Environment: env, Role: role, JobName: name} + + tasks, err := client.GetTasksWithoutConfigs(taskQuery) + if err != nil { + fmt.Printf("error: %+v\n", err.Error()) + os.Exit(1) + } + + for _, t := range tasks { + fmt.Println(t) + } +}