vm

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Utkarsh Srivastava <utkarsh@sagacious.dev>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete",
	Short: "Delete Kindli VM",
	Run: func(cmd *cobra.Command, args []string) {
		name, err := cmd.Flags().GetString("vm-name")
		utils.ExitIfNotNil(err)
		utils.ExitIfNotNil(RunDelete(name))
	},
}

DeleteCmd represents the delete command

View Source
var EditCmd = &cobra.Command{
	Use:   "edit",
	Short: "Edit Kindli VM",
	Run: func(cmd *cobra.Command, args []string) {
		name, err := cmd.Flags().GetString("vm-name")
		utils.ExitIfNotNil(err)
		utils.ExitIfNotNil(RunEdit(name))
	},
}

EditCmd represents the edit command

View Source
var ListCmd = &cobra.Command{
	Use:        "list",
	Short:      "Prints the list of VMs",
	Deprecated: "This command is deprecated use `kindli vm status -A` instead",
	Run: func(cmd *cobra.Command, args []string) {
		vms, err := RunList()
		utils.ExitIfNotNil(err)

		fmt.Println(strings.Join(vms, "\n"))
	},
}

ListCmd represents the list command

View Source
var RestartCmd = &cobra.Command{
	Use:   "restart",
	Short: "Restart Kindli VM",
	Run: func(cmd *cobra.Command, args []string) {
		name, err := cmd.Flags().GetString("vm-name")
		utils.ExitIfNotNil(err)
		utils.ExitIfNotNil(RunRestart(name))
	},
}

RestartCmd represents the restart command

View Source
var ShellCmd = &cobra.Command{
	Use:   "shell",
	Short: "SSH into the Kindli VM",
	Run: func(cmd *cobra.Command, args []string) {
		name, err := cmd.Flags().GetString("vm-name")
		utils.ExitIfNotNil(err)

		utils.ExitIfNotNil(RunShell(name, args))
	},
}

ShellCmd represents the shell command

View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "Start a new VM for Kindli",
	Long: `Start a new VM for Kindli.

NOTE: VM will be created using lima`,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		if arch != "" && arch != "x86_64" && arch != "aarch64" {
			return fmt.Errorf("invalid --arch value, can be only \"x86_64\" or \"aarch64\"")
		}

		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		name, err := cmd.Flags().GetString("vm-name")
		utils.ExitIfNotNil(err)
		utils.ExitIfNotNil(RunStart(name))
	},
}

StartCmd represents the start command

View Source
var StatusCmd = &cobra.Command{
	Use:   "status",
	Short: "Status of Kindli VM",
	Run: func(cmd *cobra.Command, args []string) {
		name, _ := cmd.Flags().GetString("vm-name")
		all, _ := cmd.Flags().GetBool("all")

		if all {
			utils.ExitIfNotNil(RunStatus(""))
			return
		}

		utils.ExitIfNotNil(RunStatus(name))
	},
}

StatusCmd represents the status command

View Source
var StopCmd = &cobra.Command{
	Use:   "stop",
	Short: "Stop running Kindli VM",
	Run: func(cmd *cobra.Command, args []string) {
		name, err := cmd.Flags().GetString("vm-name")
		utils.ExitIfNotNil(err)
		utils.ExitIfNotNil(RunStop(name))
	},
}

StopCmd represents the stop command

View Source
var VMCmd = &cobra.Command{
	Use:   "vm",
	Short: "Commands for managing lifecycle of kindli virtual machine",
}

VMCmd represents the preq command

Functions

func RunDelete

func RunDelete(name string) error

func RunEdit added in v0.0.6

func RunEdit(name string) error

func RunList added in v0.0.4

func RunList() ([]string, error)

func RunRestart

func RunRestart(name string) error

func RunShell

func RunShell(name string, args []string) error

func RunStart

func RunStart(name string) error

func RunStatus

func RunStatus(name string) error

func RunStop

func RunStop(name string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL