softplayer-web/lib/helpers/providers/hetzner.dart

54 lines
1.8 KiB
Dart
Raw Normal View History

2024-05-02 17:09:44 +00:00
import 'package:softplayer_dart_proto/environments/environments_v1.pbgrpc.dart';
import 'package:softplayer_web/helpers/providers/common.dart' as helper;
class Hetzner implements helper.Provider {
2024-04-30 15:31:53 +00:00
@override
2024-05-02 17:09:44 +00:00
String getProviderName() {
return "Hetzner";
}
@override
String rawProviderName() {
return Provider.PROVIDER_HETZNER.toString();
}
2024-04-30 15:31:53 +00:00
2024-05-02 17:09:44 +00:00
@override
String getServerLocation(String serverType) {
if (serverType == Location.LOCATION_HETZNER_ASHBURN.toString()) {
return "Ashburn, USA";
} else if (serverType == Location.LOCATION_HETZNER_FALKENSTEIN.toString()) {
return "Falkenstein, Germany";
} else if (serverType == Location.LOCATION_HETZNER_HELSINKI.toString()) {
return "Helsinki, Finland";
} else if (serverType == Location.LOCATION_HETZNER_HILLSBORO.toString()) {
return "Hillsboro, USA";
} else if (serverType == Location.LOCATION_HETZNER_NUREMBERG.toString()) {
return "Nuremberg, Germany";
} else {
throw 'Unknown server type';
2024-04-30 15:31:53 +00:00
}
}
@override
2024-05-02 17:09:44 +00:00
String rawServerLocation(String serverLocation) {
if (serverLocation == "Ashburn, USA") {
return Location.LOCATION_HETZNER_ASHBURN.toString();
} else if (serverLocation == "Falkenstein, Germany") {
return Location.LOCATION_HETZNER_FALKENSTEIN.toString();
} else if (serverLocation == "Helsinki, Finland") {
return Location.LOCATION_HETZNER_HELSINKI.toString();
} else if (serverLocation == "Hillsboro, USA") {
return Location.LOCATION_HETZNER_HILLSBORO.toString();
} else if (serverLocation == "Nuremberg, Germany") {
return Location.LOCATION_HETZNER_NUREMBERG.toString();
} else {
throw 'Unknown server type';
}
}
2024-05-02 21:56:55 +00:00
2024-05-02 17:09:44 +00:00
@override
String defaultLocation() {
return Location.LOCATION_HETZNER_NUREMBERG.toString();
2024-04-30 15:31:53 +00:00
}
}