Documentation ¶
Overview ¶
Package rabbithole is a Go client for the RabbitMQ HTTP API.
All HTTP API operations are accessible via `rabbithole.Client`, which should be instantiated with `rabbithole.NewClient`.
// URI, username, password rmqc, _ = NewClient("http://127.0.0.1:15672", "guest", "guest")
Getting Overview
res, err := rmqc.Overview()
Node and Cluster Status
var err error // => []NodeInfo, err xs, err := rmqc.ListNodes() node, err := rmqc.GetNode("rabbit@mercurio") // => NodeInfo, err
Operations on Connections
xs, err := rmqc.ListConnections() // => []ConnectionInfo, err conn, err := rmqc.GetConnection("127.0.0.1:50545 -> 127.0.0.1:5672") // => ConnectionInfo, err // Forcefully close connection _, err := rmqc.CloseConnection("127.0.0.1:50545 -> 127.0.0.1:5672") // => *http.Response, err
Operations on Channels
xs, err := rmqc.ListChannels() // => []ChannelInfo, err ch, err := rmqc.GetChannel("127.0.0.1:50545 -> 127.0.0.1:5672 (1)") // => ChannelInfo, err
Operations on Exchanges
xs, err := rmqc.ListExchanges() // => []ExchangeInfo, err // list exchanges in a vhost xs, err := rmqc.ListExchangesIn("/") // => []ExchangeInfo, err // information about individual exchange x, err := rmqc.GetExchange("/", "amq.fanout") // => ExchangeInfo, err // declares an exchange resp, err := rmqc.DeclareExchange("/", "an.exchange", ExchangeSettings{Type: "fanout", Durable: false}) // => *http.Response, err // deletes individual exchange resp, err := rmqc.DeleteExchange("/", "an.exchange") // => *http.Response, err
Operations on Queues
xs, err := rmqc.ListQueues() // => []QueueInfo, err // list queues in a vhost xs, err := rmqc.ListQueuesIn("/") // => []QueueInfo, err // information about individual queue x, err := rmqc.GetQueue("/", "a.queue") // => QueueInfo, err // declares a queue resp, err := rmqc.DeclareQueue("/", "a.queue", QueueSettings{Durable: false}) // => *http.Response, err // deletes individual queue resp, err := rmqc.DeleteQueue("/", "a.queue") // => *http.Response, err // purges all messages in queue resp, err := rmqc.PurgeQueue("/", "a.queue") // => *http.Response, err
Operations on Bindings
bs, err := rmqc.ListBindings() // => []BindingInfo, err // list bindings in a vhost bs, err := rmqc.ListBindingsIn("/") // => []BindingInfo, err // list bindings of a queue bs, err := rmqc.ListQueueBindings("/", "a.queue") // => []BindingInfo, err // declare a binding resp, err := rmqc.DeclareBinding("/", BindingInfo{ Source: "an.exchange", Destination: "a.queue", DestinationType: "queue", RoutingKey: "#", }) // => *http.Response, err // deletes individual binding resp, err := rmqc.DeleteBinding("/", BindingInfo{ Source: "an.exchange", Destination: "a.queue", DestinationType: "queue", RoutingKey: "#", PropertiesKey: "%23", }) // => *http.Response, err
Operations on Vhosts
xs, err := rmqc.ListVhosts() // => []VhostInfo, err // information about individual vhost x, err := rmqc.GetVhost("/") // => VhostInfo, err // creates or updates individual vhost resp, err := rmqc.PutVhost("/", VhostSettings{Tracing: false}) // => *http.Response, err // deletes individual vhost resp, err := rmqc.DeleteVhost("/") // => *http.Response, err
Managing Users
xs, err := rmqc.ListUsers() // => []UserInfo, err // information about individual user x, err := rmqc.GetUser("my.user") // => UserInfo, err // creates or updates individual user resp, err := rmqc.PutUser("my.user", UserSettings{Password: "s3krE7", Tags: "management policymaker"}) // => *http.Response, err // deletes individual user resp, err := rmqc.DeleteUser("my.user") // => *http.Response, err
Managing Permissions
xs, err := rmqc.ListPermissions() // => []PermissionInfo, err // permissions of individual user x, err := rmqc.ListPermissionsOf("my.user") // => []PermissionInfo, err // permissions of individual user in vhost x, err := rmqc.GetPermissionsIn("/", "my.user") // => PermissionInfo, err // updates permissions of user in vhost resp, err := rmqc.UpdatePermissionsIn("/", "my.user", Permissions{Configure: ".*", Write: ".*", Read: ".*"}) // => *http.Response, err // revokes permissions in vhost resp, err := rmqc.ClearPermissionsIn("/", "my.user") // => *http.Response, err
Managing Topic Permissions
xs, err := rmqc.ListTopicPermissions() // => []TopicPermissionInfo, err // permissions of individual user x, err := rmqc.ListTopicPermissionsOf("my.user") // => []TopicPermissionInfo, err // permissions of individual user in vhost x, err := rmqc.GetTopicPermissionsIn("/", "my.user") // => []TopicPermissionInfo, err // updates permissions of user in vhost resp, err := rmqc.UpdateTopicPermissionsIn("/", "my.user", Permissions{Exchange: "amq.topic", Write: ".*", Read: ".*"}) // => *http.Response, err // revokes permissions in vhost resp, err := rmqc.ClearTopicPermissionsIn("/", "my.user") // => *http.Response, err // revokes single permissions in vhost resp, err := rmqc.DeleteTopicPermissionsIn("/", "my.user", "exchange") // => *http.Response, err
Managing Runtime Parameters
// list all runtime parameters params, err := rmqc.ListRuntimeParameters() // => []RuntimeParameter, error // list all runtime parameters for a component params, err := rmqc.ListRuntimeParametersFor("federation-upstream") // => []RuntimeParameter, error // list runtime parameters in a vhost params, err := rmqc.ListRuntimeParametersIn("federation-upstream", "/") // => []RuntimeParameter, error // information about a runtime parameter p, err := rmqc.GetRuntimeParameter("federation-upstream", "/", "name") // => *RuntimeParameter, error // declare or update a runtime parameter resp, err := rmqc.PutRuntimeParameter("federation-upstream", "/", "name", FederationDefinition{ Uri: "amqp://server-name", }) // => *http.Response, error // remove a runtime parameter resp, err := rmqc.DeleteRuntimeParameter("federation-upstream", "/", "name") // => *http.Response, error
Managing Federation Upstreams
// list all federation upstreams ups, err := rmqc.ListFederationUpstreams() // => []FederationUpstream, error // list federation upstreams in a vhost ups, err := rmqc.ListFederationUpstreamsIn("/") // => []FederationUpstream, error // information about a federated upstream up, err := rmqc.GetFederationUpstream("/", "upstream-name") // => *FederationUpstream, error // declare or update a federation upstream resp, err := rmqc.PutFederationUpstream("/", "upstream-name", FederationDefinition{ Uri: "amqp://server-name", }) // => *http.Response, error // delete an upstream resp, err := rmqc.DeleteFederationUpstream("/", "upstream-name") // => *http.Response, error
Operations on cluster name
// Get cluster name cn, err := rmqc.GetClusterName() // => ClusterName, err // Rename cluster resp, err := rmqc.SetClusterName(ClusterName{Name: "rabbitmq@rabbit-hole"}) // => *http.Response, err
Index ¶
- Constants
- func Base64EncodedSaltedPasswordHashSHA256(password string) string
- func Base64EncodedSaltedPasswordHashSHA512(password string) string
- func GenerateSalt(n int) string
- func SaltedPasswordHashSHA256(password string) (string, string)
- func SaltedPasswordHashSHA512(password string) (string, string)
- type AcknowledgementMode
- type AlarmInEffect
- type AuthMechanism
- type BackingQueueStatus
- type BindingInfo
- type BindingVertex
- type BriefChannelDetail
- type BriefConnectionDetails
- type BriefQueueInfo
- type BrokerContext
- type ChannelInfo
- type Client
- func (c *Client) CancelSyncQueue(vhost, queue string) (res *http.Response, err error)
- func (c *Client) ClearPermissionsIn(vhost, username string) (res *http.Response, err error)
- func (c *Client) ClearTopicPermissionsIn(vhost, username string) (res *http.Response, err error)
- func (c *Client) CloseConnection(name string) (res *http.Response, err error)
- func (c *Client) DeclareBinding(vhost string, info BindingInfo) (res *http.Response, err error)
- func (c *Client) DeclareExchange(vhost, exchange string, info ExchangeSettings) (res *http.Response, err error)
- func (c *Client) DeclareQueue(vhost, queue string, info QueueSettings) (res *http.Response, err error)
- func (c *Client) DeclareShovel(vhost, shovel string, info ShovelDefinition) (res *http.Response, err error)
- func (c *Client) DeleteAllRuntimeParameters() (err error)
- func (c *Client) DeleteBinding(vhost string, info BindingInfo) (res *http.Response, err error)
- func (c *Client) DeleteExchange(vhost, exchange string) (res *http.Response, err error)
- func (c *Client) DeleteFederationUpstream(vhost, name string) (res *http.Response, err error)
- func (c *Client) DeletePolicy(vhost, name string) (res *http.Response, err error)
- func (c *Client) DeleteQueue(vhost, queue string, opts ...QueueDeleteOptions) (res *http.Response, err error)
- func (c *Client) DeleteRuntimeParameter(component, vhost, name string) (res *http.Response, err error)
- func (c *Client) DeleteShovel(vhost, shovel string) (res *http.Response, err error)
- func (c *Client) DeleteTopicPermissionsIn(vhost, username string, exchange string) (res *http.Response, err error)
- func (c *Client) DeleteUser(username string) (res *http.Response, err error)
- func (c *Client) DeleteVhost(vhostname string) (res *http.Response, err error)
- func (c *Client) EnableFeatureFlag(featureFlagName string) (res *http.Response, err error)
- func (c *Client) EnabledProtocols() (xs []string, err error)
- func (c *Client) GetChannel(name string) (rec *ChannelInfo, err error)
- func (c *Client) GetClusterName() (rec *ClusterName, err error)
- func (c *Client) GetConnection(name string) (rec *ConnectionInfo, err error)
- func (c *Client) GetExchange(vhost, exchange string) (rec *DetailedExchangeInfo, err error)
- func (c *Client) GetFederationUpstream(vhost, name string) (up *FederationUpstream, err error)
- func (c *Client) GetNode(name string) (rec *NodeInfo, err error)
- func (c *Client) GetPermissionsIn(vhost, username string) (rec PermissionInfo, err error)
- func (c *Client) GetPolicy(vhost, name string) (rec *Policy, err error)
- func (c *Client) GetQueue(vhost, queue string) (rec *DetailedQueueInfo, err error)
- func (c *Client) GetQueueWithParameters(vhost, queue string, qs url.Values) (rec *DetailedQueueInfo, err error)
- func (c *Client) GetRuntimeParameter(component, vhost, name string) (p *RuntimeParameter, err error)
- func (c *Client) GetShovel(vhost, shovel string) (rec *ShovelInfo, err error)
- func (c *Client) GetTopicPermissionsIn(vhost, username string) (rec []TopicPermissionInfo, err error)
- func (c *Client) GetUser(username string) (rec *UserInfo, err error)
- func (c *Client) GetVhost(vhostname string) (rec *VhostInfo, err error)
- func (c *Client) HealthCheckAlarms() (rec ResourceAlarmCheckStatus, err error)
- func (c *Client) HealthCheckCertificateExpiration(within uint, unit TimeUnit) (rec HealthCheckStatus, err error)
- func (c *Client) HealthCheckLocalAlarms() (rec ResourceAlarmCheckStatus, err error)
- func (c *Client) HealthCheckNodeIsMirrorSyncCritical() (rec HealthCheckStatus, err error)
- func (c *Client) HealthCheckNodeIsQuorumCritical() (rec HealthCheckStatus, err error)
- func (c *Client) HealthCheckPortListener(port uint) (rec PortListenerCheckStatus, err error)
- func (c *Client) HealthCheckProtocolListener(protocol Protocol) (rec ProtocolListenerCheckStatus, err error)
- func (c *Client) HealthCheckVirtualHosts() (rec HealthCheckStatus, err error)
- func (c *Client) ListBindings() (rec []BindingInfo, err error)
- func (c *Client) ListBindingsIn(vhost string) (rec []BindingInfo, err error)
- func (c *Client) ListChannels() (rec []ChannelInfo, err error)
- func (c *Client) ListConnections() (rec []ConnectionInfo, err error)
- func (c *Client) ListConsumers() (rec []ConsumerInfo, err error)
- func (c *Client) ListConsumersIn(vhost string) (rec []ConsumerInfo, err error)
- func (c *Client) ListDefinitions() (p *ExportedDefinitions, err error)
- func (c *Client) ListExchangeBindings(vhost, exchange string, sourceOrDestination BindingVertex) (rec []BindingInfo, err error)
- func (c *Client) ListExchangeBindingsBetween(vhost, source string, destination string) (rec []BindingInfo, err error)
- func (c *Client) ListExchangeBindingsWithDestination(vhost, exchange string) (rec []BindingInfo, err error)
- func (c *Client) ListExchangeBindingsWithSource(vhost, exchange string) (rec []BindingInfo, err error)
- func (c *Client) ListExchanges() (rec []ExchangeInfo, err error)
- func (c *Client) ListExchangesIn(vhost string) (rec []ExchangeInfo, err error)
- func (c *Client) ListFeatureFlags() (rec []FeatureFlag, err error)
- func (c *Client) ListFederationLinks() (links []map[string]interface{}, err error)
- func (c *Client) ListFederationLinksIn(vhost string) (links []map[string]interface{}, err error)
- func (c *Client) ListFederationUpstreams() (ups []FederationUpstream, err error)
- func (c *Client) ListFederationUpstreamsIn(vhost string) (ups []FederationUpstream, err error)
- func (c *Client) ListNodes() (rec []NodeInfo, err error)
- func (c *Client) ListPermissions() (rec []PermissionInfo, err error)
- func (c *Client) ListPermissionsOf(username string) (rec []PermissionInfo, err error)
- func (c *Client) ListPolicies() (rec []Policy, err error)
- func (c *Client) ListPoliciesIn(vhost string) (rec []Policy, err error)
- func (c *Client) ListQueueBindings(vhost, queue string) (rec []BindingInfo, err error)
- func (c *Client) ListQueueBindingsBetween(vhost, exchange string, queue string) (rec []BindingInfo, err error)
- func (c *Client) ListQueues() (rec []QueueInfo, err error)
- func (c *Client) ListQueuesIn(vhost string) (rec []QueueInfo, err error)
- func (c *Client) ListQueuesWithParameters(params url.Values) (rec []QueueInfo, err error)
- func (c *Client) ListRuntimeParameters() (params []RuntimeParameter, err error)
- func (c *Client) ListRuntimeParametersFor(component string) (params []RuntimeParameter, err error)
- func (c *Client) ListRuntimeParametersIn(component, vhost string) (p []RuntimeParameter, err error)
- func (c *Client) ListShovelStatus(vhost string) (rec []ShovelStatus, err error)
- func (c *Client) ListShovels() (rec []ShovelInfo, err error)
- func (c *Client) ListShovelsIn(vhost string) (rec []ShovelInfo, err error)
- func (c *Client) ListTopicPermissions() (rec []TopicPermissionInfo, err error)
- func (c *Client) ListTopicPermissionsOf(username string) (rec []TopicPermissionInfo, err error)
- func (c *Client) ListUsers() (rec []UserInfo, err error)
- func (c *Client) ListVhosts() (rec []VhostInfo, err error)
- func (c *Client) Overview() (rec *Overview, err error)
- func (c *Client) PagedListQueuesWithParameters(params url.Values) (rec PagedQueueInfo, err error)
- func (c *Client) ProtocolPorts() (res map[string]Port, err error)
- func (c *Client) PurgeQueue(vhost, queue string) (res *http.Response, err error)
- func (c *Client) PutFederationUpstream(vhost, name string, def FederationDefinition) (res *http.Response, err error)
- func (c *Client) PutPolicy(vhost string, name string, policy Policy) (res *http.Response, err error)
- func (c *Client) PutRuntimeParameter(component, vhost, name string, value interface{}) (res *http.Response, err error)
- func (c *Client) PutUser(username string, info UserSettings) (res *http.Response, err error)
- func (c *Client) PutUserWithoutPassword(username string, info UserSettings) (res *http.Response, err error)
- func (c *Client) PutVhost(vhostname string, settings VhostSettings) (res *http.Response, err error)
- func (c *Client) SetClusterName(cn ClusterName) (res *http.Response, err error)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) SetTransport(transport http.RoundTripper)
- func (c *Client) SyncQueue(vhost, queue string) (res *http.Response, err error)
- func (c *Client) UpdatePermissionsIn(vhost, username string, permissions Permissions) (res *http.Response, err error)
- func (c *Client) UpdateTopicPermissionsIn(vhost, username string, TopicPermissions TopicPermissions) (res *http.Response, err error)
- func (c *Client) Whoami() (rec *WhoamiInfo, err error)
- type ClusterName
- type ConnectionInfo
- type ConsumerInfo
- type DeleteAfter
- type DetailedExchangeInfo
- type DetailedQueueInfo
- type ErlangApp
- type ErrorResponse
- type ExchangeEgressDetails
- type ExchangeInfo
- type ExchangeIngressDetails
- type ExchangeSettings
- type ExchangeType
- type ExportedDefinitions
- type FeatureFlag
- type FederationDefinition
- type FederationUpstream
- type GlobalRuntimeParameter
- type HashingAlgorithm
- type HealthCheck
- type HealthCheckStatus
- type IngressEgressStats
- type Listener
- type MessageStats
- type NameAndVhost
- type NameDescriptionEnabled
- type NameDescriptionVersion
- type NodeInfo
- type NodeNames
- type ObjectTotals
- type OsPid
- type Overview
- type OwnerPidDetails
- type PagedQueueInfo
- type PermissionInfo
- type Permissions
- type Policy
- type PolicyDefinition
- type Port
- type PortListenerCheckStatus
- type Properties
- type Protocol
- type ProtocolListenerCheckStatus
- type PublishingChannel
- type QueueDeleteOptions
- type QueueInfo
- type QueueSettings
- type QueueTotals
- type RateDetailSample
- type RateDetails
- type ResourceAlarmCheckStatus
- type RuntimeParameter
- type RuntimeParameterValue
- type ShovelDefinition
- type ShovelDefinitionDTO
- type ShovelInfo
- type ShovelStatus
- type ShovelURISet
- type Stability
- type State
- type TimeUnit
- type TopicPermissionInfo
- type TopicPermissions
- type UserInfo
- type UserSettings
- type UserTags
- type VhostInfo
- type VhostSettings
- type WhoamiInfo
Constants ¶
const FederationUpstreamComponent string = "federation-upstream"
FederationUpstreamComponent is the name of the runtime parameter component used by federation upstreams.
Variables ¶
This section is empty.
Functions ¶
func Base64EncodedSaltedPasswordHashSHA256 ¶
Base64EncodedSaltedPasswordHashSHA256 produces a salted hash value expected by the HTTP API. See https://www.rabbitmq.com/passwords.html#computing-password-hash for details.
func Base64EncodedSaltedPasswordHashSHA512 ¶
Base64EncodedSaltedPasswordHashSHA512 produces a salted hash value expected by the HTTP API. See https://www.rabbitmq.com/passwords.html#computing-password-hash for details.
func GenerateSalt ¶
GenerateSalt generates a password salt. Used to compute password hashes when creating or updating user information. See https://www.rabbitmq.com/passwords.html#computing-password-hash for details.
func SaltedPasswordHashSHA256 ¶
SaltedPasswordHashSHA256 is used to compute SHA-256 password hashes when creating or updating user information. See https://www.rabbitmq.com/passwords.html#computing-password-hash for details.
func SaltedPasswordHashSHA512 ¶
SaltedPasswordHashSHA512 is used to compute SHA-512 password hashes when creating or updating user information. See https://www.rabbitmq.com/passwords.html#computing-password-hash for details.
Types ¶
type AcknowledgementMode ¶
type AcknowledgementMode bool
AcknowledgementMode specifies an acknowledgement mode used by a consumer. Learn more at https://www.rabbitmq.com/confirms.html.
const ( // ManualAcknowledgement requires the consumer to explicitly // acknowledge processed deliveries. ManualAcknowledgement AcknowledgementMode = true // AutomaticAcknowledgment means that deliveries sent // to the consumer will be considered processed immediately. // Explicit acks from the client are not needed or expected // by the server. AutomaticAcknowledgment AcknowledgementMode = false )
type AlarmInEffect ¶
AlarmInEffect represents a resource alarm in effect on a node
type AuthMechanism ¶
type AuthMechanism NameDescriptionEnabled
AuthMechanism is a RabbbitMQ authentication and/or authorization mechanism available on the node.
type BackingQueueStatus ¶
type BackingQueueStatus struct { Q1 int `json:"q1"` Q2 int `json:"q2"` Q3 int `json:"q3"` Q4 int `json:"q4"` // Total queue length Length int64 `json:"len"` // Number of pending acks from consumers PendingAcks int64 `json:"pending_acks"` // Number of messages held in RAM RAMMessageCount int64 `json:"ram_msg_count"` // Number of outstanding acks held in RAM RAMAckCount int64 `json:"ram_ack_count"` // Number of persistent messages in the store PersistentCount int64 `json:"persistent_count"` // Average ingress (inbound) rate, not including messages // that straight through to auto-acking consumers. AverageIngressRate float64 `json:"avg_ingress_rate"` // Average egress (outbound) rate, not including messages // that straight through to auto-acking consumers. AverageEgressRate float64 `json:"avg_egress_rate"` // rate at which unacknowledged message records enter RAM, // e.g. because messages are delivered requiring acknowledgement AverageAckIngressRate float32 `json:"avg_ack_ingress_rate"` // rate at which unacknowledged message records leave RAM, // e.g. because acks arrive or unacked messages are paged out AverageAckEgressRate float32 `json:"avg_ack_egress_rate"` }
BackingQueueStatus exposes backing queue (queue storage engine) metrics. They can change in a future version of RabbitMQ.
type BindingInfo ¶
type BindingInfo struct { // Binding source (exchange name) Source string `json:"source"` Vhost string `json:"vhost"` // Binding destination (queue or exchange name) Destination string `json:"destination"` // Destination type, either "queue" or "exchange" DestinationType string `json:"destination_type"` RoutingKey string `json:"routing_key"` Arguments map[string]interface{} `json:"arguments"` PropertiesKey string `json:"properties_key"` }
BindingInfo represents details of a binding.
type BindingVertex ¶
type BindingVertex string
BindingVertex represents one end (vertex) of a binding, a source or destination. This is primarily relevant for exchange-to-exchange bindings (E2Es).
const ( // BindingSource indicates the source vertex of a binding BindingSource BindingVertex = "source" // BindingDestination indicates the source vertex of a binding BindingDestination BindingVertex = "destination" )
func (BindingVertex) String ¶
func (v BindingVertex) String() string
type BriefChannelDetail ¶
type BriefChannelDetail struct { ConnectionName string `json:"connection_name"` Name string `json:"name"` Node string `json:"node"` Number int `json:"number"` PeerHost string `json:"peer_host"` PeerPort int `json:"peer_port"` User string `json:"user"` }
BriefChannelDetail represents a channel with a limited number of metrics.
type BriefConnectionDetails ¶
type BriefConnectionDetails struct { // Connection name Name string `json:"name"` // Client port PeerPort Port `json:"peer_port"` // Client host PeerHost string `json:"peer_host"` }
BriefConnectionDetails represents a brief (very incomplete) subset of connection information.
type BriefQueueInfo ¶
BriefQueueInfo represents a fully qualified queue name.
type BrokerContext ¶
type BrokerContext struct { Node string `json:"node"` Description string `json:"description"` Path string `json:"path"` Port Port `json:"port"` Ignore bool `json:"ignore_in_use"` }
BrokerContext represents a context (Erlang application) running on a node a node
type ChannelInfo ¶
type ChannelInfo struct { // Channel number Number int `json:"number"` // Channel name Name string `json:"name"` // basic.qos (prefetch count) value used PrefetchCount int `json:"prefetch_count"` // How many consumers does this channel have ConsumerCount int `json:"consumer_count"` // Number of unacknowledged messages on this channel UnacknowledgedMessageCount int `json:"messages_unacknowledged"` // Number of messages on this channel unconfirmed to publishers UnconfirmedMessageCount int `json:"messages_unconfirmed"` // Number of messages on this channel uncommited to message store UncommittedMessageCount int `json:"messages_uncommitted"` // Number of acks on this channel uncommited to message store UncommittedAckCount int `json:"acks_uncommitted"` // TODO(mk): custom deserializer to date/time? IdleSince string `json:"idle_since"` // True if this channel uses publisher confirms UsesPublisherConfirms bool `json:"confirm"` // True if this channel uses transactions Transactional bool `json:"transactional"` // True if this channel is blocked via channel.flow ClientFlowBlocked bool `json:"client_flow_blocked"` User string `json:"user"` Vhost string `json:"vhost"` Node string `json:"node"` ConnectionDetails BriefConnectionDetails `json:"connection_details"` }
ChannelInfo represents an AMQP 0-9-1 channel.
type Client ¶
type Client struct { // URI of a RabbitMQ node to use, not including the path, e.g. http://127.0.0.1:15672. Endpoint string // Username to use. This RabbitMQ user must have the "management" tag. Username string // Password to use. Password string // contains filtered or unexported fields }
Client for interaction with RabbitMQ HTTP API.
func NewTLSClient ¶
func NewTLSClient(uri string, username string, password string, transport http.RoundTripper) (me *Client, err error)
NewTLSClient instantiates a client with a transport; it is up to the developer to make that layer secure.
func (*Client) CancelSyncQueue ¶
CancelSyncQueue cancels queue synchronisation process.
func (*Client) ClearPermissionsIn ¶
ClearPermissionsIn clears (deletes) permissions of user in virtual host.
func (*Client) ClearTopicPermissionsIn ¶
ClearTopicPermissionsIn clears (deletes) topic-permissions of user in virtual host.
func (*Client) CloseConnection ¶
CloseConnection closes a connection.
func (*Client) DeclareBinding ¶
DeclareBinding adds a new binding
func (*Client) DeclareExchange ¶
func (c *Client) DeclareExchange(vhost, exchange string, info ExchangeSettings) (res *http.Response, err error)
DeclareExchange declares an exchange.
func (*Client) DeclareQueue ¶
func (c *Client) DeclareQueue(vhost, queue string, info QueueSettings) (res *http.Response, err error)
DeclareQueue declares a queue.
func (*Client) DeclareShovel ¶
func (c *Client) DeclareShovel(vhost, shovel string, info ShovelDefinition) (res *http.Response, err error)
DeclareShovel creates a shovel
func (*Client) DeleteAllRuntimeParameters ¶
DeleteAllRuntimeParameters clears all runtime parameters. Only mean to be used in integration tests.
func (*Client) DeleteBinding ¶
DeleteBinding delets an individual binding
func (*Client) DeleteExchange ¶
DeleteExchange deletes an exchange.
func (*Client) DeleteFederationUpstream ¶
DeleteFederationUpstream removes a federation upstream.
func (*Client) DeletePolicy ¶
DeletePolicy deletes a policy.
func (*Client) DeleteQueue ¶
func (c *Client) DeleteQueue(vhost, queue string, opts ...QueueDeleteOptions) (res *http.Response, err error)
DeleteQueue deletes a queue.
func (*Client) DeleteRuntimeParameter ¶
func (c *Client) DeleteRuntimeParameter(component, vhost, name string) (res *http.Response, err error)
DeleteRuntimeParameter removes a runtime parameter.
func (*Client) DeleteShovel ¶
DeleteShovel a shovel
func (*Client) DeleteTopicPermissionsIn ¶
func (c *Client) DeleteTopicPermissionsIn(vhost, username string, exchange string) (res *http.Response, err error)
DeleteTopicPermissionsIn delete topic-permissions of exchange for user in virtual host.
func (*Client) DeleteUser ¶
DeleteUser deletes a user by name.
func (*Client) DeleteVhost ¶
DeleteVhost deletes a virtual host.
func (*Client) EnableFeatureFlag ¶
EnableFeatureFlag enables a feature flag.
func (*Client) EnabledProtocols ¶
EnabledProtocols returns a list of names of the plugins enabled on target node.
func (*Client) GetChannel ¶
func (c *Client) GetChannel(name string) (rec *ChannelInfo, err error)
GetChannel returns channel information.
func (*Client) GetClusterName ¶
func (c *Client) GetClusterName() (rec *ClusterName, err error)
GetClusterName returns current cluster name.
func (*Client) GetConnection ¶
func (c *Client) GetConnection(name string) (rec *ConnectionInfo, err error)
GetConnection retrieves information about a connection.
func (*Client) GetExchange ¶
func (c *Client) GetExchange(vhost, exchange string) (rec *DetailedExchangeInfo, err error)
GetExchange returns information about an exchange.
func (*Client) GetFederationUpstream ¶
func (c *Client) GetFederationUpstream(vhost, name string) (up *FederationUpstream, err error)
GetFederationUpstream returns information about a federation upstream.
func (*Client) GetPermissionsIn ¶
func (c *Client) GetPermissionsIn(vhost, username string) (rec PermissionInfo, err error)
GetPermissionsIn returns permissions of user in virtual host.
func (*Client) GetQueue ¶
func (c *Client) GetQueue(vhost, queue string) (rec *DetailedQueueInfo, err error)
GetQueue returns information about a queue.
func (*Client) GetQueueWithParameters ¶
func (c *Client) GetQueueWithParameters(vhost, queue string, qs url.Values) (rec *DetailedQueueInfo, err error)
GetQueueWithParameters returns information about a queue. Compared to the regular GetQueue function, this one accepts additional query string values.
func (*Client) GetRuntimeParameter ¶
func (c *Client) GetRuntimeParameter(component, vhost, name string) (p *RuntimeParameter, err error)
GetRuntimeParameter returns information about a runtime parameter.
func (*Client) GetShovel ¶
func (c *Client) GetShovel(vhost, shovel string) (rec *ShovelInfo, err error)
GetShovel returns a shovel configuration
func (*Client) GetTopicPermissionsIn ¶
func (c *Client) GetTopicPermissionsIn(vhost, username string) (rec []TopicPermissionInfo, err error)
GetTopicPermissionsIn returns topic-permissions of user in virtual host.
func (*Client) HealthCheckAlarms ¶
func (c *Client) HealthCheckAlarms() (rec ResourceAlarmCheckStatus, err error)
HealthCheckAlarms checks if there are resource alarms in effect in the cluster Related RabbitMQ doc guide: https://www.rabbitmq.com/alarms.html
func (*Client) HealthCheckCertificateExpiration ¶
func (c *Client) HealthCheckCertificateExpiration(within uint, unit TimeUnit) (rec HealthCheckStatus, err error)
HealthCheckCertificateExpiration checks the expiration date on the certificates for every listener configured to use TLS. Valid units: days, weeks, months, years. The value of the within argument is the number of units. So, when within is 2 and unit is "months", the expiration period used by the check will be the next two months.
func (*Client) HealthCheckLocalAlarms ¶
func (c *Client) HealthCheckLocalAlarms() (rec ResourceAlarmCheckStatus, err error)
HealthCheckLocalAlarms checks if there are resource alarms in effect on the target node Related RabbitMQ doc guide: https://www.rabbitmq.com/alarms.html
func (*Client) HealthCheckNodeIsMirrorSyncCritical ¶
func (c *Client) HealthCheckNodeIsMirrorSyncCritical() (rec HealthCheckStatus, err error)
HealthCheckNodeIsMirrorSyncCritical checks if there are classic mirrored queues without synchronised mirrors online (queues that would potentially lose data if the target node is shut down).
func (*Client) HealthCheckNodeIsQuorumCritical ¶
func (c *Client) HealthCheckNodeIsQuorumCritical() (rec HealthCheckStatus, err error)
HealthCheckNodeIsQuorumCritical checks if there are quorum queues with minimum online quorum (queues that would lose their quorum and availability if the target node is shut down). Relevant RabbitMQ doc guide: https://www.rabbitmq.com/quorum-queues.html
func (*Client) HealthCheckPortListener ¶
func (c *Client) HealthCheckPortListener(port uint) (rec PortListenerCheckStatus, err error)
HealthCheckPortListener checks if there is an active listener on the give port. Relevant RabbitMQ doc guide: https://www.rabbitmq.com/monitoring.html
func (*Client) HealthCheckProtocolListener ¶
func (c *Client) HealthCheckProtocolListener(protocol Protocol) (rec ProtocolListenerCheckStatus, err error)
HealthCheckProtocolListener checks if there is an active listener for the given protocol Valid protocol names are: amqp091, amqp10, mqtt, stomp, web-mqtt, web-stomp, http, https, clustering Relevant RabbitMQ doc guide: https://www.rabbitmq.com/monitoring.html
func (*Client) HealthCheckVirtualHosts ¶
func (c *Client) HealthCheckVirtualHosts() (rec HealthCheckStatus, err error)
HealthCheckVirtualHosts checks if all virtual hosts are running on the target node
func (*Client) ListBindings ¶
func (c *Client) ListBindings() (rec []BindingInfo, err error)
ListBindings returns all bindings
func (*Client) ListBindingsIn ¶
func (c *Client) ListBindingsIn(vhost string) (rec []BindingInfo, err error)
ListBindingsIn returns all bindings in a virtual host.
func (*Client) ListChannels ¶
func (c *Client) ListChannels() (rec []ChannelInfo, err error)
ListChannels returns information about all open channels.
func (*Client) ListConnections ¶
func (c *Client) ListConnections() (rec []ConnectionInfo, err error)
ListConnections returns a list of client connections to target node.
func (*Client) ListConsumers ¶
func (c *Client) ListConsumers() (rec []ConsumerInfo, err error)
ListConsumers lists all consumers in the cluster.
func (*Client) ListConsumersIn ¶
func (c *Client) ListConsumersIn(vhost string) (rec []ConsumerInfo, err error)
ListConsumersIn lists all consumers in a virtual host.
func (*Client) ListDefinitions ¶
func (c *Client) ListDefinitions() (p *ExportedDefinitions, err error)
ListDefinitions returns a set of definitions exported from a RabbitMQ cluster.
func (*Client) ListExchangeBindings ¶
func (c *Client) ListExchangeBindings(vhost, exchange string, sourceOrDestination BindingVertex) (rec []BindingInfo, err error)
ListExchangeBindings returns all bindings having the exchange as source or destination as defined by the Target
func (*Client) ListExchangeBindingsBetween ¶
func (c *Client) ListExchangeBindingsBetween(vhost, source string, destination string) (rec []BindingInfo, err error)
ListExchangeBindingsBetween returns a set of bindings between two exchanges.
func (*Client) ListExchangeBindingsWithDestination ¶
func (c *Client) ListExchangeBindingsWithDestination(vhost, exchange string) (rec []BindingInfo, err error)
ListExchangeBindingsWithDestination returns exchange-to-exchange (E2E) bindings where the given exchange is the destination.
func (*Client) ListExchangeBindingsWithSource ¶
func (c *Client) ListExchangeBindingsWithSource(vhost, exchange string) (rec []BindingInfo, err error)
ListExchangeBindingsWithSource returns exchange-to-exchange (E2E) bindings where the given exchange is the source.
func (*Client) ListExchanges ¶
func (c *Client) ListExchanges() (rec []ExchangeInfo, err error)
ListExchanges lists all exchanges in a cluster. This only includes exchanges in the virtual hosts accessible to the user.
func (*Client) ListExchangesIn ¶
func (c *Client) ListExchangesIn(vhost string) (rec []ExchangeInfo, err error)
ListExchangesIn lists all exchanges in a virtual host.
func (*Client) ListFeatureFlags ¶
func (c *Client) ListFeatureFlags() (rec []FeatureFlag, err error)
ListFeatureFlags lists all feature flags.
func (*Client) ListFederationLinks ¶
ListFederationLinks returns a list of all federation links.
func (*Client) ListFederationLinksIn ¶
ListFederationLinksIn returns a list of federation links in a vhost.
func (*Client) ListFederationUpstreams ¶
func (c *Client) ListFederationUpstreams() (ups []FederationUpstream, err error)
ListFederationUpstreams returns a list of all federation upstreams.
func (*Client) ListFederationUpstreamsIn ¶
func (c *Client) ListFederationUpstreamsIn(vhost string) (ups []FederationUpstream, err error)
ListFederationUpstreamsIn returns a list of all federation upstreams in a vhost.
func (*Client) ListPermissions ¶
func (c *Client) ListPermissions() (rec []PermissionInfo, err error)
ListPermissions returns permissions for all users and virtual hosts.
func (*Client) ListPermissionsOf ¶
func (c *Client) ListPermissionsOf(username string) (rec []PermissionInfo, err error)
ListPermissionsOf returns permissions of a specific user.
func (*Client) ListPolicies ¶
ListPolicies returns all policies (across all virtual hosts).
func (*Client) ListPoliciesIn ¶
ListPoliciesIn returns policies in a specific virtual host.
func (*Client) ListQueueBindings ¶
func (c *Client) ListQueueBindings(vhost, queue string) (rec []BindingInfo, err error)
ListQueueBindings returns all bindings of individual queue.
func (*Client) ListQueueBindingsBetween ¶
func (c *Client) ListQueueBindingsBetween(vhost, exchange string, queue string) (rec []BindingInfo, err error)
ListQueueBindingsBetween returns a set of bindings between an exchange and a queue.
func (*Client) ListQueues ¶
ListQueues lists all queues in the cluster. This only includes queues in the virtual hosts accessible to the user.
func (*Client) ListQueuesIn ¶
ListQueuesIn lists all queues in a virtual host.
func (*Client) ListQueuesWithParameters ¶
ListQueuesWithParameters lists queues with a list of query string values.
func (*Client) ListRuntimeParameters ¶
func (c *Client) ListRuntimeParameters() (params []RuntimeParameter, err error)
ListRuntimeParameters returns a list of all runtime parameters.
func (*Client) ListRuntimeParametersFor ¶
func (c *Client) ListRuntimeParametersFor(component string) (params []RuntimeParameter, err error)
ListRuntimeParametersFor returns a list of all runtime parameters for a component in all vhosts.
func (*Client) ListRuntimeParametersIn ¶
func (c *Client) ListRuntimeParametersIn(component, vhost string) (p []RuntimeParameter, err error)
ListRuntimeParametersIn returns a list of all runtime parameters for a component in a vhost.
func (*Client) ListShovelStatus ¶
func (c *Client) ListShovelStatus(vhost string) (rec []ShovelStatus, err error)
ListShovelStatus returns status of all shovels in a vhost
func (*Client) ListShovels ¶
func (c *Client) ListShovels() (rec []ShovelInfo, err error)
ListShovels returns all shovels
func (*Client) ListShovelsIn ¶
func (c *Client) ListShovelsIn(vhost string) (rec []ShovelInfo, err error)
ListShovelsIn returns all shovels in a vhost
func (*Client) ListTopicPermissions ¶
func (c *Client) ListTopicPermissions() (rec []TopicPermissionInfo, err error)
ListTopicPermissions returns topic-permissions for all users and virtual hosts.
func (*Client) ListTopicPermissionsOf ¶
func (c *Client) ListTopicPermissionsOf(username string) (rec []TopicPermissionInfo, err error)
ListTopicPermissionsOf returns topic-permissions of a specific user.
func (*Client) ListVhosts ¶
ListVhosts returns a list of virtual hosts.
func (*Client) Overview ¶
Overview returns an overview of cluster state with some key aggregated metrics.
func (*Client) PagedListQueuesWithParameters ¶
func (c *Client) PagedListQueuesWithParameters(params url.Values) (rec PagedQueueInfo, err error)
PagedListQueuesWithParameters lists queues with pagination.
func (*Client) ProtocolPorts ¶
ProtocolPorts returns a list of active (listening) ports on target node.
func (*Client) PurgeQueue ¶
PurgeQueue purges a queue (deletes all messages ready for delivery in it).
func (*Client) PutFederationUpstream ¶
func (c *Client) PutFederationUpstream(vhost, name string, def FederationDefinition) (res *http.Response, err error)
PutFederationUpstream creates or updates a federation upstream configuration.
func (*Client) PutPolicy ¶
func (c *Client) PutPolicy(vhost string, name string, policy Policy) (res *http.Response, err error)
PutPolicy creates or updates a policy.
func (*Client) PutRuntimeParameter ¶
func (c *Client) PutRuntimeParameter(component, vhost, name string, value interface{}) (res *http.Response, err error)
PutRuntimeParameter creates or updates a runtime parameter.
func (*Client) PutUserWithoutPassword ¶
func (c *Client) PutUserWithoutPassword(username string, info UserSettings) (res *http.Response, err error)
PutUserWithoutPassword creates a passwordless user. Such users can only authenticate using an X.509 certificate or another authentication mechanism (or backend) that does not use passwords.
func (*Client) SetClusterName ¶
func (c *Client) SetClusterName(cn ClusterName) (res *http.Response, err error)
SetClusterName sets cluster name.
func (*Client) SetTimeout ¶
SetTimeout changes the HTTP timeout that the Client will use. By default there is no timeout.
func (*Client) SetTransport ¶
func (c *Client) SetTransport(transport http.RoundTripper)
SetTransport changes the Transport Layer that the Client will use.
func (*Client) SyncQueue ¶
SyncQueue synchronises queue contents with the mirrors remaining in the cluster.
func (*Client) UpdatePermissionsIn ¶
func (c *Client) UpdatePermissionsIn(vhost, username string, permissions Permissions) (res *http.Response, err error)
UpdatePermissionsIn sets permissions of a user in a virtual host.
func (*Client) UpdateTopicPermissionsIn ¶
func (c *Client) UpdateTopicPermissionsIn(vhost, username string, TopicPermissions TopicPermissions) (res *http.Response, err error)
UpdateTopicPermissionsIn updates topic-permissions of user in virtual host.
func (*Client) Whoami ¶
func (c *Client) Whoami() (rec *WhoamiInfo, err error)
Whoami echoes requesting user's name back.
type ClusterName ¶
type ClusterName struct {
Name string `json:"name"`
}
ClusterName represents a RabbitMQ cluster name (identifier).
type ConnectionInfo ¶
type ConnectionInfo struct { // Connection name Name string `json:"name"` // Node the client is connected to Node string `json:"node"` // Number of open channels Channels int `json:"channels"` // Connection state State string `json:"state"` // Connection type, network (via AMQP client) or direct (via direct Erlang client) Type string `json:"type"` // Server port Port Port `json:"port"` // Client port PeerPort Port `json:"peer_port"` // Server host Host string `json:"host"` // Client host PeerHost string `json:"peer_host"` // Last connection blocking reason, if any LastBlockedBy string `json:"last_blocked_by"` // When connection was last blocked LastBlockedAge string `json:"last_blocked_age"` // True if connection uses TLS/SSL UsesTLS bool `json:"ssl"` // Client certificate subject PeerCertSubject string `json:"peer_cert_subject"` // Client certificate validity PeerCertValidity string `json:"peer_cert_validity"` // Client certificate issuer PeerCertIssuer string `json:"peer_cert_issuer"` // TLS/SSL protocol and version SSLProtocol string `json:"ssl_protocol"` // Key exchange mechanism SSLKeyExchange string `json:"ssl_key_exchange"` // SSL cipher suite used SSLCipher string `json:"ssl_cipher"` // SSL hash SSLHash string `json:"ssl_hash"` // Protocol, e.g. AMQP 0-9-1 or MQTT 3-1 Protocol string `json:"protocol"` User string `json:"user"` // Virtual host Vhost string `json:"vhost"` // Heartbeat timeout Timeout int `json:"timeout"` // Maximum frame size (AMQP 0-9-1) FrameMax int `json:"frame_max"` // A map of client properties (name, version, capabilities, etc) ClientProperties Properties `json:"client_properties"` // Octets received RecvOct uint64 `json:"recv_oct"` // Octets sent SendOct uint64 `json:"send_oct"` RecvCount uint64 `json:"recv_cnt"` SendCount uint64 `json:"send_cnt"` SendPending uint64 `json:"send_pend"` // Ingress data rate RecvOctDetails RateDetails `json:"recv_oct_details"` // Egress data rate SendOctDetails RateDetails `json:"send_oct_details"` // Connection timestamp ConnectedAt uint64 `json:"connected_at,omitempty"` }
ConnectionInfo provides information about connection to a RabbitMQ node.
type ConsumerInfo ¶
type ConsumerInfo struct { Arguments map[string]interface{} `json:"arguments"` AcknowledgementMode AcknowledgementMode `json:"ack_required"` ChannelDetails BriefChannelDetail `json:"channel_details"` ConsumerTag string `json:"consumer_tag"` Exclusive bool `json:"exclusive"` PrefetchCount int `json:"prefetch_count"` Queue BriefQueueInfo `json:"queue"` }
ConsumerInfo represents a consumer.
type DeleteAfter ¶
type DeleteAfter string
DeleteAfter after can hold a delete-after value which may be a string (eg. "never") or an integer
func (DeleteAfter) MarshalJSON ¶
func (d DeleteAfter) MarshalJSON() ([]byte, error)
MarshalJSON can marshal a string or an integer
func (*DeleteAfter) UnmarshalJSON ¶
func (d *DeleteAfter) UnmarshalJSON(b []byte) error
UnmarshalJSON can unmarshal a string or an integer
type DetailedExchangeInfo ¶
type DetailedExchangeInfo struct { Name string `json:"name"` Vhost string `json:"vhost"` Type string `json:"type"` Durable bool `json:"durable"` AutoDelete bool `json:"auto_delete"` Internal bool `json:"internal"` Arguments map[string]interface{} `json:"arguments"` Incoming []ExchangeIngressDetails `json:"incoming"` Outgoing []ExchangeEgressDetails `json:"outgoing"` PublishStats IngressEgressStats `json:"message_stats"` }
DetailedExchangeInfo represents an exchange with all of its properties and metrics.
type DetailedQueueInfo ¶
type DetailedQueueInfo QueueInfo
DetailedQueueInfo is an alias for QueueInfo
type ErlangApp ¶
type ErlangApp NameDescriptionVersion
ErlangApp is an Erlang application running on a node.
type ErrorResponse ¶
type ErrorResponse struct { StatusCode int Message string `json:"error"` Reason string `json:"reason"` }
ErrorResponse represents an error reported by an API response.
func (ErrorResponse) Error ¶
func (rme ErrorResponse) Error() string
type ExchangeEgressDetails ¶
type ExchangeEgressDetails struct { Stats MessageStats `json:"stats"` Queue NameAndVhost `json:"queue"` }
ExchangeEgressDetails represents egress (outbound) message flow metrics of an exchange.
type ExchangeInfo ¶
type ExchangeInfo struct { Name string `json:"name"` Vhost string `json:"vhost"` Type string `json:"type"` Durable bool `json:"durable"` AutoDelete bool `json:"auto_delete"` Internal bool `json:"internal"` Arguments map[string]interface{} `json:"arguments"` MessageStats IngressEgressStats `json:"message_stats"` }
ExchangeInfo represents and exchange and its properties.
type ExchangeIngressDetails ¶
type ExchangeIngressDetails struct { Stats MessageStats `json:"stats"` ChannelDetails PublishingChannel `json:"channel_details"` }
ExchangeIngressDetails represents ingress (inbound) message flow metrics of an exchange.
type ExchangeSettings ¶
type ExchangeSettings struct { Type string `json:"type"` Durable bool `json:"durable"` AutoDelete bool `json:"auto_delete,omitempty"` Arguments map[string]interface{} `json:"arguments,omitempty"` }
ExchangeSettings is a set of exchange properties. Use this type when declaring an exchange.
type ExchangeType ¶
type ExchangeType NameDescriptionEnabled
ExchangeType is an exchange type available on the node.
type ExportedDefinitions ¶
type ExportedDefinitions struct { 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 []GlobalRuntimeParameter `json:"global_parameters"` Policies []PolicyDefinition Queues []QueueInfo Exchanges []ExchangeInfo Bindings []BindingInfo }
ExportedDefinitions represents definitions exported from a RabbitMQ cluster
type FeatureFlag ¶
type FeatureFlag struct { Name string `json:"name"` // Desc is the description of the feature flag. Desc string `json:"desc,omitempty"` // DocURL is the URL to a webpage to learn more about the feature flag. DocURL string `json:"doc_url,omitempty"` State State `json:"state,omitempty"` Stability Stability `json:"stability,omitempty"` // ProvidedBy is the RabbitMQ component or plugin which provides the feature flag. ProvidedBy string `json:"provided_by,omitempty"` }
FeatureFlag represents a feature flag. Feature flags are a mechanism that controls what features are considered to be enabled or available on all cluster nodes. If a FeatureFlag is enabled so is its associated feature (or behavior). If not then all nodes in the cluster will disable the feature (behavior).
type FederationDefinition ¶
type FederationDefinition struct { Uri string `json:"uri"` Expires int `json:"expires,omitempty"` MessageTTL int32 `json:"message-ttl"` MaxHops int `json:"max-hops"` PrefetchCount int `json:"prefetch-count"` ReconnectDelay int `json:"reconnect-delay"` AckMode string `json:"ack-mode,omitempty"` TrustUserId bool `json:"trust-user-id"` Exchange string `json:"exchange"` Queue string `json:"queue"` }
FederationDefinition represents settings that will be used by federation links.
type FederationUpstream ¶
type FederationUpstream struct { Name string `json:"name"` Vhost string `json:"vhost"` Component string `json:"component"` Definition FederationDefinition `json:"value"` }
FederationUpstream represents a configured federation upstream.
type GlobalRuntimeParameter ¶
type GlobalRuntimeParameter struct { Name string `json:"name"` Value interface{} `json:"value"` }
GlobalRuntimeParameter represents a vhost-scoped parameter. Value is interface{} to support creating parameters directly from types such as FederationUpstream and ShovelInfo.
type HashingAlgorithm ¶
type HashingAlgorithm string
HashingAlgorithm represents a hashing algorithm used by RabbitMQ's an internal authentication backend.
const ( // HashingAlgorithmSHA256 sets password hashing algorithm to SHA-256. HashingAlgorithmSHA256 HashingAlgorithm = "rabbit_password_hashing_sha256" // HashingAlgorithmSHA512 sets password hashing algorithm to SHA-512. HashingAlgorithmSHA512 HashingAlgorithm = "rabbit_password_hashing_sha512" // HashingAlgorithmMD5 provided to support responses that include users created // before RabbitMQ 3.6 and other legacy scenarios. This algorithm is // deprecated. HashingAlgorithmMD5 HashingAlgorithm = "rabbit_password_hashing_md5" )
func (HashingAlgorithm) String ¶
func (algo HashingAlgorithm) String() string
type HealthCheck ¶
type HealthCheck interface { // Returns true if the check is ok, otherwise false Ok() bool }
HealthCheck represents a generic health check endpoint response Related RabbitMQ doc guide: https://www.rabbitmq.com/monitoring.html
type HealthCheckStatus ¶
type HealthCheckStatus struct { HealthCheck Status string `json:"status"` Reason string `json:"reason,omitempty"` }
HealthCheckStatus represents a generic health check endpoint response Related RabbitMQ doc guide: https://www.rabbitmq.com/monitoring.html
func (*HealthCheckStatus) Ok ¶
func (h *HealthCheckStatus) Ok() bool
Ok returns true if the health check succeeded
type IngressEgressStats ¶
type IngressEgressStats struct { PublishIn int `json:"publish_in"` PublishInDetails RateDetails `json:"publish_in_details"` PublishOut int `json:"publish_out"` PublishOutDetails RateDetails `json:"publish_out_details"` }
IngressEgressStats represents common message flow metrics.
type Listener ¶
type Listener struct { Node string `json:"node"` Protocol string `json:"protocol"` IpAddress string `json:"ip_address"` Port Port `json:"port"` }
Listener represents a TCP listener on a node.
type MessageStats ¶
type MessageStats struct { Publish int64 `json:"publish"` PublishDetails RateDetails `json:"publish_details"` Deliver int64 `json:"deliver"` DeliverDetails RateDetails `json:"deliver_details"` DeliverNoAck int64 `json:"deliver_noack"` DeliverNoAckDetails RateDetails `json:"deliver_noack_details"` DeliverGet int64 `json:"deliver_get"` DeliverGetDetails RateDetails `json:"deliver_get_details"` Redeliver int64 `json:"redeliver"` RedeliverDetails RateDetails `json:"redeliver_details"` Get int64 `json:"get"` GetDetails RateDetails `json:"get_details"` GetNoAck int64 `json:"get_no_ack"` GetNoAckDetails RateDetails `json:"get_no_ack_details"` Ack int64 `json:"ack"` AckDetails RateDetails `json:"ack_details"` ReturnUnroutable int64 `json:"return_unroutable"` ReturnUnroutableDetails RateDetails `json:"return_unroutable_details"` DropUnroutable int64 `json:"drop_unroutable"` DropUnroutableDetails RateDetails `json:"drop_unroutable_details"` }
MessageStats fields repsent a number of metrics related to published messages
type NameAndVhost ¶
NameAndVhost repesents a named entity in a virtual host.
type NameDescriptionEnabled ¶
type NameDescriptionEnabled struct { Name string `json:"name"` Description string `json:"description"` Enabled bool `json:"enabled"` }
NameDescriptionEnabled represents a named entity with a description.
type NameDescriptionVersion ¶
type NameDescriptionVersion struct { Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` }
NameDescriptionVersion represents a named, versioned entity.
type NodeInfo ¶
type NodeInfo struct { Name string `json:"name"` NodeType string `json:"type"` IsRunning bool `json:"running"` OsPid OsPid `json:"os_pid"` FdUsed int `json:"fd_used"` FdTotal int `json:"fd_total"` ProcUsed int `json:"proc_used"` ProcTotal int `json:"proc_total"` SocketsUsed int `json:"sockets_used"` SocketsTotal int `json:"sockets_total"` MemUsed int `json:"mem_used"` MemLimit int `json:"mem_limit"` MemAlarm bool `json:"mem_alarm"` DiskFree int `json:"disk_free"` DiskFreeLimit int `json:"disk_free_limit"` DiskFreeAlarm bool `json:"disk_free_alarm"` // Erlang scheduler run queue length RunQueueLength uint32 `json:"run_queue"` Processors uint32 `json:"processors"` Uptime uint64 `json:"uptime"` ExchangeTypes []ExchangeType `json:"exchange_types"` AuthMechanisms []AuthMechanism `json:"auth_mechanisms"` ErlangApps []ErlangApp `json:"applications"` Contexts []BrokerContext `json:"contexts"` Partitions []string `json:"partitions"` }
NodeInfo describes a RabbitMQ node and its basic metrics (such as resource usage).
type ObjectTotals ¶
type ObjectTotals struct { Consumers int `json:"consumers"` Queues int `json:"queues"` Exchanges int `json:"exchanges"` Connections int `json:"connections"` Channels int `json:"channels"` }
ObjectTotals represents object (connections, queues, consumers, etc) metrics across the entire cluster.
type Overview ¶
type Overview struct { ManagementVersion string `json:"management_version"` StatisticsLevel string `json:"statistics_level"` RabbitMQVersion string `json:"rabbitmq_version"` ErlangVersion string `json:"erlang_version"` FullErlangVersion string `json:"erlang_full_version"` ExchangeTypes []ExchangeType `json:"exchange_types"` MessageStats MessageStats `json:"message_stats"` QueueTotals QueueTotals `json:"queue_totals"` ObjectTotals ObjectTotals `json:"object_totals"` Node string `json:"node"` StatisticsDBNode string `json:"statistics_db_node"` Listeners []Listener `json:"listeners"` Contexts []BrokerContext `json:"contexts"` }
Overview provides a point-in-time overview of cluster state and some of its key aggregated metrics.
type OwnerPidDetails ¶
type OwnerPidDetails struct { Name string `json:"name"` PeerPort Port `json:"peer_port"` PeerHost string `json:"peer_host"` }
OwnerPidDetails describes an exclusive queue owner (connection).
type PagedQueueInfo ¶
type PagedQueueInfo struct { Page int `json:"page"` PageCount int `json:"page_count"` PageSize int `json:"page_size"` FilteredCount int `json:"filtered_count"` ItemCount int `json:"item_count"` TotalCount int `json:"total_count"` Items []QueueInfo `json:"items"` }
PagedQueueInfo is additional context returned for paginated requests.
type PermissionInfo ¶
type PermissionInfo struct { User string `json:"user"` Vhost string `json:"vhost"` // Configuration permissions Configure string `json:"configure"` // Write permissions Write string `json:"write"` // Read permissions Read string `json:"read"` }
PermissionInfo represents a user's permission in a virtual host.
type Permissions ¶
type Permissions struct { Configure string `json:"configure"` Write string `json:"write"` Read string `json:"read"` }
Permissions represents permissions of a user in a virtual host. Use this type to set permissions of the user.
type Policy ¶
type Policy struct { // Virtual host this policy is in. Vhost string `json:"vhost"` // Regular expression pattern used to match queues and exchanges, // , e.g. "^ha\..+" Pattern string `json:"pattern"` // What this policy applies to: "queues", "exchanges", etc. ApplyTo string `json:"apply-to"` Name string `json:"name"` Priority int `json:"priority"` // Additional arguments added to the entities (queues, // exchanges or both) that match a policy Definition PolicyDefinition `json:"definition"` }
Policy represents a configured policy.
type PolicyDefinition ¶
type PolicyDefinition map[string]interface{}
PolicyDefinition is a map of additional arguments added to the entities (queues, exchanges or both) that match a policy.
type Port ¶
type Port int
Port used by RabbitMQ or clients
func (*Port) UnmarshalJSON ¶
UnmarshalJSON deserialises
type PortListenerCheckStatus ¶
type PortListenerCheckStatus struct { HealthCheck Status string `json:"status"` Reason string `json:"reason,omitempty"` Port uint `json:"port,omitempty"` Missing uint `json:"missing,omitempty"` Ports []uint `json:"ports,omitempty"` }
PortListenerCheckStatus represents the response from HealthCheckPortListener
func (*PortListenerCheckStatus) Ok ¶
func (h *PortListenerCheckStatus) Ok() bool
Ok returns true if the health check succeeded
type Properties ¶
type Properties map[string]interface{}
Properties are extra arguments as a map (on queues, bindings, etc)
type Protocol ¶
type Protocol string
const ( AMQP Protocol = "amqp" AMQPS Protocol = "amqp/ssl" AMQP091 Protocol = "amqp091" AMQP10 Protocol = "amqp10" MQTT Protocol = "mqtt" STOMP Protocol = "stomp" WebMQTT Protocol = "web-mqtt" WebSTOMP Protocol = "web-stomp" HTTP Protocol = "http" HTTPS Protocol = "https" Prometheus Protocol = "http/prometheus" Clustering Protocol = "clustering" )
type ProtocolListenerCheckStatus ¶
type ProtocolListenerCheckStatus struct { HealthCheck Status string `json:"status"` Reason string `json:"reason,omitempty"` Missing string `json:"missing,omitempty"` Protocols []string `json:"protocols,omitempty"` }
ProtocolListenerCheckStatus represents the response from HealthCheckProtocolListener
func (*ProtocolListenerCheckStatus) Ok ¶
func (h *ProtocolListenerCheckStatus) Ok() bool
Ok returns true if the health check succeeded
type PublishingChannel ¶
type PublishingChannel struct { Number int `json:"number"` Name string `json:"name"` ConnectionName string `json:"connection_name"` PeerPort Port `json:"peer_port"` PeerHost string `json:"peer_host"` }
PublishingChannel represents a channel and its basic properties.
type QueueDeleteOptions ¶
type QueueDeleteOptions struct { // Only delete the queue if there are no messages. IfEmpty bool // Only delete the queue if there are no consumers. IfUnused bool }
Options for deleting a queue. Use it with DeleteQueue.
type QueueInfo ¶
type QueueInfo struct { // Queue name Name string `json:"name"` // Virtual host this queue belongs to Vhost string `json:"vhost"` // Is this queue durable? Durable bool `json:"durable"` // Is this queue auto-delted? AutoDelete bool `json:"auto_delete"` // Extra queue arguments Arguments map[string]interface{} `json:"arguments"` // RabbitMQ node that hosts master for this queue Node string `json:"node"` // Queue status Status string `json:"state"` // Total amount of RAM used by this queue Memory int64 `json:"memory"` // How many consumers this queue has Consumers int `json:"consumers"` // Utilisation of all the consumers ConsumerUtilisation float64 `json:"consumer_utilisation"` // If there is an exclusive consumer, its consumer tag ExclusiveConsumerTag string `json:"exclusive_consumer_tag"` // Policy applied to this queue, if any Policy string `json:"policy"` // Total bytes of messages in this queues MessagesBytes int64 `json:"message_bytes"` MessagesBytesPersistent int64 `json:"message_bytes_persistent"` MessagesBytesRAM int64 `json:"message_bytes_ram"` // Total number of messages in this queue Messages int `json:"messages"` MessagesDetails RateDetails `json:"messages_details"` MessagesPersistent int `json:"messages_persistent"` MessagesRAM int `json:"messages_ram"` // Number of messages ready to be delivered MessagesReady int `json:"messages_ready"` MessagesReadyDetails RateDetails `json:"messages_ready_details"` // Number of messages delivered and pending acknowledgements from consumers MessagesUnacknowledged int `json:"messages_unacknowledged"` MessagesUnacknowledgedDetails RateDetails `json:"messages_unacknowledged_details"` MessageStats MessageStats `json:"message_stats"` OwnerPidDetails OwnerPidDetails `json:"owner_pid_details"` BackingQueueStatus BackingQueueStatus `json:"backing_queue_status"` ActiveConsumers int64 `json:"active_consumers"` }
QueueInfo represents a queue, its properties and key metrics.
type QueueSettings ¶
type QueueSettings struct { Type string `json:"type"` Durable bool `json:"durable"` AutoDelete bool `json:"auto_delete,omitempty"` Arguments map[string]interface{} `json:"arguments,omitempty"` }
QueueSettings represents queue properties. Use it to declare a queue.
type QueueTotals ¶
type QueueTotals struct { Messages int `json:"messages"` MessagesDetails RateDetails `json:"messages_details"` MessagesReady int `json:"messages_ready"` MessagesReadyDetails RateDetails `json:"messages_ready_details"` MessagesUnacknowledged int `json:"messages_unacknowledged"` MessagesUnacknowledgedDetails RateDetails `json:"messages_unacknowledged_details"` }
QueueTotals represents queue metrics across the entire cluster.
type RateDetailSample ¶
RateDetailSample single touple
type RateDetails ¶
type RateDetails struct { Rate float32 `json:"rate"` Samples []RateDetailSample `json:"samples"` }
RateDetails fields represent rate of change of a numerical value
type ResourceAlarmCheckStatus ¶
type ResourceAlarmCheckStatus struct { HealthCheck Status string `json:"status"` Reason string `json:"reason,omitempty"` Alarms []AlarmInEffect `json:"alarms,omitempty"` }
ResourceAlarmCheckStatus represents the response from HealthCheckALarms
func (*ResourceAlarmCheckStatus) Ok ¶
func (h *ResourceAlarmCheckStatus) Ok() bool
Ok returns true if the health check succeeded
type RuntimeParameter ¶
type RuntimeParameter struct { Name string `json:"name"` Vhost string `json:"vhost"` Component string `json:"component"` Value interface{} `json:"value"` }
RuntimeParameter represents a vhost-scoped runtime parameter. Value is interface{} to support creating parameters directly from types such as FederationUpstream and ShovelInfo.
type RuntimeParameterValue ¶
type RuntimeParameterValue map[string]interface{}
RuntimeParameterValue represents arbitrary parameter data.
type ShovelDefinition ¶
type ShovelDefinition struct { DestinationURI ShovelURISet `json:"dest-uri"` SourceURI ShovelURISet `json:"src-uri"` AckMode string `json:"ack-mode,omitempty"` AddForwardHeaders bool `json:"add-forward-headers,omitempty"` DeleteAfter DeleteAfter `json:"delete-after,omitempty"` DestinationAddForwardHeaders bool `json:"dest-add-forward-headers,omitempty"` DestinationAddTimestampHeader bool `json:"dest-add-timestamp-header,omitempty"` DestinationAddress string `json:"dest-address,omitempty"` DestinationApplicationProperties string `json:"dest-application-properties,omitempty"` DestinationExchange string `json:"dest-exchange,omitempty"` DestinationExchangeKey string `json:"dest-exchange-key,omitempty"` DestinationProperties string `json:"dest-properties,omitempty"` DestinationProtocol string `json:"dest-protocol,omitempty"` DestinationPublishProperties string `json:"dest-publish-properties,omitempty"` DestinationQueue string `json:"dest-queue,omitempty"` PrefetchCount int `json:"prefetch-count,omitempty"` ReconnectDelay int `json:"reconnect-delay,omitempty"` SourceAddress string `json:"src-address,omitempty"` SourceDeleteAfter string `json:"src-delete-after,omitempty"` SourceExchange string `json:"src-exchange,omitempty"` SourceExchangeKey string `json:"src-exchange-key,omitempty"` SourcePrefetchCount int `json:"src-prefetch-count,omitempty"` SourceProtocol string `json:"src-protocol,omitempty"` SourceQueue string `json:"src-queue,omitempty"` }
ShovelDefinition contains the details of the shovel configuration
type ShovelDefinitionDTO ¶
type ShovelDefinitionDTO struct {
Definition ShovelDefinition `json:"value"`
}
ShovelDefinitionDTO provides a data transfer object
type ShovelInfo ¶
type ShovelInfo struct { // Shovel name Name string `json:"name"` // Virtual host this shovel belongs to Vhost string `json:"vhost"` // Component shovels belong to Component string `json:"component"` // Details the configuration values of the shovel Definition ShovelDefinition `json:"value"` }
ShovelInfo contains the configuration of a shovel
type ShovelStatus ¶
type ShovelStatus struct { // Shovel name Name string `json:"name"` // Virtual host this shovel belongs to Vhost string `json:"vhost"` // Type of this shovel Type string `json:"type"` // State of this shovel State string `json:"state"` // Timestamp of this shovel Timestamp string `json:"timestamp"` }
ShovelStatus contains the configuration of a shovel
type ShovelURISet ¶
type ShovelURISet []string
ShovelURISet represents a set of URIs used by Shovel. The URIs from this set are tried until one of them succeeds (Shovel successfully connects and authenticates with it)
func (*ShovelURISet) UnmarshalJSON ¶
func (s *ShovelURISet) UnmarshalJSON(b []byte) error
UnmarshalJSON can unmarshal a single URI string or a list of URI strings
type State ¶
type State string
State is an enumeration for supported feature flag states
const ( // StateEnabled means that the flag is enabled StateEnabled State = "enabled" // StateDisabled means that the flag is disabled StateDisabled State = "disabled" // StateUnsupported means that one or more nodes in the cluster do not support this feature flag // (and therefore it cannot be enabled) StateUnsupported State = "unsupported" )
type TopicPermissionInfo ¶
type TopicPermissionInfo struct { User string `json:"user"` Vhost string `json:"vhost"` // Configuration topic-permisions Exchange string `json:"exchange"` // Write topic-permissions Write string `json:"write"` // Read topic-permissions Read string `json:"read"` }
TopicPermissionInfo represents a user's permissions on a topic.
type TopicPermissions ¶
type TopicPermissions struct { Exchange string `json:"exchange"` Write string `json:"write"` Read string `json:"read"` }
TopicPermissions represents a user's permissions on a topic.
type UserInfo ¶
type UserInfo struct { Name string `json:"name"` PasswordHash string `json:"password_hash"` HashingAlgorithm HashingAlgorithm `json:"hashing_algorithm,omitempty"` // Tags control permissions. Built-in tags: administrator, management, policymaker. Tags UserTags `json:"tags"` }
UserInfo represents a user record. Only relevant when internal authentication backend is used.
type UserSettings ¶
type UserSettings struct { Name string `json:"name"` // Tags control permissions. Administrator grants full // permissions, management grants management UI and HTTP API // access, policymaker grants policy management permissions. Tags UserTags `json:"tags"` // *never* returned by RabbitMQ. Set by the client // to create/update a user. MK. Password string `json:"password,omitempty"` PasswordHash string `json:"password_hash,omitempty"` HashingAlgorithm HashingAlgorithm `json:"hashing_algorithm,omitempty"` }
UserSettings represents properties of a user. Used to create users. Tags must be comma-separated.
type UserTags ¶
type UserTags []string
UserTags represents tags of a user. In HTTP API responses this can be a JSON array (3.9.0+) or a comma-separated list in a string.
func (UserTags) MarshalJSON ¶
MarshalJSON can marshal an array of strings or a comma-separated list in a string
func (*UserTags) UnmarshalJSON ¶
UnmarshalJSON can unmarshal an array of strings or a comma-separated list in a string
type VhostInfo ¶
type VhostInfo struct { // Virtual host name Name string `json:"name"` // True if tracing is enabled for this virtual host Tracing bool `json:"tracing"` // Total number of messages in queues of this virtual host Messages int `json:"messages"` MessagesDetails RateDetails `json:"messages_details"` // Total number of messages ready to be delivered in queues of this virtual host MessagesReady int `json:"messages_ready"` MessagesReadyDetails RateDetails `json:"messages_ready_details"` // Total number of messages pending acknowledgement from consumers in this virtual host MessagesUnacknowledged int `json:"messages_unacknowledged"` MessagesUnacknowledgedDetails RateDetails `json:"messages_unacknowledged_details"` // Octets received RecvOct uint64 `json:"recv_oct"` // Octets sent SendOct uint64 `json:"send_oct"` RecvCount uint64 `json:"recv_cnt"` SendCount uint64 `json:"send_cnt"` SendPending uint64 `json:"send_pend"` RecvOctDetails RateDetails `json:"recv_oct_details"` SendOctDetails RateDetails `json:"send_oct_details"` // Cluster State ClusterState map[string]string `json:"cluster_state"` }
VhostInfo represents a virtual host, its properties and key metrics.
type VhostSettings ¶
type VhostSettings struct { // True if tracing should be enabled. Tracing bool `json:"tracing"` }
VhostSettings are properties used to create or modify virtual hosts.
type WhoamiInfo ¶
type WhoamiInfo struct { Name string `json:"name"` Tags UserTags `json:"tags"` AuthBackend string `json:"auth_backend"` }
WhoamiInfo represents a user whose request was successfully authenticated by the "whoami" API endpoint.
Source Files ¶
- bindings.go
- channels.go
- client.go
- cluster.go
- common.go
- connections.go
- consumers.go
- definitions.go
- doc.go
- error.go
- exchanges.go
- feature_flags.go
- federation.go
- federation_links.go
- health_checks.go
- misc.go
- nodes.go
- permissions.go
- plugins.go
- policies.go
- queues.go
- runtime_parameters.go
- shovels.go
- shovels_status.go
- topic_permissions.go
- users.go
- vhosts.go