Skip to content

Commit 201f4c6

Browse files
author
serverpod_cloud
committed
fix: cef3a0b6d4a332ec90f39841fbb6df83eeceb62d
1 parent e29d79c commit 201f4c6

4 files changed

Lines changed: 48 additions & 58 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ class EndpointAdminMigration extends _i1.EndpointRef {
9191
'migrateProcuredDatabaseProducts',
9292
{},
9393
);
94-
95-
_i2.Future<Map<String, dynamic>> backfillDatabaseResources() =>
96-
caller.callServerEndpoint<Map<String, dynamic>>(
97-
'adminMigration',
98-
'backfillDatabaseResources',
99-
{},
100-
);
10194
}
10295

10396
/// Endpoint for global administrator to handle procurement for users.

ground_control_client/lib/src/protocol/features/databases/models/database_info.dart

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'package:serverpod_client/serverpod_client.dart' as _i1;
1515
abstract class DatabaseInfo implements _i1.SerializableModel {
1616
DatabaseInfo._({
1717
required this.cloudCapsuleId,
18-
this.size,
18+
required this.size,
1919
this.minCu,
2020
this.maxCu,
2121
required this.memoryMb,
@@ -25,7 +25,7 @@ abstract class DatabaseInfo implements _i1.SerializableModel {
2525

2626
factory DatabaseInfo({
2727
required String cloudCapsuleId,
28-
String? size,
28+
required String size,
2929
double? minCu,
3030
double? maxCu,
3131
required int memoryMb,
@@ -36,7 +36,7 @@ abstract class DatabaseInfo implements _i1.SerializableModel {
3636
factory DatabaseInfo.fromJson(Map<String, dynamic> jsonSerialization) {
3737
return DatabaseInfo(
3838
cloudCapsuleId: jsonSerialization['cloudCapsuleId'] as String,
39-
size: jsonSerialization['size'] as String?,
39+
size: jsonSerialization['size'] as String,
4040
minCu: (jsonSerialization['minCu'] as num?)?.toDouble(),
4141
maxCu: (jsonSerialization['maxCu'] as num?)?.toDouble(),
4242
memoryMb: jsonSerialization['memoryMb'] as int,
@@ -48,22 +48,25 @@ abstract class DatabaseInfo implements _i1.SerializableModel {
4848
/// The cloud capsule ID.
4949
String cloudCapsuleId;
5050

51-
/// The size of the database, small, medium, large, large+.
52-
String? size;
51+
/// The size of the database: small, medium, large, largePlus, or unknown.
52+
/// A value of unknown means the size could not be determined.
53+
String size;
5354

5455
/// The minimum number of CPUs that the database can be scaled to.
56+
/// Null if the database size does not support scaling.
5557
double? minCu;
5658

5759
/// The maximum number of CPUs that the database can be scaled to.
60+
/// Null if the database size does not support scaling.
5861
double? maxCu;
5962

6063
/// The memory of the database in MB.
6164
int memoryMb;
6265

63-
/// The storage limit of the database in GB.
66+
/// The storage limit of the database in GB. Null means no limit.
6467
int? storageLimitGB;
6568

66-
/// The compute hours limit of the database in hours.
69+
/// The compute hours limit of the database in hours. Null means no limit.
6770
int? computeHoursLimit;
6871

6972
/// Returns a shallow copy of this [DatabaseInfo]
@@ -83,7 +86,7 @@ abstract class DatabaseInfo implements _i1.SerializableModel {
8386
return {
8487
'__className__': 'DatabaseInfo',
8588
'cloudCapsuleId': cloudCapsuleId,
86-
if (size != null) 'size': size,
89+
'size': size,
8790
if (minCu != null) 'minCu': minCu,
8891
if (maxCu != null) 'maxCu': maxCu,
8992
'memoryMb': memoryMb,
@@ -103,7 +106,7 @@ class _Undefined {}
103106
class _DatabaseInfoImpl extends DatabaseInfo {
104107
_DatabaseInfoImpl({
105108
required String cloudCapsuleId,
106-
String? size,
109+
required String size,
107110
double? minCu,
108111
double? maxCu,
109112
required int memoryMb,
@@ -125,7 +128,7 @@ class _DatabaseInfoImpl extends DatabaseInfo {
125128
@override
126129
DatabaseInfo copyWith({
127130
String? cloudCapsuleId,
128-
Object? size = _Undefined,
131+
String? size,
129132
Object? minCu = _Undefined,
130133
Object? maxCu = _Undefined,
131134
int? memoryMb,
@@ -134,7 +137,7 @@ class _DatabaseInfoImpl extends DatabaseInfo {
134137
}) {
135138
return DatabaseInfo(
136139
cloudCapsuleId: cloudCapsuleId ?? this.cloudCapsuleId,
137-
size: size is String? ? size : this.size,
140+
size: size ?? this.size,
138141
minCu: minCu is double? ? minCu : this.minCu,
139142
maxCu: maxCu is double? ? maxCu : this.maxCu,
140143
memoryMb: memoryMb ?? this.memoryMb,

ground_control_client/lib/src/protocol/features/databases/models/database_resource.dart

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ abstract class DatabaseResource implements _i1.SerializableModel {
2424
required this.providerId,
2525
required this.provider,
2626
required this.connection,
27-
this.scaling,
28-
this.quota,
27+
required this.scaling,
28+
required this.quota,
2929
});
3030

3131
factory DatabaseResource({
@@ -34,8 +34,8 @@ abstract class DatabaseResource implements _i1.SerializableModel {
3434
required String providerId,
3535
required _i2.DatabaseProvider provider,
3636
required _i3.DatabaseConnection connection,
37-
_i4.DatabaseScaling? scaling,
38-
_i5.DatabaseQuota? quota,
37+
required _i4.DatabaseScaling scaling,
38+
required _i5.DatabaseQuota quota,
3939
}) = _DatabaseResourceImpl;
4040

4141
factory DatabaseResource.fromJson(Map<String, dynamic> jsonSerialization) {
@@ -49,16 +49,12 @@ abstract class DatabaseResource implements _i1.SerializableModel {
4949
connection: _i6.Protocol().deserialize<_i3.DatabaseConnection>(
5050
jsonSerialization['connection'],
5151
),
52-
scaling: jsonSerialization['scaling'] == null
53-
? null
54-
: _i6.Protocol().deserialize<_i4.DatabaseScaling>(
55-
jsonSerialization['scaling'],
56-
),
57-
quota: jsonSerialization['quota'] == null
58-
? null
59-
: _i6.Protocol().deserialize<_i5.DatabaseQuota>(
60-
jsonSerialization['quota'],
61-
),
52+
scaling: _i6.Protocol().deserialize<_i4.DatabaseScaling>(
53+
jsonSerialization['scaling'],
54+
),
55+
quota: _i6.Protocol().deserialize<_i5.DatabaseQuota>(
56+
jsonSerialization['quota'],
57+
),
6258
);
6359
}
6460

@@ -75,9 +71,9 @@ abstract class DatabaseResource implements _i1.SerializableModel {
7571

7672
_i3.DatabaseConnection connection;
7773

78-
_i4.DatabaseScaling? scaling;
74+
_i4.DatabaseScaling scaling;
7975

80-
_i5.DatabaseQuota? quota;
76+
_i5.DatabaseQuota quota;
8177

8278
/// Returns a shallow copy of this [DatabaseResource]
8379
/// with some or all fields replaced by the given arguments.
@@ -100,8 +96,8 @@ abstract class DatabaseResource implements _i1.SerializableModel {
10096
'providerId': providerId,
10197
'provider': provider.toJson(),
10298
'connection': connection.toJson(),
103-
if (scaling != null) 'scaling': scaling?.toJson(),
104-
if (quota != null) 'quota': quota?.toJson(),
99+
'scaling': scaling.toJson(),
100+
'quota': quota.toJson(),
105101
};
106102
}
107103

@@ -120,8 +116,8 @@ class _DatabaseResourceImpl extends DatabaseResource {
120116
required String providerId,
121117
required _i2.DatabaseProvider provider,
122118
required _i3.DatabaseConnection connection,
123-
_i4.DatabaseScaling? scaling,
124-
_i5.DatabaseQuota? quota,
119+
required _i4.DatabaseScaling scaling,
120+
required _i5.DatabaseQuota quota,
125121
}) : super._(
126122
id: id,
127123
cloudCapsuleId: cloudCapsuleId,
@@ -142,19 +138,17 @@ class _DatabaseResourceImpl extends DatabaseResource {
142138
String? providerId,
143139
_i2.DatabaseProvider? provider,
144140
_i3.DatabaseConnection? connection,
145-
Object? scaling = _Undefined,
146-
Object? quota = _Undefined,
141+
_i4.DatabaseScaling? scaling,
142+
_i5.DatabaseQuota? quota,
147143
}) {
148144
return DatabaseResource(
149145
id: id is int? ? id : this.id,
150146
cloudCapsuleId: cloudCapsuleId ?? this.cloudCapsuleId,
151147
providerId: providerId ?? this.providerId,
152148
provider: provider ?? this.provider,
153149
connection: connection ?? this.connection.copyWith(),
154-
scaling: scaling is _i4.DatabaseScaling?
155-
? scaling
156-
: this.scaling?.copyWith(),
157-
quota: quota is _i5.DatabaseQuota? ? quota : this.quota?.copyWith(),
150+
scaling: scaling ?? this.scaling.copyWith(),
151+
quota: quota ?? this.quota.copyWith(),
158152
);
159153
}
160154
}

ground_control_client/lib/src/protocol/features/databases/models/database_scaling.dart

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,33 @@ import 'package:serverpod_client/serverpod_client.dart' as _i1;
1414
import '../../../features/databases/models/database_size.dart' as _i2;
1515

1616
abstract class DatabaseScaling implements _i1.SerializableModel {
17-
DatabaseScaling._({required this.minCu, required this.maxCu, this.size});
17+
DatabaseScaling._({
18+
required this.minCu,
19+
required this.maxCu,
20+
required this.size,
21+
});
1822

1923
factory DatabaseScaling({
2024
required double minCu,
2125
required double maxCu,
22-
_i2.DatabaseSizeOption? size,
26+
required _i2.DatabaseSizeOption size,
2327
}) = _DatabaseScalingImpl;
2428

2529
factory DatabaseScaling.fromJson(Map<String, dynamic> jsonSerialization) {
2630
return DatabaseScaling(
2731
minCu: (jsonSerialization['minCu'] as num).toDouble(),
2832
maxCu: (jsonSerialization['maxCu'] as num).toDouble(),
29-
size: jsonSerialization['size'] == null
30-
? null
31-
: _i2.DatabaseSizeOption.fromJson(
32-
(jsonSerialization['size'] as String),
33-
),
33+
size: _i2.DatabaseSizeOption.fromJson(
34+
(jsonSerialization['size'] as String),
35+
),
3436
);
3537
}
3638

3739
double minCu;
3840

3941
double maxCu;
4042

41-
_i2.DatabaseSizeOption? size;
43+
_i2.DatabaseSizeOption size;
4244

4345
/// Returns a shallow copy of this [DatabaseScaling]
4446
/// with some or all fields replaced by the given arguments.
@@ -54,7 +56,7 @@ abstract class DatabaseScaling implements _i1.SerializableModel {
5456
'__className__': 'DatabaseScaling',
5557
'minCu': minCu,
5658
'maxCu': maxCu,
57-
if (size != null) 'size': size?.toJson(),
59+
'size': size.toJson(),
5860
};
5961
}
6062

@@ -64,13 +66,11 @@ abstract class DatabaseScaling implements _i1.SerializableModel {
6466
}
6567
}
6668

67-
class _Undefined {}
68-
6969
class _DatabaseScalingImpl extends DatabaseScaling {
7070
_DatabaseScalingImpl({
7171
required double minCu,
7272
required double maxCu,
73-
_i2.DatabaseSizeOption? size,
73+
required _i2.DatabaseSizeOption size,
7474
}) : super._(minCu: minCu, maxCu: maxCu, size: size);
7575

7676
/// Returns a shallow copy of this [DatabaseScaling]
@@ -80,12 +80,12 @@ class _DatabaseScalingImpl extends DatabaseScaling {
8080
DatabaseScaling copyWith({
8181
double? minCu,
8282
double? maxCu,
83-
Object? size = _Undefined,
83+
_i2.DatabaseSizeOption? size,
8484
}) {
8585
return DatabaseScaling(
8686
minCu: minCu ?? this.minCu,
8787
maxCu: maxCu ?? this.maxCu,
88-
size: size is _i2.DatabaseSizeOption? ? size : this.size,
88+
size: size ?? this.size,
8989
);
9090
}
9191
}

0 commit comments

Comments
 (0)