-
Notifications
You must be signed in to change notification settings - Fork 82
/
account_availability.go
38 lines (30 loc) · 1.13 KB
/
account_availability.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
package linodego
import (
"context"
)
// AccountAvailability returns the resources availability in a region to an account.
type AccountAvailability struct {
// region id
Region string `json:"region"`
// the unavailable resources in a region to the customer
Unavailable []string `json:"unavailable"`
// the available resources in a region to the customer
Available []string `json:"available"`
}
// ListAccountAvailabilities lists all regions and the resource availabilities to the account.
func (c *Client) ListAccountAvailabilities(ctx context.Context, opts *ListOptions) ([]AccountAvailability, error) {
response, err := getPaginatedResults[AccountAvailability](ctx, c, "account/availability", opts)
if err != nil {
return nil, err
}
return response, nil
}
// GetAccountAvailability gets the resources availability in a region to the customer.
func (c *Client) GetAccountAvailability(ctx context.Context, regionID string) (*AccountAvailability, error) {
b := formatAPIPath("account/availability/%s", regionID)
response, err := doGETRequest[AccountAvailability](ctx, c, b)
if err != nil {
return nil, err
}
return response, nil
}