forked from linode/linodego
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstance_firewalls.go
More file actions
20 lines (16 loc) · 885 Bytes
/
instance_firewalls.go
File metadata and controls
20 lines (16 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package linodego
import (
"context"
)
// ListInstanceFirewalls returns a paginated list of Cloud Firewalls for linodeID
func (c *Client) ListInstanceFirewalls(ctx context.Context, linodeID int, opts *ListOptions) ([]Firewall, error) {
return getPaginatedResults[Firewall](ctx, c, formatAPIPath("linode/instances/%d/firewalls", linodeID), opts)
}
type InstanceFirewallUpdateOptions struct {
FirewallIDs []int `json:"firewall_ids"`
}
// UpdateInstanceFirewalls updates the Cloud Firewalls for a Linode instance
// Followup this call with `ListInstanceFirewalls` to verify the changes if necessary.
func (c *Client) UpdateInstanceFirewalls(ctx context.Context, linodeID int, opts InstanceFirewallUpdateOptions) ([]Firewall, error) {
return putPaginatedResults[Firewall, InstanceFirewallUpdateOptions](ctx, c, formatAPIPath("linode/instances/%d/firewalls", linodeID), nil, opts)
}