listServiceAccountSecrets method
Implementation
Future<SecretsPage> listServiceAccountSecrets(
String projectId,
String serviceAccountId, {
int pageSize = 100,
String? continuationToken,
String? filter,
}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final encodedServiceAccountId = Uri.encodeComponent(serviceAccountId);
final query = <String, String>{'page_size': '$pageSize'};
if (continuationToken != null) {
query['continuation_token'] = continuationToken;
}
if (filter != null) {
query['filter'] = filter;
}
final uri = Uri.parse(
'$baseUrl/accounts/projects/$encodedProjectId/service-accounts/$encodedServiceAccountId/secrets',
).replace(queryParameters: query);
final response = await httpClient.get(uri);
if (response.statusCode >= 400) {
throw MeshagentException('Failed to list service account secrets. Status code: ${response.statusCode}, body: ${response.body}');
}
return SecretsPage.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
}