Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose region capabilities enum #507

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 42 additions & 7 deletions regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,54 @@ import (
"github.com/go-resty/resty/v2"
)

// This is an enumeration of Capabilities Linode offers that can be referenced
// through the user-facing parts of the application.
// Defined as strings rather than a custom type to avoid breaking change.
// Can be changed in the potential v2 version.
const (
Linodes string = "Linodes"
NodeBalancers string = "NodeBalancers"
BlockStorage string = "Block Storage"
ObjectStorage string = "Object Storage"
ObjectStorageRegions string = "Object Storage Access Key Regions"
LKE string = "Kubernetes"
LkeHaControlPlanes string = "LKE HA Control Planes"
CloudFirewall string = "Cloud Firewall"
GPU string = "GPU Linodes"
Vlans string = "Vlans"
VPCs string = "VPCs"
VPCsExtra string = "VPCs Extra"
MachineImages string = "Machine Images"
BareMetal string = "Bare Metal"
DBAAS string = "Managed Databases"
BlockStorageMigrations string = "Block Storage Migrations"
Metadata string = "Metadata"
PremiumPlans string = "Premium Plans"
EdgePlans string = "Edge Plans"
LKEControlPlaneACL string = "LKE Network Access Control List (IP ACL)"
ACLB string = "Akamai Cloud Load Balancer"
SupportTicketSeverity string = "Support Ticket Severity"
Backups string = "Backups"
PlacementGroup string = "Placement Group"
DiskEncryption string = "Disk Encryption"
)

// Region-related endpoints have a custom expiry time as the
// `status` field may update for database outages.
var cacheExpiryTime = time.Minute

// Region represents a linode region object
type Region struct {
ID string `json:"id"`
Country string `json:"country"`
Capabilities []string `json:"capabilities"`
Status string `json:"status"`
Resolvers RegionResolvers `json:"resolvers"`
Label string `json:"label"`
SiteType string `json:"site_type"`
ID string `json:"id"`
Country string `json:"country"`

// A List of enums from the above constants
Capabilities []string `json:"capabilities"`

Status string `json:"status"`
Resolvers RegionResolvers `json:"resolvers"`
Label string `json:"label"`
SiteType string `json:"site_type"`
}

// RegionResolvers contains the DNS resolvers of a region
Expand Down