forked from linode/linodego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_settings.go
60 lines (45 loc) · 2.34 KB
/
account_settings.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
49
50
51
52
53
54
55
56
57
58
59
60
package linodego
import (
"context"
)
// AccountSettings are the account wide flags or plans that effect new resources
type AccountSettings struct {
// The default backups enrollment status for all new Linodes for all users on the account. When enabled, backups are mandatory per instance.
BackupsEnabled bool `json:"backups_enabled"`
// Wether or not Linode Managed service is enabled for the account.
Managed bool `json:"managed"`
// Wether or not the Network Helper is enabled for all new Linode Instance Configs on the account.
NetworkHelper bool `json:"network_helper"`
// A plan name like "longview-3"..."longview-100", or a nil value for to cancel any existing subscription plan.
LongviewSubscription *string `json:"longview_subscription"`
// A string like "disabled", "suspended", or "active" describing the status of this account’s Object Storage service enrollment.
ObjectStorage *string `json:"object_storage"`
}
// AccountSettingsUpdateOptions are the updateable account wide flags or plans that effect new resources.
type AccountSettingsUpdateOptions struct {
// The default backups enrollment status for all new Linodes for all users on the account. When enabled, backups are mandatory per instance.
BackupsEnabled *bool `json:"backups_enabled,omitempty"`
// A plan name like "longview-3"..."longview-100", or a nil value for to cancel any existing subscription plan.
// Deprecated: Use PUT /longview/plan instead to update the LongviewSubscription
LongviewSubscription *string `json:"longview_subscription,omitempty"`
// The default network helper setting for all new Linodes and Linode Configs for all users on the account.
NetworkHelper *bool `json:"network_helper,omitempty"`
}
// GetAccountSettings gets the account wide flags or plans that effect new resources
func (c *Client) GetAccountSettings(ctx context.Context) (*AccountSettings, error) {
e := "account/settings"
response, err := doGETRequest[AccountSettings](ctx, c, e)
if err != nil {
return nil, err
}
return response, nil
}
// UpdateAccountSettings updates the settings associated with the account
func (c *Client) UpdateAccountSettings(ctx context.Context, opts AccountSettingsUpdateOptions) (*AccountSettings, error) {
e := "account/settings"
response, err := doPUTRequest[AccountSettings](ctx, c, e, opts)
if err != nil {
return nil, err
}
return response, nil
}