1 package linodego
2 3 import (
4 "context"
5 )
6 7 type FirewallTemplate struct {
8 Slug string `json:"slug"`
9 Rules FirewallRuleSet `json:"rules"`
10 }
11 12 // GetFirewallTemplate gets a FirewallTemplate given a slug.
13 // NOTE: This feature may not currently be available to all users.
14 func (c *Client) GetFirewallTemplate(ctx context.Context, slug string) (*FirewallTemplate, error) {
15 e := formatAPIPath("networking/firewalls/templates/%s", slug)
16 return doGETRequest[FirewallTemplate](ctx, c, e)
17 }
18 19 // ListFirewallTemplates gets all available firewall templates for the account.
20 // NOTE: This feature may not currently be available to all users.
21 func (c *Client) ListFirewallTemplates(ctx context.Context, opts *ListOptions) ([]FirewallTemplate, error) {
22 return getPaginatedResults[FirewallTemplate](ctx, c, "networking/firewalls/templates", opts)
23 }
24