File: account_availability.go

package info (click to toggle)
golang-github-linode-linodego 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,112 kB
  • sloc: makefile: 96; sh: 52; python: 24
file content (28 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download
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
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) {
	return getPaginatedResults[AccountAvailability](ctx, c, "account/availability", opts)
}

// 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)
	return doGETRequest[AccountAvailability](ctx, c, b)
}