snapshots

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:   "create <virtual machine ID>",
	Short: "Create snapshot",
	Long: `This endpoint creates a snapshot of a specified virtual machine. A snapshot captures the state and data of 
the virtual machine at a specific point in time, allowing users to restore the virtual machine to that state if needed. 
This operation is useful for backup purposes, system recovery, and testing changes without affecting the current state
of the virtual machine.

Creating new snapshot will overwrite the existing snapshot!`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSCreateSnapshotV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete <virtual machine ID>",
	Short: "Delete snapshot",
	Long:  `This endpoint deletes a snapshot of a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSDeleteSnapshotV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		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 snapshot",
	Long:  `This endpoint retrieves a snapshot for a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetSnapshotV1WithResponse(context.TODO(), utils.StringToInt(args[0]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "snapshots",
	Short: "Snapshot management",
	Long: `Create, restore, or delete snapshots that capture the state of your virtual machines at a given point, 
allowing you to quickly recover or test changes without affecting current operations.`,
}
View Source
var RestoreCmd = &cobra.Command{
	Use:   "restore <virtual machine ID>",
	Short: "Restore snapshot",
	Long: `This endpoint restores a specified virtual machine to a previous state using a snapshot. Restoring from a 
snapshot allows users to revert the virtual machine to that state, which is useful for system recovery, 
undoing changes, or testing.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSRestoreSnapshotV1WithResponse(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