Skip to content

Commit 21f321a

Browse files
author
serverpod_cloud
committed
fix: aeee35253f4d56f7f22f12d443b117a3c865d5c4
1 parent b3258d7 commit 21f321a

3 files changed

Lines changed: 329 additions & 152 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ import 'package:ground_control_client/src/protocol/domains/products/models/subsc
6868
as _i29;
6969
import 'package:ground_control_client/src/protocol/domains/products/models/plan_info.dart'
7070
as _i30;
71-
import 'package:ground_control_client/src/protocol/features/projects/models/project_config.dart'
71+
import 'package:ground_control_client/src/protocol/features/projects/models/project_profile_update.dart'
7272
as _i31;
73-
import 'package:ground_control_client/src/protocol/domains/projects/models/role.dart'
73+
import 'package:ground_control_client/src/protocol/features/projects/models/project_config.dart'
7474
as _i32;
75-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
75+
import 'package:ground_control_client/src/protocol/domains/projects/models/role.dart'
7676
as _i33;
77-
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
77+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
7878
as _i34;
79-
import 'protocol.dart' as _i35;
79+
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
80+
as _i35;
81+
import 'protocol.dart' as _i36;
8082

8183
/// {@category Endpoint}
8284
class EndpointAdminMigration extends _i1.EndpointRef {
@@ -1098,33 +1100,30 @@ class EndpointProjects extends _i1.EndpointRef {
10981100
'cloudProjectId': cloudProjectId,
10991101
});
11001102

1101-
/// Updates the project type for a project by selecting a new project product.
1103+
/// Applies a project profile change together with compute scaling and optional
1104+
/// database sizing in one call.
1105+
///
1106+
/// Intended to replace separate calls to [updateProjectProfile], compute
1107+
/// `updateCompute`, and database `updateDatabaseSize` when all are updated
1108+
/// together.
1109+
///
1110+
/// [cloudProjectId] identifies the project for authorization and matches the
1111+
/// capsule identifier used for compute and database operations.
11021112
///
1103-
/// - **Authorization**: requires project authorization for `cloudProjectId`
1104-
/// with at least `Scopes.p0All`.
1105-
/// - **Atomicity / no partial state**: all validations are performed before
1106-
/// any state is persisted or any infra reconciliation is triggered.
1107-
/// - **Product change**: the project's `projectProductId` is set to
1108-
/// `projectProductId`.
1109-
/// - **Default resources**: the project compute and database settings resolve
1110-
/// to the defaults for the selected product (no per-project overrides are
1111-
/// applied by this operation).
1112-
/// - **Infra reconciliation**: if the project has active infrastructure,
1113-
/// reconciliation flows are triggered so running resources converge to the
1114-
/// selected product's defaults.
1113+
/// When [resources.databaseSize] is null, database sizing is not changed.
11151114
///
11161115
/// This endpoint currently only defines the API surface.
11171116
_i2.Future<void> updateProjectProfile({
11181117
required String cloudProjectId,
1119-
required String projectProductId,
1118+
required _i31.ProjectProfileUpdate resources,
11201119
}) => caller.callServerEndpoint<void>('projects', 'updateProjectProfile', {
11211120
'cloudProjectId': cloudProjectId,
1122-
'projectProductId': projectProductId,
1121+
'resources': resources,
11231122
});
11241123

1125-
_i2.Future<_i31.ProjectConfig> fetchProjectConfig({
1124+
_i2.Future<_i32.ProjectConfig> fetchProjectConfig({
11261125
required String cloudProjectId,
1127-
}) => caller.callServerEndpoint<_i31.ProjectConfig>(
1126+
}) => caller.callServerEndpoint<_i32.ProjectConfig>(
11281127
'projects',
11291128
'fetchProjectConfig',
11301129
{'cloudProjectId': cloudProjectId},
@@ -1175,9 +1174,9 @@ class EndpointRoles extends _i1.EndpointRef {
11751174
String get name => 'roles';
11761175

11771176
/// Fetches the user roles for a project.
1178-
_i2.Future<List<_i32.Role>> fetchRolesForProject({
1177+
_i2.Future<List<_i33.Role>> fetchRolesForProject({
11791178
required String cloudProjectId,
1180-
}) => caller.callServerEndpoint<List<_i32.Role>>(
1179+
}) => caller.callServerEndpoint<List<_i33.Role>>(
11811180
'roles',
11821181
'fetchRolesForProject',
11831182
{'cloudProjectId': cloudProjectId},
@@ -1264,10 +1263,10 @@ class EndpointStatus extends _i1.EndpointRef {
12641263
);
12651264

12661265
/// Gets the specified deploy attempt status of the a capsule.
1267-
_i2.Future<List<_i33.DeployAttemptStage>> getDeployAttemptStatus({
1266+
_i2.Future<List<_i34.DeployAttemptStage>> getDeployAttemptStatus({
12681267
required String cloudCapsuleId,
12691268
required String attemptId,
1270-
}) => caller.callServerEndpoint<List<_i33.DeployAttemptStage>>(
1269+
}) => caller.callServerEndpoint<List<_i34.DeployAttemptStage>>(
12711270
'status',
12721271
'getDeployAttemptStatus',
12731272
{'cloudCapsuleId': cloudCapsuleId, 'attemptId': attemptId},
@@ -1308,11 +1307,11 @@ class EndpointUsers extends _i1.EndpointRef {
13081307

13091308
class Modules {
13101309
Modules(Client client) {
1311-
serverpod_auth_idp = _i34.Caller(client);
1310+
serverpod_auth_idp = _i35.Caller(client);
13121311
serverpod_auth_core = _i10.Caller(client);
13131312
}
13141313

1315-
late final _i34.Caller serverpod_auth_idp;
1314+
late final _i35.Caller serverpod_auth_idp;
13161315

13171316
late final _i10.Caller serverpod_auth_core;
13181317
}
@@ -1332,7 +1331,7 @@ class Client extends _i1.ServerpodClientShared {
13321331
bool? disconnectStreamsOnLostInternetConnection,
13331332
}) : super(
13341333
host,
1335-
_i35.Protocol(),
1334+
_i36.Protocol(),
13361335
securityContext: securityContext,
13371336
streamingConnectionTimeout: streamingConnectionTimeout,
13381337
connectionTimeout: connectionTimeout,
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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/capsules/models/compute_size_option.dart' as _i2;
15+
import '../../../features/databases/models/database_size.dart' as _i3;
16+
17+
/// Payload for updating a project profile together with compute scaling and
18+
/// If null is provided for a field, the field is not updated.
19+
abstract class ProjectProfileUpdate implements _i1.SerializableModel {
20+
ProjectProfileUpdate._({
21+
this.projectProductId,
22+
this.size,
23+
this.minInstances,
24+
this.maxInstances,
25+
this.databaseSize,
26+
this.minCu,
27+
this.maxCu,
28+
});
29+
30+
factory ProjectProfileUpdate({
31+
String? projectProductId,
32+
_i2.ComputeSizeOption? size,
33+
int? minInstances,
34+
int? maxInstances,
35+
_i3.DatabaseSizeOption? databaseSize,
36+
double? minCu,
37+
double? maxCu,
38+
}) = _ProjectProfileUpdateImpl;
39+
40+
factory ProjectProfileUpdate.fromJson(
41+
Map<String, dynamic> jsonSerialization,
42+
) {
43+
return ProjectProfileUpdate(
44+
projectProductId: jsonSerialization['projectProductId'] as String?,
45+
size: jsonSerialization['size'] == null
46+
? null
47+
: _i2.ComputeSizeOption.fromJson(
48+
(jsonSerialization['size'] as String),
49+
),
50+
minInstances: jsonSerialization['minInstances'] as int?,
51+
maxInstances: jsonSerialization['maxInstances'] as int?,
52+
databaseSize: jsonSerialization['databaseSize'] == null
53+
? null
54+
: _i3.DatabaseSizeOption.fromJson(
55+
(jsonSerialization['databaseSize'] as String),
56+
),
57+
minCu: (jsonSerialization['minCu'] as num?)?.toDouble(),
58+
maxCu: (jsonSerialization['maxCu'] as num?)?.toDouble(),
59+
);
60+
}
61+
62+
/// The procured project product id to assign to the project.
63+
String? projectProductId;
64+
65+
/// Podlet (compute) size for the capsule.
66+
_i2.ComputeSizeOption? size;
67+
68+
/// Minimum number of podlet instances.
69+
int? minInstances;
70+
71+
/// Maximum number of podlet instances.
72+
int? maxInstances;
73+
74+
/// When null, database sizing is not changed.
75+
_i3.DatabaseSizeOption? databaseSize;
76+
77+
/// Database compute minimum, when updating database sizing.
78+
double? minCu;
79+
80+
/// Database compute maximum, when updating database sizing.
81+
double? maxCu;
82+
83+
/// Returns a shallow copy of this [ProjectProfileUpdate]
84+
/// with some or all fields replaced by the given arguments.
85+
@_i1.useResult
86+
ProjectProfileUpdate copyWith({
87+
String? projectProductId,
88+
_i2.ComputeSizeOption? size,
89+
int? minInstances,
90+
int? maxInstances,
91+
_i3.DatabaseSizeOption? databaseSize,
92+
double? minCu,
93+
double? maxCu,
94+
});
95+
@override
96+
Map<String, dynamic> toJson() {
97+
return {
98+
'__className__': 'ProjectProfileUpdate',
99+
if (projectProductId != null) 'projectProductId': projectProductId,
100+
if (size != null) 'size': size?.toJson(),
101+
if (minInstances != null) 'minInstances': minInstances,
102+
if (maxInstances != null) 'maxInstances': maxInstances,
103+
if (databaseSize != null) 'databaseSize': databaseSize?.toJson(),
104+
if (minCu != null) 'minCu': minCu,
105+
if (maxCu != null) 'maxCu': maxCu,
106+
};
107+
}
108+
109+
@override
110+
String toString() {
111+
return _i1.SerializationManager.encode(this);
112+
}
113+
}
114+
115+
class _Undefined {}
116+
117+
class _ProjectProfileUpdateImpl extends ProjectProfileUpdate {
118+
_ProjectProfileUpdateImpl({
119+
String? projectProductId,
120+
_i2.ComputeSizeOption? size,
121+
int? minInstances,
122+
int? maxInstances,
123+
_i3.DatabaseSizeOption? databaseSize,
124+
double? minCu,
125+
double? maxCu,
126+
}) : super._(
127+
projectProductId: projectProductId,
128+
size: size,
129+
minInstances: minInstances,
130+
maxInstances: maxInstances,
131+
databaseSize: databaseSize,
132+
minCu: minCu,
133+
maxCu: maxCu,
134+
);
135+
136+
/// Returns a shallow copy of this [ProjectProfileUpdate]
137+
/// with some or all fields replaced by the given arguments.
138+
@_i1.useResult
139+
@override
140+
ProjectProfileUpdate copyWith({
141+
Object? projectProductId = _Undefined,
142+
Object? size = _Undefined,
143+
Object? minInstances = _Undefined,
144+
Object? maxInstances = _Undefined,
145+
Object? databaseSize = _Undefined,
146+
Object? minCu = _Undefined,
147+
Object? maxCu = _Undefined,
148+
}) {
149+
return ProjectProfileUpdate(
150+
projectProductId: projectProductId is String?
151+
? projectProductId
152+
: this.projectProductId,
153+
size: size is _i2.ComputeSizeOption? ? size : this.size,
154+
minInstances: minInstances is int? ? minInstances : this.minInstances,
155+
maxInstances: maxInstances is int? ? maxInstances : this.maxInstances,
156+
databaseSize: databaseSize is _i3.DatabaseSizeOption?
157+
? databaseSize
158+
: this.databaseSize,
159+
minCu: minCu is double? ? minCu : this.minCu,
160+
maxCu: maxCu is double? ? maxCu : this.maxCu,
161+
);
162+
}
163+
}

0 commit comments

Comments
 (0)