deployHaivaDb method
Implementation
Future<http.Response> deployHaivaDb(String agentId, Map<String, dynamic> dbConfig) async {
// final url = Uri.parse('$baseUrl/deployHaivaAgent').replace(
// queryParameters: {
// 'workspace-id': Constants.workspaceId,
// 'agent-id': agentId,
// },
// );
final url = Uri.parse('$baseUrl/deployHaivaAgent?workspaceId=$workspaceId&agentId=$agentId');
try {
final response = await http.post(
url,
headers: {
'Authorization': authToken!,
'Content-Type': 'application/json',
},
body: json.encode(dbConfig),
);
if (response.statusCode == 200 || response.statusCode == 201) {
print('HAIVA Agent deployed successfully');
logger.d(dbConfig);
return response;
} else {
print('Failed to deploy HAIVA Agent. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
throw Exception('Failed to deploy HAIVA Agent');
}
} catch (e) {
print('Error deploying HAIVA Agent: $e');
throw Exception('Error deploying HAIVA Agent: $e');
}
}