-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfirewall_rules_default.go
48 lines (39 loc) · 1.91 KB
/
firewall_rules_default.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Code generated by go generate; DO NOT EDIT.
package brightbox
import "context"
import "path"
const (
// firewallruleAPIPath returns the relative URL path to the FirewallRule endpoint
firewallruleAPIPath = "firewall_rules"
)
// FirewallRules returns the collection view for FirewallRule
func (c *Client) FirewallRules(ctx context.Context) ([]FirewallRule, error) {
return apiGetCollection[[]FirewallRule](ctx, c, firewallruleAPIPath)
}
// FirewallRule retrieves a detailed view of one resource
func (c *Client) FirewallRule(ctx context.Context, identifier string) (*FirewallRule, error) {
return apiGet[FirewallRule](ctx, c, path.Join(firewallruleAPIPath, identifier))
}
// CreateFirewallRule creates a new resource from the supplied option map.
//
// It takes an instance of FirewallRuleOptions. Not all attributes can be
// specified at create time (such as ID, which is allocated for you).
func (c *Client) CreateFirewallRule(ctx context.Context, newFirewallRule FirewallRuleOptions) (*FirewallRule, error) {
return apiPost[FirewallRule](ctx, c, firewallruleAPIPath, newFirewallRule)
}
// UpdateFirewallRule updates an existing resources's attributes. Not all
// attributes can be changed (such as ID).
//
// It takes an instance of FirewallRuleOptions. Specify the resource you
// want to update using the ID field.
func (c *Client) UpdateFirewallRule(ctx context.Context, updateFirewallRule FirewallRuleOptions) (*FirewallRule, error) {
return apiPut[FirewallRule](ctx, c, path.Join(firewallruleAPIPath, updateFirewallRule.ID), updateFirewallRule)
}
// DestroyFirewallRule destroys an existing resource.
func (c *Client) DestroyFirewallRule(ctx context.Context, identifier string) (*FirewallRule, error) {
return apiDelete[FirewallRule](ctx, c, path.Join(firewallruleAPIPath, identifier))
}
// CreatedAt implements the CreateDated interface for FirewallRule
func (s FirewallRule) CreatedAtUnix() int64 {
return s.CreatedAt.Unix()
}