Ejemplo n.º 1
0
 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
     });
 }
Ejemplo n.º 2
0
        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}");
        }
Ejemplo n.º 3
0
        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);
        }