Skip to content

Commit 10c5d70

Browse files
author
serverpod_cloud
committed
feat: 3ff4b5dbe6c92aa518afce1b29d542219e428a00
1 parent 928e0ac commit 10c5d70

3 files changed

Lines changed: 340 additions & 224 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,25 @@ import 'package:ground_control_client/src/protocol/features/custom_domains/model
4646
as _i18;
4747
import 'package:ground_control_client/src/protocol/domains/environment_variables/models/variable.dart'
4848
as _i19;
49-
import 'package:ground_control_client/src/protocol/domains/logs/models/log_record.dart'
49+
import 'package:ground_control_client/src/protocol/features/insights/models/insights_connection_detail.dart'
5050
as _i20;
51-
import 'package:ground_control_client/src/protocol/domains/products/models/subscription_info.dart'
51+
import 'package:ground_control_client/src/protocol/domains/logs/models/log_record.dart'
5252
as _i21;
53-
import 'package:ground_control_client/src/protocol/domains/products/models/plan_info.dart'
53+
import 'package:ground_control_client/src/protocol/domains/products/models/subscription_info.dart'
5454
as _i22;
55-
import 'package:ground_control_client/src/protocol/features/databases/models/database_connection.dart'
55+
import 'package:ground_control_client/src/protocol/domains/products/models/plan_info.dart'
5656
as _i23;
57-
import 'package:ground_control_client/src/protocol/features/projects/models/project_config.dart'
57+
import 'package:ground_control_client/src/protocol/features/databases/models/database_connection.dart'
5858
as _i24;
59-
import 'package:ground_control_client/src/protocol/features/projects/models/role.dart'
59+
import 'package:ground_control_client/src/protocol/features/projects/models/project_config.dart'
6060
as _i25;
61-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
61+
import 'package:ground_control_client/src/protocol/features/projects/models/role.dart'
6262
as _i26;
63-
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
63+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
6464
as _i27;
65-
import 'protocol.dart' as _i28;
65+
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
66+
as _i28;
67+
import 'protocol.dart' as _i29;
6668

6769
/// Endpoint for global administrator to handle procurement for users.
6870
/// {@category Endpoint}
@@ -588,6 +590,28 @@ class EndpointEnvironmentVariables extends _i1.EndpointRef {
588590
);
589591
}
590592

593+
/// {@category Endpoint}
594+
class EndpointInsights extends _i1.EndpointRef {
595+
EndpointInsights(_i1.EndpointCaller caller) : super(caller);
596+
597+
@override
598+
String get name => 'insights';
599+
600+
/// Gets the connection details for the insights service.
601+
///
602+
/// Requires project authorization with all scopes.
603+
///
604+
/// Throws [UnauthorizedException] if the user is not authorized.
605+
/// Throws [NotFoundException] if insights service secret is not found.
606+
_i2.Future<_i20.InsightsConnectionDetail> getConnectionDetails({
607+
required String cloudProjectId,
608+
}) => caller.callServerEndpoint<_i20.InsightsConnectionDetail>(
609+
'insights',
610+
'getConnectionDetails',
611+
{'cloudProjectId': cloudProjectId},
612+
);
613+
}
614+
591615
/// Endpoint for accessing cloud logs.
592616
/// {@category Endpoint}
593617
class EndpointLogs extends _i1.EndpointRef {
@@ -597,14 +621,14 @@ class EndpointLogs extends _i1.EndpointRef {
597621
String get name => 'logs';
598622

599623
/// Fetches log records from the specified project.
600-
_i2.Stream<_i20.LogRecord> fetchRecords({
624+
_i2.Stream<_i21.LogRecord> fetchRecords({
601625
String? cloudProjectId,
602626
String? cloudCapsuleId,
603627
DateTime? beforeTime,
604628
DateTime? afterTime,
605629
int? limit,
606630
}) => caller
607-
.callStreamingServerEndpoint<_i2.Stream<_i20.LogRecord>, _i20.LogRecord>(
631+
.callStreamingServerEndpoint<_i2.Stream<_i21.LogRecord>, _i21.LogRecord>(
608632
'logs',
609633
'fetchRecords',
610634
{
@@ -620,12 +644,12 @@ class EndpointLogs extends _i1.EndpointRef {
620644
/// Tails log records from the specified project.
621645
/// Continues until the client unsubscribes, [limit] is reached,
622646
/// or the internal max limit is reached.
623-
_i2.Stream<_i20.LogRecord> tailRecords({
647+
_i2.Stream<_i21.LogRecord> tailRecords({
624648
String? cloudProjectId,
625649
String? cloudCapsuleId,
626650
int? limit,
627651
}) => caller
628-
.callStreamingServerEndpoint<_i2.Stream<_i20.LogRecord>, _i20.LogRecord>(
652+
.callStreamingServerEndpoint<_i2.Stream<_i21.LogRecord>, _i21.LogRecord>(
629653
'logs',
630654
'tailRecords',
631655
{
@@ -637,13 +661,13 @@ class EndpointLogs extends _i1.EndpointRef {
637661
);
638662

639663
/// Fetches the build log records for the specified deploy attempt.
640-
_i2.Stream<_i20.LogRecord> fetchBuildLog({
664+
_i2.Stream<_i21.LogRecord> fetchBuildLog({
641665
String? cloudProjectId,
642666
String? cloudCapsuleId,
643667
required String attemptId,
644668
int? limit,
645669
}) => caller
646-
.callStreamingServerEndpoint<_i2.Stream<_i20.LogRecord>, _i20.LogRecord>(
670+
.callStreamingServerEndpoint<_i2.Stream<_i21.LogRecord>, _i21.LogRecord>(
647671
'logs',
648672
'fetchBuildLog',
649673
{
@@ -683,8 +707,8 @@ class EndpointPlans extends _i1.EndpointRef {
683707
_i2.Future<List<String>> listProcuredPlanNames() => caller
684708
.callServerEndpoint<List<String>>('plans', 'listProcuredPlanNames', {});
685709

686-
_i2.Future<_i21.SubscriptionInfo> getSubscriptionInfo() =>
687-
caller.callServerEndpoint<_i21.SubscriptionInfo>(
710+
_i2.Future<_i22.SubscriptionInfo> getSubscriptionInfo() =>
711+
caller.callServerEndpoint<_i22.SubscriptionInfo>(
688712
'plans',
689713
'getSubscriptionInfo',
690714
{},
@@ -702,8 +726,8 @@ class EndpointPlans extends _i1.EndpointRef {
702726
'planName': planName,
703727
});
704728

705-
_i2.Future<_i22.PlanInfo> getPlanInfo({required String planProductName}) =>
706-
caller.callServerEndpoint<_i22.PlanInfo>('plans', 'getPlanInfo', {
729+
_i2.Future<_i23.PlanInfo> getPlanInfo({required String planProductName}) =>
730+
caller.callServerEndpoint<_i23.PlanInfo>('plans', 'getPlanInfo', {
707731
'planProductName': planProductName,
708732
});
709733

@@ -720,9 +744,9 @@ class EndpointDatabase extends _i1.EndpointRef {
720744
@override
721745
String get name => 'database';
722746

723-
_i2.Future<_i23.DatabaseConnection> getConnectionDetails({
747+
_i2.Future<_i24.DatabaseConnection> getConnectionDetails({
724748
required String cloudCapsuleId,
725-
}) => caller.callServerEndpoint<_i23.DatabaseConnection>(
749+
}) => caller.callServerEndpoint<_i24.DatabaseConnection>(
726750
'database',
727751
'getConnectionDetails',
728752
{'cloudCapsuleId': cloudCapsuleId},
@@ -831,9 +855,9 @@ class EndpointProjects extends _i1.EndpointRef {
831855
'cloudProjectId': cloudProjectId,
832856
});
833857

834-
_i2.Future<_i24.ProjectConfig> fetchProjectConfig({
858+
_i2.Future<_i25.ProjectConfig> fetchProjectConfig({
835859
required String cloudProjectId,
836-
}) => caller.callServerEndpoint<_i24.ProjectConfig>(
860+
}) => caller.callServerEndpoint<_i25.ProjectConfig>(
837861
'projects',
838862
'fetchProjectConfig',
839863
{'cloudProjectId': cloudProjectId},
@@ -914,9 +938,9 @@ class EndpointRoles extends _i1.EndpointRef {
914938
String get name => 'roles';
915939

916940
/// Fetches the user roles for a project.
917-
_i2.Future<List<_i25.Role>> fetchRolesForProject({
941+
_i2.Future<List<_i26.Role>> fetchRolesForProject({
918942
required String cloudProjectId,
919-
}) => caller.callServerEndpoint<List<_i25.Role>>(
943+
}) => caller.callServerEndpoint<List<_i26.Role>>(
920944
'roles',
921945
'fetchRolesForProject',
922946
{'cloudProjectId': cloudProjectId},
@@ -1003,10 +1027,10 @@ class EndpointStatus extends _i1.EndpointRef {
10031027
);
10041028

10051029
/// Gets the specified deploy attempt status of the a capsule.
1006-
_i2.Future<List<_i26.DeployAttemptStage>> getDeployAttemptStatus({
1030+
_i2.Future<List<_i27.DeployAttemptStage>> getDeployAttemptStatus({
10071031
required String cloudCapsuleId,
10081032
required String attemptId,
1009-
}) => caller.callServerEndpoint<List<_i26.DeployAttemptStage>>(
1033+
}) => caller.callServerEndpoint<List<_i27.DeployAttemptStage>>(
10101034
'status',
10111035
'getDeployAttemptStatus',
10121036
{'cloudCapsuleId': cloudCapsuleId, 'attemptId': attemptId},
@@ -1062,11 +1086,11 @@ class EndpointUsers extends _i1.EndpointRef {
10621086

10631087
class Modules {
10641088
Modules(Client client) {
1065-
serverpod_auth_idp = _i27.Caller(client);
1089+
serverpod_auth_idp = _i28.Caller(client);
10661090
serverpod_auth_core = _i10.Caller(client);
10671091
}
10681092

1069-
late final _i27.Caller serverpod_auth_idp;
1093+
late final _i28.Caller serverpod_auth_idp;
10701094

10711095
late final _i10.Caller serverpod_auth_core;
10721096
}
@@ -1086,7 +1110,7 @@ class Client extends _i1.ServerpodClientShared {
10861110
bool? disconnectStreamsOnLostInternetConnection,
10871111
}) : super(
10881112
host,
1089-
_i28.Protocol(),
1113+
_i29.Protocol(),
10901114
securityContext: securityContext,
10911115
streamingConnectionTimeout: streamingConnectionTimeout,
10921116
connectionTimeout: connectionTimeout,
@@ -1104,6 +1128,7 @@ class Client extends _i1.ServerpodClientShared {
11041128
customDomainName = EndpointCustomDomainName(this);
11051129
deploy = EndpointDeploy(this);
11061130
environmentVariables = EndpointEnvironmentVariables(this);
1131+
insights = EndpointInsights(this);
11071132
logs = EndpointLogs(this);
11081133
plans = EndpointPlans(this);
11091134
database = EndpointDatabase(this);
@@ -1135,6 +1160,8 @@ class Client extends _i1.ServerpodClientShared {
11351160

11361161
late final EndpointEnvironmentVariables environmentVariables;
11371162

1163+
late final EndpointInsights insights;
1164+
11381165
late final EndpointLogs logs;
11391166

11401167
late final EndpointPlans plans;
@@ -1168,6 +1195,7 @@ class Client extends _i1.ServerpodClientShared {
11681195
'customDomainName': customDomainName,
11691196
'deploy': deploy,
11701197
'environmentVariables': environmentVariables,
1198+
'insights': insights,
11711199
'logs': logs,
11721200
'plans': plans,
11731201
'database': database,
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
15+
abstract class InsightsConnectionDetail implements _i1.SerializableModel {
16+
InsightsConnectionDetail._({required this.url, required this.serviceSecret});
17+
18+
factory InsightsConnectionDetail({
19+
required Uri url,
20+
required String serviceSecret,
21+
}) = _InsightsConnectionDetailImpl;
22+
23+
factory InsightsConnectionDetail.fromJson(
24+
Map<String, dynamic> jsonSerialization,
25+
) {
26+
return InsightsConnectionDetail(
27+
url: _i1.UriJsonExtension.fromJson(jsonSerialization['url']),
28+
serviceSecret: jsonSerialization['serviceSecret'] as String,
29+
);
30+
}
31+
32+
Uri url;
33+
34+
String serviceSecret;
35+
36+
/// Returns a shallow copy of this [InsightsConnectionDetail]
37+
/// with some or all fields replaced by the given arguments.
38+
@_i1.useResult
39+
InsightsConnectionDetail copyWith({Uri? url, String? serviceSecret});
40+
@override
41+
Map<String, dynamic> toJson() {
42+
return {
43+
'__className__': 'InsightsConnectionDetail',
44+
'url': url.toJson(),
45+
'serviceSecret': serviceSecret,
46+
};
47+
}
48+
49+
@override
50+
String toString() {
51+
return _i1.SerializationManager.encode(this);
52+
}
53+
}
54+
55+
class _InsightsConnectionDetailImpl extends InsightsConnectionDetail {
56+
_InsightsConnectionDetailImpl({
57+
required Uri url,
58+
required String serviceSecret,
59+
}) : super._(url: url, serviceSecret: serviceSecret);
60+
61+
/// Returns a shallow copy of this [InsightsConnectionDetail]
62+
/// with some or all fields replaced by the given arguments.
63+
@_i1.useResult
64+
@override
65+
InsightsConnectionDetail copyWith({Uri? url, String? serviceSecret}) {
66+
return InsightsConnectionDetail(
67+
url: url ?? this.url,
68+
serviceSecret: serviceSecret ?? this.serviceSecret,
69+
);
70+
}
71+
}

0 commit comments

Comments
 (0)