softplayer-backend/internal/providers/common.go

26 lines
579 B
Go

package providers
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)
}
}