diff --git a/cmd/start/start.go b/cmd/start/start.go new file mode 100644 index 00000000..7f609836 --- /dev/null +++ b/cmd/start/start.go @@ -0,0 +1,49 @@ +/* +Copyright © 2019 Thorsten Klein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package start + +import ( + log "github.com/sirupsen/logrus" + + "github.com/spf13/cobra" +) + +// NewCmdStart returns a new cobra command +func NewCmdStart() *cobra.Command { + + // create new cobra command + cmd := &cobra.Command{ + Use: "start", + Short: "Start a resource.", + Long: `Start a resource.`, + Run: func(cmd *cobra.Command, args []string) { + log.Debugln("start called") + }, + } + + // add subcommands + cmd.AddCommand(NewCmdStartCluster()) + cmd.AddCommand(NewCmdStartNode()) + + // done + return cmd +} diff --git a/cmd/start/startCluster.go b/cmd/start/startCluster.go new file mode 100644 index 00000000..9f64d90d --- /dev/null +++ b/cmd/start/startCluster.go @@ -0,0 +1,52 @@ +/* +Copyright © 2019 Thorsten Klein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package start + +import ( + "github.com/spf13/cobra" + + "github.com/rancher/k3d/pkg/types" + + log "github.com/sirupsen/logrus" +) + +// NewCmdStartCluster returns a new cobra command +func NewCmdStartCluster() *cobra.Command { + + // create new command + cmd := &cobra.Command{ + Use: "cluster", + Short: "Start an existing k3d cluster", + Long: `Start an existing k3d cluster`, + Run: func(cmd *cobra.Command, args []string) { + log.Debugln("start cluster called") + }, + } + + // add flags + cmd.Flags().StringP("name", "n", types.DefaultClusterName, "Name of the cluster") + + // add subcommands + + // done + return cmd +} diff --git a/cmd/start/startNode.go b/cmd/start/startNode.go new file mode 100644 index 00000000..458478d2 --- /dev/null +++ b/cmd/start/startNode.go @@ -0,0 +1,45 @@ +/* +Copyright © 2019 Thorsten Klein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package start + +import ( + "github.com/spf13/cobra" + + log "github.com/sirupsen/logrus" +) + +// NewCmdStartNode returns a new cobra command +func NewCmdStartNode() *cobra.Command { + + // create new command + cmd := &cobra.Command{ + Use: "node", + Short: "Start an existing k3d node", + Long: `Start an existing k3d node.`, + Run: func(cmd *cobra.Command, args []string) { + log.Debugln("start node called") + }, + } + + // done + return cmd +} diff --git a/cmd/stop/stop.go b/cmd/stop/stop.go new file mode 100644 index 00000000..af94c08e --- /dev/null +++ b/cmd/stop/stop.go @@ -0,0 +1,49 @@ +/* +Copyright © 2019 Thorsten Klein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package stop + +import ( + log "github.com/sirupsen/logrus" + + "github.com/spf13/cobra" +) + +// NewCmdStop returns a new cobra command +func NewCmdStop() *cobra.Command { + + // create new cobra command + cmd := &cobra.Command{ + Use: "stop", + Short: "Stop a resource.", + Long: `Stop a resource.`, + Run: func(cmd *cobra.Command, args []string) { + log.Debugln("stop called") + }, + } + + // add subcommands + cmd.AddCommand(NewCmdStopCluster()) + cmd.AddCommand(NewCmdStopNode()) + + // done + return cmd +} diff --git a/cmd/stop/stopCluster.go b/cmd/stop/stopCluster.go new file mode 100644 index 00000000..31e2444d --- /dev/null +++ b/cmd/stop/stopCluster.go @@ -0,0 +1,52 @@ +/* +Copyright © 2019 Thorsten Klein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package stop + +import ( + "github.com/spf13/cobra" + + "github.com/rancher/k3d/pkg/types" + + log "github.com/sirupsen/logrus" +) + +// NewCmdStopCluster returns a new cobra command +func NewCmdStopCluster() *cobra.Command { + + // create new command + cmd := &cobra.Command{ + Use: "cluster", + Short: "Stop an existing k3d cluster", + Long: `Stop an existing k3d cluster.`, + Run: func(cmd *cobra.Command, args []string) { + log.Debugln("stop cluster called") + }, + } + + // add flags + cmd.Flags().StringP("name", "n", types.DefaultClusterName, "Name of the cluster") + + // add subcommands + + // done + return cmd +} diff --git a/cmd/stop/stopNode.go b/cmd/stop/stopNode.go new file mode 100644 index 00000000..a7bf503e --- /dev/null +++ b/cmd/stop/stopNode.go @@ -0,0 +1,45 @@ +/* +Copyright © 2019 Thorsten Klein + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +package stop + +import ( + "github.com/spf13/cobra" + + log "github.com/sirupsen/logrus" +) + +// NewCmdStopNode returns a new cobra command +func NewCmdStopNode() *cobra.Command { + + // create new command + cmd := &cobra.Command{ + Use: "node", + Short: "Stop an existing k3d node", + Long: `Stop an existing k3d node.`, + Run: func(cmd *cobra.Command, args []string) { + log.Debugln("stop node called") + }, + } + + // done + return cmd +}