1/*
2Rabbit Hole is a Go client for the RabbitMQ HTTP API.
3
4All HTTP API operations are accessible via `rabbithole.Client`, which
5should be instantiated with `rabbithole.NewClient`.
6
7        // URI, username, password
8        rmqc, _ = NewClient("http://127.0.0.1:15672", "guest", "guest")
9
10Getting Overview
11
12        res, err := rmqc.Overview()
13
14Node and Cluster Status
15
16        var err error
17
18        // => []NodeInfo, err
19        xs, err := rmqc.ListNodes()
20
21        node, err := rmqc.GetNode("rabbit@mercurio")
22        // => NodeInfo, err
23
24Operations on Connections
25
26        xs, err := rmqc.ListConnections()
27        // => []ConnectionInfo, err
28
29        conn, err := rmqc.GetConnection("127.0.0.1:50545 -> 127.0.0.1:5672")
30        // => ConnectionInfo, err
31
32        // Forcefully close connection
33        _, err := rmqc.CloseConnection("127.0.0.1:50545 -> 127.0.0.1:5672")
34        // => *http.Response, err
35
36Operations on Channels
37
38        xs, err := rmqc.ListChannels()
39        // => []ChannelInfo, err
40
41        ch, err := rmqc.GetChannel("127.0.0.1:50545 -> 127.0.0.1:5672 (1)")
42        // => ChannelInfo, err
43
44Operations on Exchanges
45
46        xs, err := rmqc.ListExchanges()
47        // => []ExchangeInfo, err
48
49        // list exchanges in a vhost
50        xs, err := rmqc.ListExchangesIn("/")
51        // => []ExchangeInfo, err
52
53        // information about individual exchange
54        x, err := rmqc.GetExchange("/", "amq.fanout")
55        // => ExchangeInfo, err
56
57        // declares an exchange
58        resp, err := rmqc.DeclareExchange("/", "an.exchange", ExchangeSettings{Type: "fanout", Durable: false})
59        // => *http.Response, err
60
61        // deletes individual exchange
62        resp, err := rmqc.DeleteExchange("/", "an.exchange")
63        // => *http.Response, err
64
65Operations on Queues
66
67        xs, err := rmqc.ListQueues()
68        // => []QueueInfo, err
69
70        // list queues in a vhost
71        xs, err := rmqc.ListQueuesIn("/")
72        // => []QueueInfo, err
73
74        // information about individual queue
75        x, err := rmqc.GetQueue("/", "a.queue")
76        // => QueueInfo, err
77
78        // declares a queue
79        resp, err := rmqc.DeclareQueue("/", "a.queue", QueueSettings{Durable: false})
80        // => *http.Response, err
81
82        // deletes individual queue
83        resp, err := rmqc.DeleteQueue("/", "a.queue")
84        // => *http.Response, err
85
86        // purges all messages in queue
87        resp, err := rmqc.PurgeQueue("/", "a.queue")
88        // => *http.Response, err
89
90Operations on Bindings
91
92        bs, err := rmqc.ListBindings()
93        // => []BindingInfo, err
94
95        // list bindings in a vhost
96        bs, err := rmqc.ListBindingsIn("/")
97        // => []BindingInfo, err
98
99        // list bindings of a queue
100        bs, err := rmqc.ListQueueBindings("/", "a.queue")
101        // => []BindingInfo, err
102
103        // declare a binding
104        resp, err := rmqc.DeclareBinding("/", BindingInfo{
105            Source: "an.exchange",
106            Destination: "a.queue",
107            DestinationType: "queue",
108            RoutingKey: "#",
109        })
110        // => *http.Response, err
111
112        // deletes individual binding
113        resp, err := rmqc.DeleteBinding("/", BindingInfo{
114            Source: "an.exchange",
115            Destination: "a.queue",
116            DestinationType: "queue",
117            RoutingKey: "#",
118            PropertiesKey: "%23",
119        })
120        // => *http.Response, err
121
122Operations on Vhosts
123
124        xs, err := rmqc.ListVhosts()
125        // => []VhostInfo, err
126
127        // information about individual vhost
128        x, err := rmqc.GetVhost("/")
129        // => VhostInfo, err
130
131        // creates or updates individual vhost
132        resp, err := rmqc.PutVhost("/", VhostSettings{Tracing: false})
133        // => *http.Response, err
134
135        // deletes individual vhost
136        resp, err := rmqc.DeleteVhost("/")
137        // => *http.Response, err
138
139Managing Users
140
141        xs, err := rmqc.ListUsers()
142        // => []UserInfo, err
143
144        // information about individual user
145        x, err := rmqc.GetUser("my.user")
146        // => UserInfo, err
147
148        // creates or updates individual user
149        resp, err := rmqc.PutUser("my.user", UserSettings{Password: "s3krE7", Tags: "management policymaker"})
150        // => *http.Response, err
151
152        // deletes individual user
153        resp, err := rmqc.DeleteUser("my.user")
154        // => *http.Response, err
155
156Managing Permissions
157
158        xs, err := rmqc.ListPermissions()
159        // => []PermissionInfo, err
160
161        // permissions of individual user
162        x, err := rmqc.ListPermissionsOf("my.user")
163        // => []PermissionInfo, err
164
165        // permissions of individual user in vhost
166        x, err := rmqc.GetPermissionsIn("/", "my.user")
167        // => PermissionInfo, err
168
169        // updates permissions of user in vhost
170        resp, err := rmqc.UpdatePermissionsIn("/", "my.user", Permissions{Configure: ".*", Write: ".*", Read: ".*"})
171        // => *http.Response, err
172
173        // revokes permissions in vhost
174        resp, err := rmqc.ClearPermissionsIn("/", "my.user")
175        // => *http.Response, err
176
177Operations on cluster name
178        // Get cluster name
179        cn, err := rmqc.GetClusterName()
180        // => ClusterName, err
181
182        // Rename cluster
183        resp, err := rmqc.SetClusterName(ClusterName{Name: "rabbitmq@rabbit-hole"})
184        // => *http.Response, err
185*/
186package rabbithole
187