Return the created env on create req

This commit is contained in:
2024-04-30 10:20:46 +02:00
parent 99ee44b431
commit c49e885255
4 changed files with 20 additions and 40 deletions

View File

@ -11,8 +11,8 @@ type Providers interface {
RawProviderName() string
GetServerType(string) (string, error)
GetServerLocation(string) (string, error)
RawServerType(string) (string, error)
RawServerLocation(string) (string, error)
RawServerType(string) string
RawServerLocation(string) string
}
func GetProvider(provider string) (Providers, error) {

View File

@ -21,38 +21,37 @@ func (h *Hetzner) RawProviderName() string {
}
// RawServerLocation implements Providers.
func (h *Hetzner) RawServerLocation(location string) (string, error) {
func (h *Hetzner) RawServerLocation(location string) string {
switch location {
case "ash":
return proto.Location_LOCATION_HETZNER_ASHBURN.String(), nil
return proto.Location_LOCATION_HETZNER_ASHBURN.String()
case "hil":
return proto.Location_LOCATION_HETZNER_HILLSBORO.String(), nil
return proto.Location_LOCATION_HETZNER_HILLSBORO.String()
case "fsn1":
return proto.Location_LOCATION_HETZNER_FALKENSTEIN.String(), nil
return proto.Location_LOCATION_HETZNER_FALKENSTEIN.String()
case "nbg1":
return proto.Location_LOCATION_HETZNER_NUREMBERG.String(), nil
return proto.Location_LOCATION_HETZNER_NUREMBERG.String()
case "hel1":
return proto.Location_LOCATION_HETZNER_HELSINKI.String(), nil
return proto.Location_LOCATION_HETZNER_HELSINKI.String()
default:
return "", fmt.Errorf("unknown location: %s", location)
return proto.Location_LOCATION_UNSPECIFIED.String()
}
}
// RawServerType implements Providers.
func (h *Hetzner) RawServerType(kind string) (string, error) {
func (h *Hetzner) RawServerType(kind string) string {
switch kind {
case "cpx21":
return proto.ServerType_SERVER_TYPE_STARTER.String(), nil
return proto.ServerType_SERVER_TYPE_STARTER.String()
case "cpx31":
return proto.ServerType_SERVER_TYPE_REGULAR.String(), nil
return proto.ServerType_SERVER_TYPE_REGULAR.String()
case "cpx41":
return proto.ServerType_SERVER_TYPE_PLUS.String(), nil
return proto.ServerType_SERVER_TYPE_PLUS.String()
case "cpx51":
return proto.ServerType_SERVER_TYPE_PRO.String(), nil
return proto.ServerType_SERVER_TYPE_PRO.String()
default:
err := fmt.Errorf("unknown server type: %s", kind)
return "", err
return proto.ServerType_SERVER_TYPE_UNSPECIFIED.String()
}
}