virtual_machines

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetAttachedKeysCmd = &cobra.Command{
	Use:   "get-attached-keys <virtual machine ID>",
	Short: "Get attached public keys",
	Long:  `This endpoint retrieves a list of public keys attached to a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetAttachedPublicKeysV1WithResponse(context.TODO(), utils.StringToInt(args[0]), attachedKeysRequestParameters(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var GetCmd = &cobra.Command{
	Use:   "get <virtual machine ID>",
	Short: "Get virtual machine",
	Long:  `This endpoint retrieves detailed information about a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetVirtualMachineDetailsV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var GetMetricsCmd = &cobra.Command{
	Use:   "metrics <virtual machine ID>",
	Short: "Get metrics",
	Long:  `This endpoint retrieves the historical metrics for a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetMetricsV1WithResponse(context.TODO(), utils.StringToInt(args[0]), metricsRequestParameters(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "vm",
	Short: "Virtual machine management",
	Long:  ``,
}
View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Get virtual machine list",
	Long:  `This endpoint retrieves a list of all available virtual machines.`,
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetVirtualMachinesV1WithResponse(context.TODO())
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var PurchaseCmd = &cobra.Command{
	Use:   "purchase",
	Short: "Purchase and setup a new virtual machine",
	Long: `This endpoint purchases a new virtual machine using the provided catalog price item and payment method, and
sets it up with the selected operating system template in the chosen data center.

The purchased virtual machine will be set for automatic renewal.`,
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSPurchaseNewVirtualMachineV1WithResponse(context.TODO(), purchaseRequestFromFlags(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var RecreateCmd = &cobra.Command{
	Use:   "recreate <virtual machine ID>",
	Short: "Recreate virtual machine",
	Long: `This endpoint will recreate a virtual machine from scratch. The recreation process involves reinstalling the 
operating system and resetting the virtual machine to its initial state. Snapshots, if there are any, will be deleted.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSRecreateVirtualMachineV1WithResponse(context.TODO(), utils.StringToInt(args[0]), recreateRequestFromFlags(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var ResetHostnameCmd = &cobra.Command{
	Use:   "reset-hostname <virtual machine ID>",
	Short: "Reset hostname",
	Long:  `This endpoint resets the hostname and PTR record of a specified virtual machine to the default value.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSResetHostnameV1WithResponse(context.TODO(), utils.StringToInt(args[0]))

		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var RestartCmd = &cobra.Command{
	Use:   "restart <virtual machine ID>",
	Short: "Restart virtual machine",
	Long: `This endpoint restarts a specified virtual machine. This is equivalent to fully stopping and starting the virtual machine.

If the virtual machine was stopped, then it will be started.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSRestartVirtualMachineV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var SetHostnameCmd = &cobra.Command{
	Use:   "set-hostname <virtual machine ID>",
	Short: "Set hostname",
	Long: `This endpoint sets the hostname for a specified virtual machine. Changing hostname does not update PTR record automatically.
If you want your virtual machine to be reachable by a hostname, you need to point your domain A/AAAA records 
to virtual machine IP as well.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSSetHostnameV1WithResponse(context.TODO(), utils.StringToInt(args[0]), setHostnameRequest(cmd))

		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var SetNameserversCmd = &cobra.Command{
	Use:   "set-nameservers <virtual machine ID>",
	Short: "Set nameservers",
	Long: `This endpoint sets the nameservers for a specified virtual machine. 
Be aware, that improper nameserver configuration can lead to the virtual machine being unable to resolve domain names.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSSetNameserversV1WithResponse(context.TODO(), utils.StringToInt(args[0]), setNameserversRequest(cmd))

		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var SetPanelPasswordCmd = &cobra.Command{
	Use:   "set-panel-password <virtual machine ID>",
	Short: "Set panel password",
	Long: `This endpoint sets the panel password for a specified virtual machine. 
If virtual machine does not use panel OS, the request will still be processed without any effect.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSSetPanelPasswordV1WithResponse(context.TODO(), utils.StringToInt(args[0]), setPanelPasswordRequest(cmd))

		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var SetRootPasswordCmd = &cobra.Command{
	Use:   "set-root-password <virtual machine ID>",
	Short: "Set root password",
	Long:  `This endpoint sets the root password for a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSSetRootPasswordV1WithResponse(context.TODO(), utils.StringToInt(args[0]), setRootPasswordRequest(cmd))

		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var SetupCmd = &cobra.Command{
	Use:   "setup <virtual machine ID>",
	Short: "Setup purchased virtual machine",
	Long: `This endpoint sets up a newly purchased virtual machine that has not been set up yet, by installing the
selected operating system template in the chosen data center.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSSetupPurchasedVirtualMachineV1WithResponse(context.TODO(), utils.StringToInt(args[0]), setupRequestFromFlags(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var StartCmd = &cobra.Command{
	Use:   "start <virtual machine ID>",
	Short: "Start a virtual machine",
	Long: `This endpoint starts a specified virtual machine. If the virtual machine is already running, 
the request will still be processed without any effect.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSStartVirtualMachineV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var StopCmd = &cobra.Command{
	Use:   "stop <virtual machine ID>",
	Short: "Stop a virtual machine",
	Long: `This endpoint stops a specified virtual machine. If the virtual machine is already stopped, 
the request will still be processed without any effect.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSStopVirtualMachineV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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