Return the created env on create req
This commit is contained in:
@ -171,6 +171,7 @@ func (env *Environemnt) ListEnvs(ctx context.Context) ([]*Environemnt, error) {
|
||||
i.Token = env.Token
|
||||
i.UserID = env.UserID
|
||||
i.Data = data
|
||||
i.Controller = env.Controller
|
||||
if err := i.Get(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user