static void OnVHostDeleted(VHost vhost, CompareContext context) { context.SendMessage(new Messages.VHostDeleted { EventTypeId = (int)EventType.VHostDeleted, Description = string.Format("VHost {0} Deleted", vhost.Name), VHostId = vhost.Id }); }
private void DeleteVHost(BrokerConfiguration configuration, string vHostName) { var vhosts = GetVHost(configuration); string httpVHost = vHostName.Replace(@"/", @"%2f"); VHost vhost = vhosts.FirstOrDefault(vh => vh.Name == vHostName); if (vhost == null) { return; } CallDeleteRabbitMqApi(configuration, $"api/vhosts/{httpVHost}"); }
private string CreateVHost(BrokerConfiguration configuration, string vHostName) { var vhosts = GetVHost(configuration); string httpVHost = vHostName.Replace(@"/", @"%2f"); VHost vhost = vhosts.FirstOrDefault(vh => vh.Name == vHostName); if (vhost == null) { CallPutRabbitMqApi(configuration, $"api/vhosts/{httpVHost}"); CallPutRabbitMqApi(configuration, $"api/permissions/{httpVHost}/{configuration.UserName}", new Permission()); if (!_vhosts.ContainsKey(configuration)) { _vhosts[configuration] = new HashSet <string>(); } _vhosts[configuration].Add(vHostName); } return(vHostName); }