Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vm firewall options #146

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -980,16 +980,16 @@
}

type FirewallVirtualMachineOption struct {
Enable bool `json:"enable,omitempty"`
Dhcp bool `json:"dhcp,omitempty"`
Ipfilter bool `json:"ipfilter,omitempty"`
LogLevelIn string `json:"log_level_in,omitempty"`
LogLevelOut string `json:"log_level_out,omitempty"`
Macfilter bool `json:"macfilter,omitempty"`
Ntp bool `json:"ntp,omitempty"`
PolicyIn string `json:"policy_in,omitempty"`
PolicyOut string `json:"policy_out,omitempty"`
Radv bool `json:"radv,omitempty"`
Enable *IntOrBool `json:"enable,omitempty"`
Dhcp *IntOrBool `json:"dhcp,omitempty"`
IpFilter *IntOrBool `json:"ipfilter,omitempty"`

Check failure on line 985 in types.go

View workflow job for this annotation

GitHub Actions / ci

var-naming: struct field IpFilter should be IPFilter (revive)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revive complaining about this one too, should be IPFilter

LogLevelIn *string `json:"log_level_in,omitempty"`
LogLevelOut *string `json:"log_level_out,omitempty"`
MacFilter *IntOrBool `json:"macfilter,omitempty"`
Ndp *IntOrBool `json:"ndp,omitempty"`
PolicyIn *string `json:"policy_in,omitempty"`
PolicyOut *string `json:"policy_out,omitempty"`
Radv *IntOrBool `json:"radv,omitempty"`
}

type Snapshot struct {
Expand Down
11 changes: 8 additions & 3 deletions virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,14 @@ func (v *VirtualMachine) AgentSetUserPassword(ctx context.Context, password stri
return v.client.Post(ctx, fmt.Sprintf("/nodes/%s/qemu/%d/agent/set-user-password", v.Node, v.VMID), map[string]string{"password": password, "username": username}, nil)
}

func (v *VirtualMachine) FirewallOptionGet(ctx context.Context) (firewallOption *FirewallVirtualMachineOption, err error) {
err = v.client.Get(ctx, fmt.Sprintf("/nodes/%s/qemu/%d/firewall/options", v.Node, v.VMID), firewallOption)
return
func (v *VirtualMachine) FirewallOptionGet(ctx context.Context) (*FirewallVirtualMachineOption, error) {
firewallOption := FirewallVirtualMachineOption{}

if err := v.client.Get(ctx, fmt.Sprintf("/nodes/%s/qemu/%d/firewall/options", v.Node, v.VMID), &firewallOption); err != nil {
return nil, err
}

return &firewallOption, nil
}

func (v *VirtualMachine) FirewallOptionSet(ctx context.Context, firewallOption *FirewallVirtualMachineOption) error {
Expand Down
Loading