firewall

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActivateCmd = &cobra.Command{
	Use:   "activate <firewall ID> <virtual machine ID> ",
	Short: "Activate firewall",
	Long: `This endpoint activates a firewall for a specified virtual machine.

Only one firewall can be active for a virtual machine at a time.`,
	Args: cobra.MatchAll(cobra.ExactArgs(2)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSActivateFirewallV1WithResponse(context.TODO(), utils.StringToInt(args[0]), utils.StringToInt(args[1]))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create new firewall",
	Long:  `This endpoint creates a new firewall.`,
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSCreateNewFirewallV1WithResponse(context.TODO(), firewallCreateRequest(cmd, args))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var DeactivateCmd = &cobra.Command{
	Use:   "deactivate <firewall ID> <virtual machine ID> ",
	Short: "Deactivate firewall",
	Long:  `This endpoint deactivates a firewall for a specified virtual machine.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(2)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSDeactivateFirewallV1WithResponse(context.TODO(), utils.StringToInt(args[0]), utils.StringToInt(args[1]))
		if err != nil {
			log.Fatal(err)
		}

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

Any virtual machine that has this firewall activated will automatically have it deactivated.`,
	Args: cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSDeleteFirewallV1WithResponse(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 <firewall ID>",
	Short: "Get firewall",
	Long:  `This endpoint retrieves firewall by its ID and rules associated with it.`,
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetFirewallV1WithResponse(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:   "firewall",
	Short: "Firewall management",
	Long: `Enhance network security with endpoints for creating, activating, deactivating, syncing, updating, and deleting firewalls and firewall rules for your virtual machines. 
This firewall applies rules at the network level, so it will take precedence over the virtual machine's internal firewall.`,
}
View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Get firewall list",
	Long:  `This endpoint retrieves a list of all firewalls available.`,
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSGetFirewallListV1WithResponse(context.TODO(), firewallListRequestParameters(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var SyncCmd = &cobra.Command{
	Use:   "sync <firewall ID> <virtual machine ID>",
	Short: "Sync firewall rules",
	Long: `This endpoint syncs a firewall for a specified virtual machine.

Firewall can loose sync with virtual machine if the firewall has new rules added, removed or updated.`,
	Args: cobra.MatchAll(cobra.ExactArgs(2)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().VPSSyncFirewallV1WithResponse(context.TODO(), utils.StringToInt(args[0]), utils.StringToInt(args[1]))
		if err != nil {
			log.Fatal(err)
		}

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

Functions

This section is empty.

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