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().VPSGetVirtualMachineV1WithResponse(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: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
}
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().VPSGetVirtualMachineListV1WithResponse(context.TODO()) 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 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 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.
Click to show internal directories.
Click to hide internal directories.