public_keys

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AttachCmd = &cobra.Command{
	Use:   "attach <virtual machine ID>",
	Short: "Attach public keys",
	Long: `This endpoint attaches an existing public keys from your account to a specified virtual machine.

Multiple keys can be attached to a single virtual machine.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSAttachPublicKeyV1WithResponse(context.TODO(), utils.StringToInt(args[0]), publickKeyAttachRequest(cmd, args))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create new public key",
	Long:  `This endpoint allows you to add a new public key to your account, which can then be attached to virtual machine instances for secure access.`,
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSCreateNewPublicKeyV1WithResponse(context.TODO(), publicKeyCreateRequest(cmd, args))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete <public key ID>",
	Short: "Delete public key",
	Long: `This endpoint deletes a public key from your account.

Deleting public key from account does not remove it from virtual machine`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSDeleteAPublicKeyV1WithResponse(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:   "public-keys",
	Short: "Public key management",
	Long:  `Manage SSH keys for secure access. This category covers adding new public keys, attaching them to virtual machines, retrieving key lists, and deleting keys.`,
}
View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Get public key list",
	Long:  `This endpoint retrieves a list of public keys associated with your account.`,
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetPublicKeyListV1WithResponse(context.TODO(), listRequestParameters(cmd))
		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