{"id":13561860,"url":"https://github.com/michaelklishin/rabbit-hole","last_synced_at":"2025-05-13T20:22:07.301Z","repository":{"id":11294343,"uuid":"13707459","full_name":"michaelklishin/rabbit-hole","owner":"michaelklishin","description":"RabbitMQ HTTP API client in Go","archived":false,"fork":false,"pushed_at":"2025-04-17T00:53:44.000Z","size":943,"stargazers_count":420,"open_issues_count":3,"forks_count":108,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-28T11:56:05.229Z","etag":null,"topics":["go","golang","monitoring","rabbitmq"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelklishin.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-10-19T19:36:05.000Z","updated_at":"2025-04-24T17:09:27.000Z","dependencies_parsed_at":"2023-09-25T06:26:51.713Z","dependency_job_id":"413ba804-9ed1-407c-88d3-15ac0335ffe4","html_url":"https://github.com/michaelklishin/rabbit-hole","commit_stats":{"total_commits":745,"total_committers":78,"mean_commits":9.551282051282051,"dds":0.548993288590604,"last_synced_commit":"4521364540b3adc20d160e6d2a73c90cca004a82"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelklishin%2Frabbit-hole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelklishin%2Frabbit-hole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelklishin%2Frabbit-hole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelklishin%2Frabbit-hole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelklishin","download_url":"https://codeload.github.com/michaelklishin/rabbit-hole/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311332,"owners_count":21569008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","monitoring","rabbitmq"],"created_at":"2024-08-01T13:01:02.020Z","updated_at":"2025-04-28T11:56:11.365Z","avatar_url":"https://github.com/michaelklishin.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Rabbit Hole, a RabbitMQ HTTP API Client for Go\n\nThis library is a [RabbitMQ HTTP API](https://rawcdn.githack.com/rabbitmq/rabbitmq-server/v3.13.5/deps/rabbitmq_management/priv/www/api/index.html) client for the Go language.\n\n## Supported Go Versions\n\nRabbit Hole targets two latests stable Go versions available at the time of the library release.\nOlder versions may work but this is not guaranteed.\n\n\n## Supported RabbitMQ Versions\n\nThis library targets the [community supported RabbitMQ release series](https://www.rabbitmq.com/release-information).\n\nAll versions require [RabbitMQ Management UI plugin](https://www.rabbitmq.com/docs/management/) to be installed and enabled.\n\n## Build Status\n\n[![Tests](https://github.com/michaelklishin/rabbit-hole/actions/workflows/tests.yml/badge.svg)](https://github.com/michaelklishin/rabbit-hole/actions/workflows/tests.yml)\n\n## Project Maturity\n\nRabbit Hole is a mature library (first released in late 2013).\n\nIt is largely feature complete and decently documented.\n\n\n## Change Log\n\nIf upgrading from an earlier release, please consult with\nthe [change log](https://github.com/michaelklishin/rabbit-hole/blob/master/ChangeLog.md).\n\n\n## Installation\n\n```\ngo get github.com/michaelklishin/rabbit-hole/v3\n```\n\n\n## Documentation\n\n### API Reference\n\n[API reference](https://pkg.go.dev/github.com/michaelklishin/rabbit-hole/v3?tab=doc) is available on [godoc.org](https://pkg.go.dev).\n\nContinue reading for a list of example snippets.\n\n### Overview\n\nTo import the package:\n\n``` go\nimport (\n       \"github.com/michaelklishin/rabbit-hole/v3\"\n)\n```\n\nAll HTTP API operations are accessible via `rabbithole.Client`, which\nshould be instantiated with `rabbithole.NewClient`:\n\n``` go\n// URI, username, password\nrmqc, _ = NewClient(\"http://127.0.0.1:15672\", \"guest\", \"guest\")\n```\n\nTLS (HTTPS) can be enabled by adding an HTTP transport to the parameters\nof `rabbithole.NewTLSClient`:\n\n``` go\ntransport := \u0026http.Transport{TLSClientConfig: tlsConfig}\nrmqc, _ := NewTLSClient(\"https://127.0.0.1:15672\", \"guest\", \"guest\", transport)\n```\n\nRabbitMQ HTTP API has to be [configured to use TLS](http://www.rabbitmq.com/management.html#single-listener-https).\n\n\n### Getting Overview\n\n``` go\nresp, err := rmqc.Overview()\n```\n\n\n### Node and Cluster Status\n\n``` go\nxs, err := rmqc.ListNodes()\n// =\u003e []NodeInfo, err\n\nnode, err := rmqc.GetNode(\"rabbit@mercurio\")\n// =\u003e NodeInfo, err\n```\n\n\n### Operations on Connections\n\n``` go\nxs, err := rmqc.ListConnections()\n// =\u003e []ConnectionInfo, err\n\nconn, err := rmqc.GetConnection(\"127.0.0.1:50545 -\u003e 127.0.0.1:5672\")\n// =\u003e ConnectionInfo, err\n\n// Forcefully close connection\n_, err := rmqc.CloseConnection(\"127.0.0.1:50545 -\u003e 127.0.0.1:5672\")\n// =\u003e *http.Response, err\n```\n\n\n### Operations on Channels\n\n``` go\nxs, err := rmqc.ListChannels()\n// =\u003e []ChannelInfo, err\n\nch, err := rmqc.GetChannel(\"127.0.0.1:50545 -\u003e 127.0.0.1:5672 (1)\")\n// =\u003e ChannelInfo, err\n```\n\n\n### Operations on Vhosts\n\n``` go\nxs, err := rmqc.ListVhosts()\n// =\u003e []VhostInfo, err\n\n// information about individual vhost\nx, err := rmqc.GetVhost(\"/\")\n// =\u003e VhostInfo, err\n\n// creates or updates individual vhost\nresp, err := rmqc.PutVhost(\"/\", VhostSettings{Tracing: false})\n// =\u003e *http.Response, err\n\n// deletes individual vhost\nresp, err := rmqc.DeleteVhost(\"/\")\n// =\u003e *http.Response, err\n```\n\n\n### Managing Users\n\n``` go\nxs, err := rmqc.ListUsers()\n// =\u003e []UserInfo, err\n\n// information about individual user\nx, err := rmqc.GetUser(\"my.user\")\n// =\u003e UserInfo, err\n\n// creates or updates individual user\nresp, err := rmqc.PutUser(\"my.user\", UserSettings{Password: \"s3krE7\", Tags: \"management,policymaker\"})\n// =\u003e *http.Response, err\n\n// creates or updates individual user with no password\nresp, err := rmqc.PutUserWithoutPassword(\"my.user\", UserSettings{Tags: \"management,policymaker\"})\n// =\u003e *http.Response, err\n\n// deletes individual user\nresp, err := rmqc.DeleteUser(\"my.user\")\n// =\u003e *http.Response, err\n```\n\n``` go\n// creates or updates individual user with a Base64-encoded SHA256 password hash\nhash := Base64EncodedSaltedPasswordHashSHA256(\"password-s3krE7\")\nresp, err := rmqc.PutUser(\"my.user\", UserSettings{\n  PasswordHash: hash,\n  HashingAlgorithm: HashingAlgorithmSHA256,\n  Tags: \"management,policymaker\"})\n// =\u003e *http.Response, err\n```\n\n\n### Managing Permissions\n\n``` go\nxs, err := rmqc.ListPermissions()\n// =\u003e []PermissionInfo, err\n\n// permissions of individual user\nx, err := rmqc.ListPermissionsOf(\"my.user\")\n// =\u003e []PermissionInfo, err\n\n// permissions of individual user in vhost\nx, err := rmqc.GetPermissionsIn(\"/\", \"my.user\")\n// =\u003e PermissionInfo, err\n\n// updates permissions of user in vhost\nresp, err := rmqc.UpdatePermissionsIn(\"/\", \"my.user\", Permissions{Configure: \".*\", Write: \".*\", Read: \".*\"})\n// =\u003e *http.Response, err\n\n// revokes permissions in vhost\nresp, err := rmqc.ClearPermissionsIn(\"/\", \"my.user\")\n// =\u003e *http.Response, err\n```\n\n\n### Operations on Exchanges\n\n``` go\nxs, err := rmqc.ListExchanges()\n// =\u003e []ExchangeInfo, err\n\n// list exchanges in a vhost\nxs, err := rmqc.ListExchangesIn(\"/\")\n// =\u003e []ExchangeInfo, err\n\n// information about individual exchange\nx, err := rmqc.GetExchange(\"/\", \"amq.fanout\")\n// =\u003e ExchangeInfo, err\n\n// declares an exchange\nresp, err := rmqc.DeclareExchange(\"/\", \"an.exchange\", ExchangeSettings{Type: \"fanout\", Durable: false})\n// =\u003e *http.Response, err\n\n// deletes individual exchange\nresp, err := rmqc.DeleteExchange(\"/\", \"an.exchange\")\n// =\u003e *http.Response, err\n```\n\n\n### Operations on Queues\n\n``` go\nqs, err := rmqc.ListQueues()\n// =\u003e []QueueInfo, err\n\n// list queues in a vhost\nqs, err := rmqc.ListQueuesIn(\"/\")\n// =\u003e []QueueInfo, err\n\n// information about individual queue\nq, err := rmqc.GetQueue(\"/\", \"a.queue\")\n// =\u003e QueueInfo, err\n\n// declares a queue\nresp, err := rmqc.DeclareQueue(\"/\", \"a.queue\", QueueSettings{Durable: false})\n// =\u003e *http.Response, err\n\n// deletes individual queue\nresp, err := rmqc.DeleteQueue(\"/\", \"a.queue\")\n// =\u003e *http.Response, err\n\n// purges all messages in queue\nresp, err := rmqc.PurgeQueue(\"/\", \"a.queue\")\n// =\u003e *http.Response, err\n\n// synchronises all messages in queue with the rest of mirrors in the cluster\nresp, err := rmqc.SyncQueue(\"/\", \"a.queue\")\n// =\u003e *http.Response, err\n\n// cancels queue synchronisation process\nresp, err := rmqc.CancelSyncQueue(\"/\", \"a.queue\")\n// =\u003e *http.Response, err\n```\n\n\n### Operations on Bindings\n\n``` go\nbs, err := rmqc.ListBindings()\n// =\u003e []BindingInfo, err\n\n// list bindings in a vhost\nbs, err := rmqc.ListBindingsIn(\"/\")\n// =\u003e []BindingInfo, err\n\n// list bindings of a queue\nbs, err := rmqc.ListQueueBindings(\"/\", \"a.queue\")\n// =\u003e []BindingInfo, err\n\n// list all bindings having the exchange as source\nbs1, err := rmqc.ListExchangeBindingsWithSource(\"/\", \"an.exchange\")\n// =\u003e []BindingInfo, err\n\n// list all bindings having the exchange as destinattion\nbs2, err := rmqc.ListExchangeBindingsWithDestination(\"/\", \"an.exchange\")\n// =\u003e []BindingInfo, err\n\n// declare a binding\nresp, err := rmqc.DeclareBinding(\"/\", BindingInfo{\n\tSource: \"an.exchange\",\n\tDestination: \"a.queue\",\n\tDestinationType: \"queue\",\n\tRoutingKey: \"#\",\n})\n// =\u003e *http.Response, err\n\n// deletes individual binding\nresp, err := rmqc.DeleteBinding(\"/\", BindingInfo{\n\tSource: \"an.exchange\",\n\tDestination: \"a.queue\",\n\tDestinationType: \"queue\",\n\tRoutingKey: \"#\",\n\tPropertiesKey: \"%23\",\n})\n// =\u003e *http.Response, err\n```\n\n### Operations on Feature Flags\n\n``` go\nxs, err := rmqc.ListFeatureFlags()\n// =\u003e []FeatureFlag, err\n\n// enable a feature flag\n_, err := rmqc.EnableFeatureFlag(\"drop_unroutable_metric\")\n// =\u003e *http.Response, err\n```\n\n### Operations on Shovels\n\n``` go\nqs, err := rmqc.ListShovels()\n// =\u003e []ShovelInfo, err\n\n// list shovels in a vhost\nqs, err := rmqc.ListShovelsIn(\"/\")\n// =\u003e []ShovelInfo, err\n\n// information about an individual shovel\nq, err := rmqc.GetShovel(\"/\", \"a.shovel\")\n// =\u003e ShovelInfo, err\n\n// declares a shovel\nshovelDetails := rabbithole.ShovelDefinition{\n\tSourceURI: URISet{\"amqp://sourceURI\"},\n\tSourceProtocol: \"amqp091\",\n\tSourceQueue: \"mySourceQueue\",\n\tDestinationURI: \"amqp://destinationURI\",\n\tDestinationProtocol: \"amqp10\",\n\tDestinationAddress: \"myDestQueue\",\n\tDestinationAddForwardHeaders: true,\n\tAckMode: \"on-confirm\",\n\tSrcDeleteAfter: \"never\",\n}\nresp, err := rmqc.DeclareShovel(\"/\", \"a.shovel\", shovelDetails)\n// =\u003e *http.Response, err\n\n// deletes an individual shovel\nresp, err := rmqc.DeleteShovel(\"/\", \"a.shovel\")\n// =\u003e *http.Response, err\n\n```\n\n### Operations on Runtime (vhost-scoped) Parameters\n\n```golang\n// list all runtime parameters\nparams, err := rmqc.ListRuntimeParameters()\n// =\u003e []RuntimeParameter, error\n\n// list all runtime parameters for a component\nparams, err := rmqc.ListRuntimeParametersFor(\"federation-upstream\")\n// =\u003e []RuntimeParameter, error\n\n// list runtime parameters in a vhost\nparams, err := rmqc.ListRuntimeParametersIn(\"federation-upstream\", \"/\")\n// =\u003e []RuntimeParameter, error\n\n// information about a runtime parameter\np, err := rmqc.GetRuntimeParameter(\"federation-upstream\", \"/\", \"name\")\n// =\u003e *RuntimeParameter, error\n\n// declare or update a runtime parameter\nresp, err := rmqc.PutRuntimeParameter(\"federation-upstream\", \"/\", \"name\", FederationDefinition{\n    Uri: URISet{\"amqp://server-name\"},\n})\n// =\u003e *http.Response, error\n\n// remove a runtime parameter\nresp, err := rmqc.DeleteRuntimeParameter(\"federation-upstream\", \"/\", \"name\")\n// =\u003e *http.Response, error\n\n```\n\n### Operations on Federation Upstreams\n\n```golang\n// list all federation upstreams\nups, err := rmqc.ListFederationUpstreams()\n// =\u003e []FederationUpstream, error\n\n// list federation upstreams in a vhost\nups, err := rmqc.ListFederationUpstreamsIn(\"/\")\n// =\u003e []FederationUpstream, error\n\n// information about a federated upstream\nup, err := rmqc.GetFederationUpstream(\"/\", \"name\")\n// =\u003e *FederationUpstream, error\n\n// declare or update a federation upstream\nresp, err := rmqc.PutFederationUpstream(\"/\", \"name\", FederationDefinition{\n  Uri: URISet{\"amqp://server-name\"},\n})\n// =\u003e *http.Response, error\n\n// delete an upstream\nresp, err := rmqc.DeleteFederationUpstream(\"/\", \"name\")\n// =\u003e *http.Response, error\n\n```\n\n### Managing Global Parameters\n``` go\n// list all global parameters\nparams, err := rmqc.ListGlobalParameters()\n// =\u003e []GlobalRuntimeParameter, error\n\n// get a global parameter\np, err := rmqc.GetGlobalParameter(\"name\")\n// =\u003e *GlobalRuntimeParameter, error\n\n// declare or update a global parameter\nresp, err := rmqc.PutGlobalParameter(\"name\", map[string]interface{\n    endpoints: \"amqp://server-name\",\n})\n// =\u003e *http.Response, error\n\n// delete a global parameter\nresp, err := rmqc.DeleteGlobalParameter(\"name\")\n// =\u003e *http.Response, error\n```\n\n### Managing Policies\n```go\nmypolicy := Policy{\n\tVhost:      \"/\",\n\tPattern:    \"^.*$\",\n\tApplyTo:    \"queues\",\n\tName:       \"mypolicy\",\n\tPriority:   0,\n\tDefinition: PolicyDefinition{\n\t\t// map[string] interface{}\n\t\t\"max-length-bytes\": 1048576,\n\t},\n}\nresp, err := rmqc.PutPolicy(\"/\", \"mypolicy\", mypolicy)\n// =\u003e *http.Response, error\nxs, err := rmqc.ListPolicies()\n// =\u003e []Policy, error\nx, err := rmqc.GetPolicy(\"/\", \"mypolicy\")\n// =\u003e *Policy, error\nresp, err := rmqc.DeletePolicy(\"/\", \"mypolicy\")\n// =\u003e *http.Response, error\n```\n\n### Operations on cluster name\n``` go\n// Get cluster name\ncn, err := rmqc.GetClusterName()\n// =\u003e ClusterName, err\n\n// Rename cluster\nresp, err := rmqc.SetClusterName(ClusterName{Name: \"rabbitmq@rabbit-hole\"})\n// =\u003e *http.Response, err\n\n```\n\n### HTTPS Connections\n\n``` go\nvar tlsConfig *tls.Config\n\n...\n\ntransport := \u0026http.Transport{TLSClientConfig: tlsConfig}\n\nrmqc, err := NewTLSClient(\"https://127.0.0.1:15672\", \"guest\", \"guest\", transport)\n```\n\n### Changing Transport Layer\n\n``` go\nvar transport http.RoundTripper\n\n...\n\nrmqc.SetTransport(transport)\n```\n\n\n## Contributing\n\nSee [CONTRIBUTING.md](https://github.com/michaelklishin/rabbit-hole/blob/master/CONTRIBUTING.md)\n\n\n## License \u0026 Copyright\n\n2-clause BSD license.\n\n(c) Michael S. Klishin and contributors, 2013-2025.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelklishin%2Frabbit-hole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelklishin%2Frabbit-hole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelklishin%2Frabbit-hole/lists"}