26 lines
575 B
Go
26 lines
575 B
Go
package infra
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
|
|
)
|
|
|
|
type Providers interface {
|
|
GetProviderName() string
|
|
RawProviderName() string
|
|
GetServerType(string) (string, error)
|
|
GetServerLocation(string) (string, error)
|
|
RawServerType(string) string
|
|
RawServerLocation(string) string
|
|
}
|
|
|
|
func GetProvider(provider string) (Providers, error) {
|
|
switch provider {
|
|
case proto.Provider_PROVIDER_HETZNER.String(), "hetzner":
|
|
return &Hetzner{}, nil
|
|
default:
|
|
return nil, fmt.Errorf("unknown provider: %s", provider)
|
|
}
|
|
}
|