Implement Provider Api Abstractions #99
No reviewers
Labels
No Label
Blocked
Bug
Contributions welcome
Did not do
Errata
Feature request
Fixed
How To
Invalid
Needs design
No resolution
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Providers
Digital Ocean
Providers
Hetzner
Refactor
Severity
High
Severity
Low
Severity
Medium
Source
Community
Source
Core Team
Source
Stakeholders
Translations
Under investigation
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: SelfPrivacy/selfprivacy.org.app#99
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "naiji-dev"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
@ -0,0 +10,4 @@
import 'package:selfprivacy/logic/models/hive/user.dart';
import 'package:selfprivacy/utils/password_generator.dart';
class HetznerApi extends VolumeProviderApi {
extends ServerProviderApi with VolumeProviderApi
@ -0,0 +65,4 @@
}
@override
RegExp getApiTokenValidation() =>
Должно быть статичным?
static функции не могут быть полиморфными, к сожалению
@ -0,0 +247,4 @@
@override
Future<ServerHostingDetails?> createServer({
required final String dnsApiToken,
Причина, по которой передаём:
https://go-acme.github.io/lego/dns/
Нам нужно знать и провайдера, и токен.
@ -0,0 +258,4 @@
return details;
}
details = await createServerByVolume(
createServerWithVolume
@ -0,0 +5,4 @@
import 'package:selfprivacy/logic/models/json/provider_server_info.dart';
abstract class ProviderApi extends ApiMap {
ProviderApi({this.hasLogger = false, this.isWithToken = true});
ServerProviderApi
@ -0,0 +1,17 @@
import 'package:selfprivacy/logic/api_maps/rest_maps/providers/provider.dart';
import 'package:selfprivacy/logic/models/hive/server_details.dart';
abstract class VolumeProviderApi extends ProviderApi {
Сделать это mixin
@ -2,13 +2,13 @@ import 'dart:async';
import 'package:cubit_form/cubit_form.dart';
Rename the file
@ -52,0 +53,4 @@
RegExp getProviderApiTokenValidation() {
if (repository.providerApiFactory == null) {
print(
"validateProviderApiToken: Factory for API provider doesn't exist!",
Not print, that's an Exception.
@ -52,0 +64,4 @@
Future<bool> isProviderApiTokenValid(final String providerToken) async {
if (repository.providerApiFactory == null) {
print(
"validateProviderApiToken: Factory for API provider doesn't exist!",
Should be exception
@ -123,2 +150,4 @@
);
if (dnsRecordsCreated) {
repository.onCreationSuccess(serverDetails, state.serverDomain!);
Discard this.
@ -328,3 +359,3 @@
return false;
}
await HetznerApi().createReverseDns(
Return this!
@ -135,0 +144,4 @@
ServerHostingDetails? details;
if (providerApiFactory == null) {
print("startServer: Factory for API provider doesn't exist!");
Exception
@ -211,2 +229,2 @@
final HetznerApi hetznerApi = HetznerApi();
late ServerVolume dataBase;
if (providerApiFactory == null) {
print("createServer: Factory for API provider doesn't exist!");
Exception
@ -281,3 +292,3 @@
}
Future<void> createDnsRecords(
Future<void> onCreationSuccess(
Discard this function.
@ -288,2 +314,4 @@
final CloudflareApi cloudflareApi = CloudflareApi();
if (providerApiFactory == null) {
print("createServer: Factory for API provider doesn't exist!");
Exception
@ -601,0 +627,4 @@
Future<List<ServerBasicInfo>> getServersOnProviderAccount() async {
if (providerApiFactory == null) {
print(
'getServersOnProviderAccount: '
Exception
@ -689,2 +725,3 @@
Future<void> deleteServer(final ServerDomain serverDomain) async {
final HetznerApi hetznerApi = HetznerApi();
if (providerApiFactory == null) {
print("deleteServer: Factory for API provider doesn't exist!");
Exception
@ -0,0 +1,115 @@
import 'package:json_annotation/json_annotation.dart';
Revert rename, this is a Hetzner mapping for API.