Skip to content

Commit 44968bc

Browse files
author
serverpod_cloud
committed
feat: 71c5f3d50584c927b0af2b9b72f2f60db14d7d1d
1 parent a553f3e commit 44968bc

8 files changed

Lines changed: 1266 additions & 496 deletions

File tree

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
2+
/* To generate run: "serverpod generate" */
3+
4+
// ignore_for_file: implementation_imports
5+
// ignore_for_file: library_private_types_in_public_api
6+
// ignore_for_file: non_constant_identifier_names
7+
// ignore_for_file: public_member_api_docs
8+
// ignore_for_file: type_literal_in_constant_pattern
9+
// ignore_for_file: use_super_parameters
10+
// ignore_for_file: invalid_use_of_internal_member
11+
12+
// ignore_for_file: no_leading_underscores_for_library_prefixes
13+
import 'package:serverpod_client/serverpod_client.dart' as _i1;
14+
import 'package:ground_control_client/src/protocol/protocol.dart' as _i2;
15+
16+
/// Definition of a compute product including defaults and constraints.
17+
abstract class ComputeProductInfo implements _i1.SerializableModel {
18+
ComputeProductInfo._({
19+
required this.productId,
20+
required this.name,
21+
required this.description,
22+
required this.defaultInstanceType,
23+
required this.defaultMinReplicas,
24+
required this.defaultMaxReplicas,
25+
required this.allowedInstanceTypes,
26+
required this.allowedReplicasMin,
27+
required this.allowedReplicasMax,
28+
});
29+
30+
factory ComputeProductInfo({
31+
required String productId,
32+
required String name,
33+
required String description,
34+
required String defaultInstanceType,
35+
required int defaultMinReplicas,
36+
required int defaultMaxReplicas,
37+
required List<String> allowedInstanceTypes,
38+
required int allowedReplicasMin,
39+
required int allowedReplicasMax,
40+
}) = _ComputeProductInfoImpl;
41+
42+
factory ComputeProductInfo.fromJson(Map<String, dynamic> jsonSerialization) {
43+
return ComputeProductInfo(
44+
productId: jsonSerialization['productId'] as String,
45+
name: jsonSerialization['name'] as String,
46+
description: jsonSerialization['description'] as String,
47+
defaultInstanceType: jsonSerialization['defaultInstanceType'] as String,
48+
defaultMinReplicas: jsonSerialization['defaultMinReplicas'] as int,
49+
defaultMaxReplicas: jsonSerialization['defaultMaxReplicas'] as int,
50+
allowedInstanceTypes: _i2.Protocol().deserialize<List<String>>(
51+
jsonSerialization['allowedInstanceTypes'],
52+
),
53+
allowedReplicasMin: jsonSerialization['allowedReplicasMin'] as int,
54+
allowedReplicasMax: jsonSerialization['allowedReplicasMax'] as int,
55+
);
56+
}
57+
58+
/// The id of the product.
59+
String productId;
60+
61+
/// The user-friendly name of the product.
62+
String name;
63+
64+
/// The user-friendly description of the product.
65+
String description;
66+
67+
/// The default instance type name.
68+
String defaultInstanceType;
69+
70+
/// The default minimum number of replicas.
71+
int defaultMinReplicas;
72+
73+
/// The default maximum number of replicas.
74+
int defaultMaxReplicas;
75+
76+
/// The allowed instance type names.
77+
List<String> allowedInstanceTypes;
78+
79+
/// The minimum number of replicas allowed.
80+
int allowedReplicasMin;
81+
82+
/// The maximum number of replicas allowed.
83+
int allowedReplicasMax;
84+
85+
/// Returns a shallow copy of this [ComputeProductInfo]
86+
/// with some or all fields replaced by the given arguments.
87+
@_i1.useResult
88+
ComputeProductInfo copyWith({
89+
String? productId,
90+
String? name,
91+
String? description,
92+
String? defaultInstanceType,
93+
int? defaultMinReplicas,
94+
int? defaultMaxReplicas,
95+
List<String>? allowedInstanceTypes,
96+
int? allowedReplicasMin,
97+
int? allowedReplicasMax,
98+
});
99+
@override
100+
Map<String, dynamic> toJson() {
101+
return {
102+
'__className__': 'ComputeProductInfo',
103+
'productId': productId,
104+
'name': name,
105+
'description': description,
106+
'defaultInstanceType': defaultInstanceType,
107+
'defaultMinReplicas': defaultMinReplicas,
108+
'defaultMaxReplicas': defaultMaxReplicas,
109+
'allowedInstanceTypes': allowedInstanceTypes.toJson(),
110+
'allowedReplicasMin': allowedReplicasMin,
111+
'allowedReplicasMax': allowedReplicasMax,
112+
};
113+
}
114+
115+
@override
116+
String toString() {
117+
return _i1.SerializationManager.encode(this);
118+
}
119+
}
120+
121+
class _ComputeProductInfoImpl extends ComputeProductInfo {
122+
_ComputeProductInfoImpl({
123+
required String productId,
124+
required String name,
125+
required String description,
126+
required String defaultInstanceType,
127+
required int defaultMinReplicas,
128+
required int defaultMaxReplicas,
129+
required List<String> allowedInstanceTypes,
130+
required int allowedReplicasMin,
131+
required int allowedReplicasMax,
132+
}) : super._(
133+
productId: productId,
134+
name: name,
135+
description: description,
136+
defaultInstanceType: defaultInstanceType,
137+
defaultMinReplicas: defaultMinReplicas,
138+
defaultMaxReplicas: defaultMaxReplicas,
139+
allowedInstanceTypes: allowedInstanceTypes,
140+
allowedReplicasMin: allowedReplicasMin,
141+
allowedReplicasMax: allowedReplicasMax,
142+
);
143+
144+
/// Returns a shallow copy of this [ComputeProductInfo]
145+
/// with some or all fields replaced by the given arguments.
146+
@_i1.useResult
147+
@override
148+
ComputeProductInfo copyWith({
149+
String? productId,
150+
String? name,
151+
String? description,
152+
String? defaultInstanceType,
153+
int? defaultMinReplicas,
154+
int? defaultMaxReplicas,
155+
List<String>? allowedInstanceTypes,
156+
int? allowedReplicasMin,
157+
int? allowedReplicasMax,
158+
}) {
159+
return ComputeProductInfo(
160+
productId: productId ?? this.productId,
161+
name: name ?? this.name,
162+
description: description ?? this.description,
163+
defaultInstanceType: defaultInstanceType ?? this.defaultInstanceType,
164+
defaultMinReplicas: defaultMinReplicas ?? this.defaultMinReplicas,
165+
defaultMaxReplicas: defaultMaxReplicas ?? this.defaultMaxReplicas,
166+
allowedInstanceTypes:
167+
allowedInstanceTypes ??
168+
this.allowedInstanceTypes.map((e0) => e0).toList(),
169+
allowedReplicasMin: allowedReplicasMin ?? this.allowedReplicasMin,
170+
allowedReplicasMax: allowedReplicasMax ?? this.allowedReplicasMax,
171+
);
172+
}
173+
}
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
2+
/* To generate run: "serverpod generate" */
3+
4+
// ignore_for_file: implementation_imports
5+
// ignore_for_file: library_private_types_in_public_api
6+
// ignore_for_file: non_constant_identifier_names
7+
// ignore_for_file: public_member_api_docs
8+
// ignore_for_file: type_literal_in_constant_pattern
9+
// ignore_for_file: use_super_parameters
10+
// ignore_for_file: invalid_use_of_internal_member
11+
12+
// ignore_for_file: no_leading_underscores_for_library_prefixes
13+
import 'package:serverpod_client/serverpod_client.dart' as _i1;
14+
import '../../../domains/products/models/database_size_info.dart' as _i2;
15+
import 'package:ground_control_client/src/protocol/protocol.dart' as _i3;
16+
17+
/// Definition of a database product including defaults and constraints.
18+
abstract class DatabaseProductInfo implements _i1.SerializableModel {
19+
DatabaseProductInfo._({
20+
required this.productId,
21+
required this.name,
22+
required this.description,
23+
required this.defaultSize,
24+
required this.allowedSizes,
25+
this.cuHoursPerMonthLimit,
26+
this.storageLimitGB,
27+
});
28+
29+
factory DatabaseProductInfo({
30+
required String productId,
31+
required String name,
32+
required String description,
33+
required _i2.DatabaseSizeInfo defaultSize,
34+
required List<_i2.DatabaseSizeInfo> allowedSizes,
35+
int? cuHoursPerMonthLimit,
36+
int? storageLimitGB,
37+
}) = _DatabaseProductInfoImpl;
38+
39+
factory DatabaseProductInfo.fromJson(Map<String, dynamic> jsonSerialization) {
40+
return DatabaseProductInfo(
41+
productId: jsonSerialization['productId'] as String,
42+
name: jsonSerialization['name'] as String,
43+
description: jsonSerialization['description'] as String,
44+
defaultSize: _i3.Protocol().deserialize<_i2.DatabaseSizeInfo>(
45+
jsonSerialization['defaultSize'],
46+
),
47+
allowedSizes: _i3.Protocol().deserialize<List<_i2.DatabaseSizeInfo>>(
48+
jsonSerialization['allowedSizes'],
49+
),
50+
cuHoursPerMonthLimit: jsonSerialization['cuHoursPerMonthLimit'] as int?,
51+
storageLimitGB: jsonSerialization['storageLimitGB'] as int?,
52+
);
53+
}
54+
55+
/// The id of the product.
56+
String productId;
57+
58+
/// The user-friendly name of the product.
59+
String name;
60+
61+
/// The user-friendly description of the product.
62+
String description;
63+
64+
/// The default database size configuration.
65+
_i2.DatabaseSizeInfo defaultSize;
66+
67+
/// The allowed database sizes with their configurations.
68+
List<_i2.DatabaseSizeInfo> allowedSizes;
69+
70+
/// The limit on compute unit hours per month, if any.
71+
int? cuHoursPerMonthLimit;
72+
73+
/// The storage limit in GB, if any.
74+
int? storageLimitGB;
75+
76+
/// Returns a shallow copy of this [DatabaseProductInfo]
77+
/// with some or all fields replaced by the given arguments.
78+
@_i1.useResult
79+
DatabaseProductInfo copyWith({
80+
String? productId,
81+
String? name,
82+
String? description,
83+
_i2.DatabaseSizeInfo? defaultSize,
84+
List<_i2.DatabaseSizeInfo>? allowedSizes,
85+
int? cuHoursPerMonthLimit,
86+
int? storageLimitGB,
87+
});
88+
@override
89+
Map<String, dynamic> toJson() {
90+
return {
91+
'__className__': 'DatabaseProductInfo',
92+
'productId': productId,
93+
'name': name,
94+
'description': description,
95+
'defaultSize': defaultSize.toJson(),
96+
'allowedSizes': allowedSizes.toJson(valueToJson: (v) => v.toJson()),
97+
if (cuHoursPerMonthLimit != null)
98+
'cuHoursPerMonthLimit': cuHoursPerMonthLimit,
99+
if (storageLimitGB != null) 'storageLimitGB': storageLimitGB,
100+
};
101+
}
102+
103+
@override
104+
String toString() {
105+
return _i1.SerializationManager.encode(this);
106+
}
107+
}
108+
109+
class _Undefined {}
110+
111+
class _DatabaseProductInfoImpl extends DatabaseProductInfo {
112+
_DatabaseProductInfoImpl({
113+
required String productId,
114+
required String name,
115+
required String description,
116+
required _i2.DatabaseSizeInfo defaultSize,
117+
required List<_i2.DatabaseSizeInfo> allowedSizes,
118+
int? cuHoursPerMonthLimit,
119+
int? storageLimitGB,
120+
}) : super._(
121+
productId: productId,
122+
name: name,
123+
description: description,
124+
defaultSize: defaultSize,
125+
allowedSizes: allowedSizes,
126+
cuHoursPerMonthLimit: cuHoursPerMonthLimit,
127+
storageLimitGB: storageLimitGB,
128+
);
129+
130+
/// Returns a shallow copy of this [DatabaseProductInfo]
131+
/// with some or all fields replaced by the given arguments.
132+
@_i1.useResult
133+
@override
134+
DatabaseProductInfo copyWith({
135+
String? productId,
136+
String? name,
137+
String? description,
138+
_i2.DatabaseSizeInfo? defaultSize,
139+
List<_i2.DatabaseSizeInfo>? allowedSizes,
140+
Object? cuHoursPerMonthLimit = _Undefined,
141+
Object? storageLimitGB = _Undefined,
142+
}) {
143+
return DatabaseProductInfo(
144+
productId: productId ?? this.productId,
145+
name: name ?? this.name,
146+
description: description ?? this.description,
147+
defaultSize: defaultSize ?? this.defaultSize.copyWith(),
148+
allowedSizes:
149+
allowedSizes ?? this.allowedSizes.map((e0) => e0.copyWith()).toList(),
150+
cuHoursPerMonthLimit: cuHoursPerMonthLimit is int?
151+
? cuHoursPerMonthLimit
152+
: this.cuHoursPerMonthLimit,
153+
storageLimitGB: storageLimitGB is int?
154+
? storageLimitGB
155+
: this.storageLimitGB,
156+
);
157+
}
158+
}

0 commit comments

Comments
 (0)