public AgentInstance updateAgentAttributes(Username username, HttpOperationResult result, String uuid, String newHostname, String resources, String environments, TriState enable) {
if (!hasOperatePermission(username, result)) {
return null;
}
AgentInstance agentInstance = findAgent(uuid);
if (isUnknownAgent(agentInstance, result)) {
return null;
}
AgentConfig agentConfig = agentConfigService.updateAgentAttributes(uuid, username, newHostname, resources, environments, enable, agentInstances, result);
if (agentConfig != null) {
return AgentInstance.createFromConfig(agentConfig, systemEnvironment, agentStatusChangeNotifier);
}
return null;
}