Giter Club home page Giter Club logo

Comments (9)

nvalerkos avatar nvalerkos commented on September 26, 2024

also no delete binding.

from pyrabbit.

nvalerkos avatar nvalerkos commented on September 26, 2024

` def delete_binding_exchange(self, vhost, exchange_source, exchange_destination, properties_key="~"):
"""
Deletes a binding between an exchange and an exchange on a given vhost.

    :param string vhost: vhost housing the exchange/queue to bind
    :param string exchange_source: the source exchange for the binding
    :param string exchange_destination: the target exchange to bind to the source exchange
    :param string properties_key: the routing key to use for the binding
    """

    vhost = quote(vhost, '')
    exchange_source = quote(exchange_source, '')
    exchange_destination = quote(exchange_destination, '')
    if properties_key == "~":
        body = json.dumps({"vhost":vhost,"source":exchange_source,"destination_type":"e","destination":exchange_destination,"properties_key":""})
    else:
        body = json.dumps({"vhost":vhost,"source":exchange_source,"destination_type":"e","destination":exchange_destination,"properties_key":properties_key})
    path = Client.urls['rt_bindings_between_exch_exch'] % (vhost,
                                                            exchange_source,
                                                            exchange_destination,
                                                            properties_key
                                                            )
    return self.http.do_call(path, 'DELETE', body=body, headers=Client.json_headers)`

from pyrabbit.

nvalerkos avatar nvalerkos commented on September 26, 2024

` def create_binding_exchange(self, vhost, exchange_source, exchange_destination, properties_key="", args=None):
"""
Creates a binding between an exchange and an exchange on a given vhost.

    :param string vhost: vhost housing the exchange/queue to bind
    :param string exchange_source: the source exchange of the binding
    :param string exchange_destination: the exchange to bind to the exchange
    :param string properties_key: the routing key to use for the binding
    :param list args: extra arguments to associate w/ the binding.
    :returns: boolean
    """

    vhost = quote(vhost, '')
    exchange_source = quote(exchange_source, '')
    exchange_destination = quote(exchange_destination, '')
    body = json.dumps({"vhost":vhost,"source":exchange_source,"destination_type":"e","destination":exchange_destination,"properties_key": properties_key, "arguments":args or []})
    path = Client.urls['bindings_between_exch_exch'] % (vhost,
                                                         exchange_source,
                                                         exchange_destination)
    binding = self.http.do_call(path, 'POST', body=body,
                                headers=Client.json_headers)
    return binding`

from pyrabbit.

nvalerkos avatar nvalerkos commented on September 26, 2024

I forgot to add the urls
add those between 86-87 line:
'bindings_between_exch_exch': 'bindings/%s/e/%s/e/%s',
'rt_bindings_between_exch_exch': 'bindings/%s/e/%s/e/%s/%s',

from pyrabbit.

nvalerkos avatar nvalerkos commented on September 26, 2024

please also add:

` def create_policy(self, vhost, name, pattern, apply_to, definition):
"""
Creates a policy to the server.

    :param string vhost: vhost housing of the policy to be created.
    :param string name: Name of the policy to be created.
    :param string pattern: Pattern of the policy to be applied.
    :param string apply_to: Apply to 'queues' or 'exchanges' or 'all'.
    :param string definition: Definition of the policy to create.
    """
    vhost = quote(vhost, '')
    name = quote(name, '')

    body = json.dumps({"vhost":vhost,"name":name,"pattern":pattern,"apply-to":apply_to,"definition": definition})
    path = Client.urls['policies'] % (vhost,
                                        name)
    return self.http.do_call(path, 'PUT', body=body, headers=Client.json_headers)

def delete_policy(self, vhost, name):
    """
    Deletes a policy from the server.

    :param string vhost: vhost housing of the policy to delete
    :param string name: Name of the policy to delete from the server.
    """
    vhost = quote(vhost, '')
    name = quote(name, '')
    body = json.dumps({"vhost":vhost,"name":name,"component":"policy"})
    path = Client.urls['policies'] % (vhost,
                                        name)
    return self.http.do_call(path, 'DELETE', body=body, headers=Client.json_headers)

`
and on the urls the 95 before the }

,'policies': 'policies/%s/%s'

from pyrabbit.

chaos95 avatar chaos95 commented on September 26, 2024

I'm a bit late to this party, but I have a fork that adds exchange to exchange bindings at https://github.com/chaos95/pyrabbit

from pyrabbit.

nvalerkos avatar nvalerkos commented on September 26, 2024

Yeap.. A bit. Can you make the change on yours?

from pyrabbit.

chaos95 avatar chaos95 commented on September 26, 2024

I'll take a crack at it; give me a day or two :)

from pyrabbit.

nvalerkos avatar nvalerkos commented on September 26, 2024

from pyrabbit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.