2023-02-13 14:13:32 +00:00
|
|
|
import 'package:selfprivacy/logic/api_maps/generic_result.dart';
|
2023-02-22 17:58:59 +00:00
|
|
|
import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart';
|
2023-04-24 15:09:23 +00:00
|
|
|
import 'package:selfprivacy/logic/models/disk_size.dart';
|
|
|
|
import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
2023-02-22 17:58:59 +00:00
|
|
|
import 'package:selfprivacy/logic/models/launch_installation_data.dart';
|
2023-02-28 03:00:52 +00:00
|
|
|
import 'package:selfprivacy/logic/models/metrics.dart';
|
2023-04-24 15:09:23 +00:00
|
|
|
import 'package:selfprivacy/logic/models/price.dart';
|
2023-04-24 16:45:16 +00:00
|
|
|
import 'package:selfprivacy/logic/models/server_basic_info.dart';
|
|
|
|
import 'package:selfprivacy/logic/models/server_metadata.dart';
|
2023-02-07 16:51:15 +00:00
|
|
|
import 'package:selfprivacy/logic/models/server_provider_location.dart';
|
|
|
|
import 'package:selfprivacy/logic/models/server_type.dart';
|
2023-01-30 15:44:52 +00:00
|
|
|
|
2023-02-13 14:13:32 +00:00
|
|
|
export 'package:selfprivacy/logic/api_maps/generic_result.dart';
|
2023-03-23 00:28:16 +00:00
|
|
|
export 'package:selfprivacy/logic/models/launch_installation_data.dart';
|
2023-02-13 14:13:32 +00:00
|
|
|
|
2023-01-30 15:44:52 +00:00
|
|
|
abstract class ServerProvider {
|
2023-04-24 16:45:16 +00:00
|
|
|
Future<GenericResult<List<ServerBasicInfo>>> getServers();
|
2023-02-21 09:11:04 +00:00
|
|
|
Future<GenericResult<bool>> trySetServerLocation(final String location);
|
2023-02-13 14:13:32 +00:00
|
|
|
Future<GenericResult<bool>> tryInitApiByToken(final String token);
|
|
|
|
Future<GenericResult<List<ServerProviderLocation>>> getAvailableLocations();
|
|
|
|
Future<GenericResult<List<ServerType>>> getServerTypes({
|
2023-02-07 16:51:15 +00:00
|
|
|
required final ServerProviderLocation location,
|
|
|
|
});
|
2023-04-24 16:45:16 +00:00
|
|
|
|
|
|
|
Future<GenericResult<CallbackDialogueBranching?>> deleteServer(
|
|
|
|
final String hostname,
|
|
|
|
);
|
2023-02-22 17:58:59 +00:00
|
|
|
Future<GenericResult<CallbackDialogueBranching?>> launchInstallation(
|
|
|
|
final LaunchInstallationData installationData,
|
|
|
|
);
|
|
|
|
Future<GenericResult<DateTime?>> powerOn(final int serverId);
|
|
|
|
Future<GenericResult<DateTime?>> restart(final int serverId);
|
2023-02-28 03:00:52 +00:00
|
|
|
Future<GenericResult<ServerMetrics?>> getMetrics(
|
|
|
|
final int serverId,
|
|
|
|
final DateTime start,
|
|
|
|
final DateTime end,
|
|
|
|
);
|
2023-02-13 14:13:32 +00:00
|
|
|
|
2023-04-24 15:09:23 +00:00
|
|
|
Future<Price?> getPricePerGb();
|
|
|
|
Future<GenericResult<List<ServerVolume>>> getVolumes({final String? status});
|
|
|
|
Future<GenericResult<ServerVolume?>> createVolume();
|
|
|
|
Future<GenericResult<void>> deleteVolume(final ServerVolume volume);
|
|
|
|
Future<GenericResult<bool>> resizeVolume(
|
|
|
|
final ServerVolume volume,
|
|
|
|
final DiskSize size,
|
|
|
|
);
|
|
|
|
Future<GenericResult<bool>> attachVolume(
|
|
|
|
final ServerVolume volume,
|
|
|
|
final int serverId,
|
|
|
|
);
|
|
|
|
Future<GenericResult<bool>> detachVolume(final ServerVolume volume);
|
2023-04-24 16:45:16 +00:00
|
|
|
Future<GenericResult<List<ServerMetadataEntity>>> getMetadata(
|
|
|
|
final int serverId,
|
|
|
|
);
|
2023-02-13 14:13:32 +00:00
|
|
|
GenericResult<bool> get success => GenericResult(success: true, data: true);
|
2023-01-30 15:44:52 +00:00
|
|
|
}
|