-
Notifications
You must be signed in to change notification settings - Fork 108
/
definitions.go
57 lines (47 loc) · 1.9 KB
/
definitions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package rabbithole
import "net/url"
// ExportedDefinitions represents definitions exported from a RabbitMQ cluster
type ExportedDefinitions struct {
RabbitVersion string `json:"rabbit_version,omitempty"`
RabbitMQVersion string `json:"rabbitmq_version,omitempty"`
ProductName string `json:"product_name,omitempty"`
ProductVersion string `json:"product_version,omitempty"`
Users *[]UserInfo `json:"users,omitempty"`
Vhosts *[]VhostInfo `json:"vhosts,omitempty"`
Permissions *[]Permissions `json:"permissions,omitempty"`
TopicPermissions *[]TopicPermissionInfo `json:"topic_permissions,omitempty"`
Parameters *[]RuntimeParameter `json:"paramaters,omitempty"`
GlobalParameters *[]GlobalRuntimeParameter `json:"global_parameters,omitempty"`
Policies *[]PolicyDefinition `json:"policies"`
Queues *[]QueueInfo `json:"queues"`
Exchanges *[]ExchangeInfo `json:"exchanges"`
Bindings *[]BindingInfo `json:"bindings"`
}
//
// GET /api/definitions
//
// ListDefinitions returns a set of definitions exported from a RabbitMQ cluster.
func (c *Client) ListDefinitions() (p *ExportedDefinitions, err error) {
req, err := newGETRequest(c, "definitions")
if err != nil {
return nil, err
}
if err = executeAndParseRequest(c, req, &p); err != nil {
return nil, err
}
return p, nil
}
//
// GET /api/definitions/vhost
//
// ListVhostDefinitions returns a set of definitions for a specific vhost.
func (c *Client) ListVhostDefinitions(vhost string) (p *ExportedDefinitions, err error) {
req, err := newGETRequest(c, "definitions/"+url.QueryEscape(vhost))
if err != nil {
return nil, err
}
if err = executeAndParseRequest(c, req, &p); err != nil {
return nil, err
}
return p, nil
}