updateAgentSecret method
Implementation
Future<void> updateAgentSecret({
required String projectId,
required String agentId,
required String secretId,
required Uint8List data,
String? name,
String? type,
String? delegatedTo,
}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final encodedAgentId = Uri.encodeComponent(agentId);
final encodedSecretId = Uri.encodeComponent(secretId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/agents/$encodedAgentId/secrets/$encodedSecretId');
final body = <String, dynamic>{
'data_base64': base64Encode(_normalizeSecretBytes(data)),
'name': ?name,
'type': ?type,
'delegated_to': ?delegatedTo,
};
final response = await httpClient.put(uri, body: jsonEncode(body));
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to update agent secret. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
}