From 990478a700ac9b5ec44faea35325a6a4d60361d1 Mon Sep 17 00:00:00 2001 From: Luis San Martin Date: Mon, 21 Dec 2020 21:24:06 +0100 Subject: [PATCH 1/2] add runtime definitions for rabbitmq --- runtime_parameters.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/runtime_parameters.go b/runtime_parameters.go index 1d906af..70a1f11 100644 --- a/runtime_parameters.go +++ b/runtime_parameters.go @@ -16,9 +16,44 @@ type RuntimeParameter struct { Value interface{} `json:"value"` } +// RuntimeDefinitions represents rabbitmq runtime configuration. +type RuntimeDefinitions struct { + RabbitVersion string `json:"rabbit_version"` + RabbitmqVersion string `json:"rabbitmq_version"` + ProductName string `json:"product_name"` + ProductVersion string `json:"product_version"` + Users interface{} `json:"users"` + Vhosts interface{} `json:"vhosts"` + Permissions interface{} `json:"permissions"` + TopicPermissions interface{} `json:"topic_permissions"` + Parameters interface{} `json:"parameters"` + GlobalParameters interface{} `json:"global_parameters"` + Policies interface{} `json:"policies"` + Queues interface{} `json:"queues"` + Exchanges interface{} `json:"exchanges"` + Bindings interface{} `json:"bindings"` +} + // RuntimeParameterValue represents arbitrary parameter data. type RuntimeParameterValue map[string]interface{} +// +// GET /api/definitions +// + +func (c *Client) ListRuntimeDefinitions() (p *RuntimeDefinitions, 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/parameters // From e6e3be40e9541df66ed0f0e07c864062860937fb Mon Sep 17 00:00:00 2001 From: Luis San Martin Date: Wed, 23 Dec 2020 10:05:25 +0100 Subject: [PATCH 2/2] use types already defined instead --- runtime_parameters.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/runtime_parameters.go b/runtime_parameters.go index 70a1f11..4e6d6cc 100644 --- a/runtime_parameters.go +++ b/runtime_parameters.go @@ -18,20 +18,20 @@ type RuntimeParameter struct { // RuntimeDefinitions represents rabbitmq runtime configuration. type RuntimeDefinitions struct { - RabbitVersion string `json:"rabbit_version"` - RabbitmqVersion string `json:"rabbitmq_version"` - ProductName string `json:"product_name"` - ProductVersion string `json:"product_version"` - Users interface{} `json:"users"` - Vhosts interface{} `json:"vhosts"` - Permissions interface{} `json:"permissions"` - TopicPermissions interface{} `json:"topic_permissions"` - Parameters interface{} `json:"parameters"` + RabbitVersion string `json:"rabbit_version"` + RabbitMQVersion string `json:"rabbitmq_version"` + ProductName string `json:"product_name"` + ProductVersion string `json:"product_version"` + Users []UserInfo + Vhosts []VhostInfo + Permissions []Permissions + TopicPermissions []TopicPermissionInfo + Parameters []RuntimeParameter GlobalParameters interface{} `json:"global_parameters"` - Policies interface{} `json:"policies"` - Queues interface{} `json:"queues"` - Exchanges interface{} `json:"exchanges"` - Bindings interface{} `json:"bindings"` + Policies []PolicyDefinition + Queues []QueueInfo + Exchanges []ExchangeInfo + Bindings []BindingInfo } // RuntimeParameterValue represents arbitrary parameter data.