availability

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusAvailable   = "available"
	StatusUnavailable = "unavailable"
)

Variables

View Source
var (
	// DatacentersKnown is the non exhaustive list of known datacenters.
	// https://www.ovhcloud.com/en/about-us/global-infrastructure/expansion-regions-az/
	DatacentersKnown = DatacentersInfo{
		{Code: "bhs", Name: "Beauharnois (Canada)"},
		{Code: "fra", Name: "Frankfurt (Germany)"},
		{Code: "gra", Name: "Gravelines (France)"},
		{Code: "hil", Name: "Hillsboro (United States)"},
		{Code: "lon", Name: "London (United Kingdom)"},
		{Code: "par", Name: "Paris (France)"},
		{Code: "rbx", Name: "Roubaix (France)"},
		{Code: "sbg", Name: "Strasbourg (France)"},
		{Code: "sgp", Name: "Singapore"},
		{Code: "syd", Name: "Sydney (Australia)"},
		{Code: "vin", Name: "Vint Hill (United States)"},
		{Code: "waw", Name: "Warsaw (Poland)"},
		{Code: "ynm", Name: "Mumbai (India)"},
		{Code: "yyz", Name: "Toronto (Canada)"},
	}
)

Functions

func GetDatacentersKnownCodes

func GetDatacentersKnownCodes() []string

GetDatacentersKnownCodes returns the list of known datacenter codes.

Types

type Availabilities

type Availabilities []Availability

func (Availabilities) GetPlanCodeAvailableDatacenters

func (a Availabilities) GetPlanCodeAvailableDatacenters(planCode string) Datacenters

GetPlanCodeAvailableDatacenters returns the list of available datacenters for a given plan code.

type Availability

type Availability struct {
	FQN         string       `json:"fqn"`
	Memory      string       `json:"memory"`
	PlanCode    string       `json:"planCode"`
	Server      string       `json:"server"`
	Storage     string       `json:"storage"`
	Datacenters []Datacenter `json:"datacenters"`
}

Availability represents the availability of a server. Definition can be found at https://eu.api.ovh.com/console/?section=%2Fdedicated%2Fserver&branch=v1#get-/dedicated/server/datacenter/availabilities

func (Availability) GetAvailableDatacenters

func (a Availability) GetAvailableDatacenters() Datacenters

GetAvailableDatacenters returns the list of available datacenters.

type Datacenter

type Datacenter struct {
	Datacenter   string `json:"datacenter"`
	Availability string `json:"availability"`
}

func (Datacenter) GetFullName

func (d Datacenter) GetFullName() *string

GetFullName returns the full name of the datacenter.

func (Datacenter) IsAvailable

func (d Datacenter) IsAvailable() bool

IsAvailable returns true if the datacenter is available.

type DatacenterInfo

type DatacenterInfo struct {
	Code string
	Name string
}

func GetDatacenterInfoByCode

func GetDatacenterInfoByCode(code string) *DatacenterInfo

GetDatacenterInfoByCode returns the datacenter info. for a given datacenter code.

type Datacenters

type Datacenters []Datacenter

func (Datacenters) Codes

func (d Datacenters) Codes() []string

Codes returns a list of datacenter codes.

func (Datacenters) Status

func (d Datacenters) Status() string

Status returns the status of the datacenters. Either StatusAvailable or StatusUnavailable.

func (Datacenters) ToFullNamesOrCodes

func (d Datacenters) ToFullNamesOrCodes() []string

ToFullNamesOrCodes returns the list of datacenter names. Either the full name if found or the code.

type DatacentersInfo

type DatacentersInfo []DatacenterInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL