Example #1
0
        public virtual Task<HttpResponseMessage> CreateQueue(string virtualHostName, string queueName,
                                                             Action<CreateQueueArgs> args,
                                                             CancellationToken cancellationToken =
                                                                 default(CancellationToken))
        {
            queueName.CheckIfArgValid("queueName");
            virtualHostName.CheckIfArgValid("virtualHostName");
            args.CheckIfArgValid("args");

            var queue = new CreateQueueArgsImpl();
            args(queue);
            string url = string.Format("api/queues/{0}/{1}", virtualHostName.SanitizeVirtualHostName(), queueName);

            return cancellationToken == default(CancellationToken)
                       ? Put(url, queue)
                       : Put(url, queue, cancellationToken);
        }
Example #2
0
        public virtual Task<HttpResponseMessage> BindQueueToExchange(string virtualHostName, string exchangeName,
                                                                     string queueName,
                                                                     Action<BindQueueArgs> args,
                                                                     CancellationToken cancellationToken =
                                                                         default(CancellationToken))
        {
            queueName.CheckIfArgValid("queueName");
            virtualHostName.CheckIfArgValid("virtualHostName");
            exchangeName.CheckIfArgValid("exchangeName");
            args.CheckIfArgValid("args");

            var queueBinding = new BindQueueArgsImpl();
            args(queueBinding);
            string url = string.Format("api/bindings/{0}/e/{1}/q/{2}", virtualHostName.SanitizeVirtualHostName(),
                                       exchangeName, queueName);

            return cancellationToken == default(CancellationToken)
                       ? Post(url, queueBinding)
                       : Post(url, queueBinding, cancellationToken);
        }
Example #3
0
        public virtual Task<HttpResponseMessage> CreateUserPermissions(string virtualHostName, string userName,
                                                                       Action<UserPermissionsArgs> args,
                                                                       CancellationToken cancellationToken =
                                                                           default(CancellationToken))
        {
            virtualHostName.CheckIfArgValid("virtualHostName");
            userName.CheckIfArgValid("userName");
            args.CheckIfArgValid("args");

            var permissions = new UserPermissionsArgsImpl();
            args(permissions);
            string url = string.Format("api/permissions/{0}/{1}", virtualHostName.SanitizeVirtualHostName(), userName);

            return cancellationToken == default(CancellationToken)
                       ? Put(url, permissions)
                       : Put(url, permissions, cancellationToken);
        }
Example #4
0
        public virtual Task<HttpResponseMessage> CreateUser(string userName, Action<UserArgs> args,
                                                            CancellationToken cancellationToken =
                                                                default(CancellationToken))
        {
            userName.CheckIfArgValid("userName");
            args.CheckIfArgValid("args");

            var user = new UserArgsImpl();
            args(user);
            string url = string.Format("api/users/{0}", userName);

            return cancellationToken == default(CancellationToken) ? Put(url, user) : Put(url, user, cancellationToken);
        }