2024-04-29 16:28:13 +00:00
|
|
|
package providers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Providers interface {
|
2024-04-29 18:03:37 +00:00
|
|
|
GetProviderName() string
|
|
|
|
RawProviderName() string
|
|
|
|
GetServerType(string) (string, error)
|
2024-04-29 16:28:13 +00:00
|
|
|
GetServerLocation(string) (string, error)
|
2024-04-30 08:20:46 +00:00
|
|
|
RawServerType(string) string
|
|
|
|
RawServerLocation(string) string
|
2024-04-29 16:28:13 +00:00
|
|
|
}
|
|
|
|
|
2024-04-30 07:47:00 +00:00
|
|
|
func GetProvider(provider string) (Providers, error) {
|
2024-04-29 16:28:13 +00:00
|
|
|
switch provider {
|
2024-04-30 07:47:00 +00:00
|
|
|
case proto.Provider_PROVIDER_HETZNER.String(), "hetzner":
|
2024-04-29 16:28:13 +00:00
|
|
|
return &Hetzner{}, nil
|
|
|
|
default:
|
2024-04-30 07:47:00 +00:00
|
|
|
return nil, fmt.Errorf("unknown provider: %s", provider)
|
2024-04-29 16:28:13 +00:00
|
|
|
}
|
|
|
|
}
|