Refactor providers data

This commit is contained in:
2024-04-29 20:03:37 +02:00
parent a8325fd202
commit 87e204ed46
8 changed files with 123 additions and 31 deletions

View File

@ -0,0 +1,21 @@
package kubernetes
import (
"fmt"
proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
)
type Kubernetes interface {
GetKubernetesName() string
RawKubernetesName() string
}
func GetKubernetes(k8s proto.Kubernetes) (Kubernetes, error) {
switch k8s {
case proto.Kubernetes_KUBERNETES_K3S:
return &K3s{}, nil
default:
return nil, fmt.Errorf("unknown provider: %s", k8s.String())
}
}

View File

@ -0,0 +1,15 @@
package kubernetes
import (
proto "git.badhouseplants.net/softplayer/softplayer-go-proto/pkg/environments"
)
type K3s struct{}
func (k *K3s) GetKubernetesName() string {
return "k3s"
}
func (k *K3s) RawKubernetesName() string {
return proto.Kubernetes_KUBERNETES_K3S.String()
}