public Task<Binding> Get(Action<QueueTarget> queue, Action<ExchangeTarget> exchange,
                                 Action<VirtualHostTarget> virtualHost, Action<PropertiesKeyTarget> propertiesKey,
                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var queueTargetImpl = new QueueTargetImpl();
            queue(queueTargetImpl);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            var exchangeTargetImpl = new ExchangeTargetImpl();
            exchange(exchangeTargetImpl);

            var propertiesKeyTargetImpl = new PropertiesKeyTargetImpl();
            propertiesKey(propertiesKeyTargetImpl);

            string url = string.Format("api/bindings/{0}/e/{1}/q/{2}/{3}",
                                       virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       exchangeTargetImpl.Target, queueTargetImpl.Target,
                                       propertiesKeyTargetImpl.Target.SanitizePropertiesKey());

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return queue binding between queue '{0}' and exchange '{1}' in virtual host '{2}'.",
                    queueTargetImpl.Target, exchangeTargetImpl.Target, virtualHostTargetImpl.Target));

            return base.Get(url, cancellationToken).As<Binding>(cancellationToken);
        }
        public Task<ServerResponse> Delete(string userName,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/permissions/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), userName);

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
Exemple #3
0
        public Task<IEnumerable<Connection>> GetAll(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return all information pertaining to all connections on current RabbitMQ server.");

            string url = "api/connections";

            return base.Get(url, cancellationToken).As<IEnumerable<Connection>>(cancellationToken);
        }
Exemple #4
0
        public Task<IEnumerable<Node>> GetAll(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return all information pertaining to all nodes on RabbitMQ cluster.");

            string url = "api/nodes";

            return base.Get(url, cancellationToken).As<IEnumerable<Node>>(cancellationToken);
        }
Exemple #5
0
        public Task<Node> Get(string nodeName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return all information pertaining to all nodes on RabbitMQ cluster.");

            string url = string.Format("api/nodes/{0}", nodeName);

            return base.Get(url, cancellationToken).As<Node>(cancellationToken);
        }
        public Task<Overview> Get(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return general information pertaining to current RabbitMQ server.");

            string url = "api/overview";

            return base.Get(url, cancellationToken).As<Overview>(cancellationToken);
        }
        public Task<IEnumerable<Parameter>> GetAll(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                "Sent request to return all information pertaining to all parameters on all virtual hosts on current RabbitMQ server.");

            string url = "api/parameters";

            return base.Get(url, cancellationToken).As<IEnumerable<Parameter>>(cancellationToken);
        }
Exemple #8
0
        public Task<User> Get(string userName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(string.Format(
                "Sent request to the RabbitMQ server to return information pertaining to user '{0}'.", userName));

            string url = string.Format("api/users/{0}", userName);

            return base.Get(url, cancellationToken).As<User>(cancellationToken);
        }
Exemple #9
0
        public Task<ServerResponse> Delete(string policy,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(string.Format("Sent request to RabbitMQ server to delete policy '{0}' from virtual host '{1}'.",
                                  policy, Init.VirtualHost));

            string url = string.Format("api/policies/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), policy);

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
        public Task<Permissions> Get(string userName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/permissions/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), userName);

            LogInfo(
                string.Format(
                    "Sent request to return user permission information pertaining to user '{0}' on virtual host '{1}' users on current RabbitMQ server.",
                    userName, Init.VirtualHost));

            return base.Get(url, cancellationToken).As<Permissions>(cancellationToken);
        }
Exemple #11
0
        public Task<Channel> Get(string channelName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/channels/{0}", channelName);

            LogInfo(
                string.Format(
                    "Sent request to return all information pertaining to channel '{0}' on current RabbitMQ server.",
                    channelName));

            return base.Get(url, cancellationToken).As<Channel>(cancellationToken);
        }
Exemple #12
0
        public Task<Exchange> Get(string exchange, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return information pertaining to exchange '{0}' belonging to virtual host '{1}'.",
                    exchange, Init.VirtualHost));

            string url = string.Format("api/exchanges/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), exchange);

            return base.Get(url, cancellationToken).As<Exchange>(cancellationToken);
        }
Exemple #13
0
        public Task<Policy> Get(string policy, Action<PolicyBehavior> args,
                                CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return policy information pertaining to policy '{0}' belonging to virtual host '{1}'.",
                    policy, Init.VirtualHost));

            string url = string.Format("api/policies/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), policy);

            return base.Get(url, cancellationToken).As<Policy>(cancellationToken);
        }
Exemple #14
0
        public Task<ServerResponse> Close(string connectionName,
                                          CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/connections/{0}", connectionName);

            LogInfo(
                string.Format(
                    "Sent request to return all information pertaining to connection '{0}' on current RabbitMQ server.",
                    connectionName));

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
        public Task<IEnumerable<Binding>> GetAll(string queue,
                                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return all bindings on queue '{0}' belonging to virtual host '{1}'.",
                    queue, Init.VirtualHost));

            string url = string.Format("api/queues/{0}/{1}/bindings", Init.VirtualHost.SanitizeVirtualHostName(), queue);

            return base.Get(url, cancellationToken).As<IEnumerable<Binding>>(cancellationToken);
        }
Exemple #16
0
        public Task<ServerResponse> Delete(Action<UserTarget> user,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var userTargetImpl = new UserTargetImpl();
            user(userTargetImpl);

            string url = string.Format("api/users/{0}", userTargetImpl.Target);

            LogInfo(string.Format("Sent request to RabbitMQ server to delete user '{0}'.", userTargetImpl.Target));

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
        public Task<Binding> Get(string queue, string exchange, string propertiesKey,
                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/bindings/{0}/e/{1}/q/{2}/{3}", Init.VirtualHost.SanitizeVirtualHostName(),
                                       exchange, queue, propertiesKey.SanitizePropertiesKey());

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return queue binding between queue '{0}' and exchange '{1}' in virtual host '{2}'.",
                    queue, exchange, Init.VirtualHost));

            return base.Get(url, cancellationToken).As<Binding>(cancellationToken);
        }
Exemple #18
0
        public Task<User> Get(Action<UserTarget> user, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var userTargetImpl = new UserTargetImpl();
            user(userTargetImpl);

            string url = string.Format("api/users/{0}", user.Target);

            LogInfo(string.Format(
                "Sent request to the RabbitMQ server to return information pertaining to user '{0}'.",
                userTargetImpl.Target));

            return base.Get(url, cancellationToken).As<User>(cancellationToken);
        }
        public Task<Parameter> Get(string component, string name, Action<VirtualHostTarget> target,
                                   CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                "Sent request to return all information pertaining to all parameters on all virtual hosts on current RabbitMQ server.");

            var targetImpl = new VirtualHostTargetImpl();
            target(targetImpl);

            string url = string.Format("api/parameters/{0}/{1}/{2}", component,
                                       targetImpl.Target.SanitizeVirtualHostName(), name);

            return base.Get(url, cancellationToken).As<Parameter>(cancellationToken);
        }
Exemple #20
0
        public Task<IEnumerable<Policy>> GetAll(Action<PolicyBehavior> args,
                                                CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var argsImpl = new PolicyBehaviorImpl();
            args(argsImpl);

            LogInfo(
                string.Format(
                    "Sent request to return all policy information pertaining to virtual host {0} on current RabbitMQ server.",
                    argsImpl.VirtualHost));

            string url = string.Format("api/policies/{0}", argsImpl.VirtualHost.SanitizeVirtualHostName());

            return base.Get(url, cancellationToken).As<IEnumerable<Policy>>(cancellationToken);
        }
        public Task<ServerResponse> Set(string userName, Action<UserPermissionsBehavior> args,
                                        CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var argsImpl = new UserPermissionsBehaviorImpl();
            args(argsImpl);

            string url = string.Format("api/permissions/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), userName);

            LogInfo(
                string.Format(
                    "Sent request to the RabbitMQ server to set permissions for user '{0}' on virtual host '{1}'.",
                    userName, Init.VirtualHost));

            return base.Put(url, argsImpl, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
        public Task<ServerResponse> Delete(string component, string name, Action<VirtualHostTarget> target,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var targetImpl = new VirtualHostTargetImpl();
            target(targetImpl);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to delete parameter '{0}' of component '{1}' on virtual host '{2}'.",
                    name, component, targetImpl.Target));

            string url = string.Format("api/parameters/{0}/{1}/{2}", component,
                                       targetImpl.Target.SanitizeVirtualHostName(), name);

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
Exemple #23
0
        public Task<ServerResponse> Delete(string virtualHost,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            if (virtualHost.SanitizeVirtualHostName() == "2%f")
            {
                LogError(
                    "VirtualHost.Delete method threw a CannotDeleteVirtualHostException exception for attempting to delete the default virtual host.");
                throw new CannotDeleteVirtualHostException("Cannot delete the default virtual host.");
            }

            string url = string.Format("api/vhosts/{0}", virtualHost.SanitizeVirtualHostName());

            LogInfo(string.Format("Sent request to RabbitMQ server to delete virtual host '{0}'.", virtualHost));

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
Exemple #24
0
        public Task<IEnumerable<Binding>> GetAllBindings(string exchange, Action<BindingDirection> args,
                                                         CancellationToken cancellationToken =
                                                             default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return all the bindings for exchange '{0}' belonging to virtual host '{1}'.",
                    exchange, Init.VirtualHost));

            var argsImpl = new BindingDirectionImpl();
            args(argsImpl);

            string url = string.Format("api/exchanges/{0}/{1}/bindings/{2}",
                                       Init.VirtualHost.SanitizeVirtualHostName(), exchange, argsImpl.BindingDirection);

            return base.Get(url, cancellationToken).As<IEnumerable<Binding>>(cancellationToken);
        }
Exemple #25
0
        public Task<ServerResponse> Delete(Action<QueueTarget> queue, Action<VirtualHostTarget> virtualHost,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var queueTargetImpl = new QueueTargetImpl();
            queue(queueTargetImpl);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            string url = string.Format("api/queues/{0}/{1}", virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       queueTargetImpl.Target);

            LogInfo(string.Format("Sent request to RabbitMQ server to delete queue '{0}' from virtual host '{1}'.",
                                  queueTargetImpl.Target, virtualHostTargetImpl.Target));

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
Exemple #26
0
        public Task<ServerResponse> New(string queue, Action<QueueBehavior> args,
                                        CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var argsImpl = new QueueBehaviorImpl();
            args(argsImpl);

            string url = string.Format("api/queues/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), queue);

            LogInfo(string.IsNullOrEmpty(argsImpl.Node)
                        ? string.Format(
                            "Sent request to RabbitMQ server to create queue '{0}' on virtual host '{1}'.", queue,
                            Init.VirtualHost)
                        : string.Format(
                            "Sent request to RabbitMQ server to create queue '{0}' on virtual host '{1}' on node '{2}'.",
                            queue, Init.VirtualHost, argsImpl.Node));

            return base.Put(url, argsImpl, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
Exemple #27
0
        public Task<Policy> Get(Action<PolicyTarget> policy, Action<VirtualHostTarget> virtualHost,
                                CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var policyTargetImpl = new PolicyTargetImpl();
            policy(policyTargetImpl);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return policy information pertaining to policy '{0}' belonging to virtual host '{1}'.",
                    policyTargetImpl.Target, virtualHostTargetImpl.Target));

            string url = string.Format("api/policies/{0}/{1}", virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       policyTargetImpl.Target);

            return base.Get(url, cancellationToken).As<Policy>(cancellationToken);
        }
        public Task<Permissions> Get(Action<UserTarget> user, Action<VirtualHostTarget> virtualHost,
                                     CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            var userTargetImpl = new UserTargetImpl();
            user(userTargetImpl);

            string url = string.Format("api/permissions/{0}/{1}", virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       userTargetImpl.Target);

            LogInfo(
                string.Format(
                    "Sent request to return user permission information pertaining to user '{0}' on virtual host '{1}' users on current RabbitMQ server.",
                    userTargetImpl.Target, virtualHostTargetImpl.Target));

            return base.Get(url, cancellationToken).As<Permissions>(cancellationToken);
        }
        public Task<ServerResponse> Delete(Action<UserTarget> user, Action<VirtualHostTarget> virtualHost,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            var userTargetImpl = new UserTargetImpl();
            user(userTargetImpl);

            string url = string.Format("api/permissions/{0}/{1}", virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       userTargetImpl.Target);

            LogInfo(
                string.Format(
                    "Sent request to the RabbitMQ server to delete permissions for user '{0}' on virtual host '{1}'.",
                    userTargetImpl.Target, virtualHostTargetImpl.Target));

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
        public Task<Exchange> Get(Action<ExchangeTarget> exchange, Action<VirtualHostTarget> virtualHost,
                                  CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var exchangeTargetImpl = new ExchangeTargetImpl();
            exchange(exchangeTargetImpl);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return information pertaining to exchange '{0}' belonging to virtual host '{1}'.",
                    exchangeTargetImpl.Target, virtualHostTargetImpl.Target));

            string url = string.Format("api/exchanges/{0}/{1}", virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       exchangeTargetImpl.Target);

            return base.Get(url, cancellationToken).As<Exchange>(cancellationToken);
        }