• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jandelgado / rabtap / 10475483238

20 Aug 2024 04:28PM UTC coverage: 89.389%. Remained the same
10475483238

push

github

web-flow
[gh-actions] Bump goreleaser/goreleaser-action from 3 to 6 (#93)

Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 3 to 6.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v3...v6)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

2561 of 2865 relevant lines covered (89.39%)

7.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/rabbitmq_api_model.go
1
// rabitmq api model contains all data structures used by the rabbitmq HTTP
2
// API. To make things simple, these structures are also used as the our
3
// domain model.
4
// Copyright (C) 2017-2022 Jan Delgado
5

6
package rabtap
7

8
// RabbitVhost models the /vhosts resource of the rabbitmq http api
9
type RabbitVhost struct {
10
        // ClusterState struct {
11
        //     Rabbit1A92B8526E33 string `json:"rabbit@1a92b8526e33"`
12
        // } `json:"cluster_state"`
13
        Description  string `json:"description"`
14
        MessageStats struct {
15
                Ack        int `json:"ack"`
16
                AckDetails struct {
17
                        Rate float64 `json:"rate"`
18
                } `json:"ack_details"`
19
                Confirm        int `json:"confirm"`
20
                ConfirmDetails struct {
21
                        Rate float64 `json:"rate"`
22
                } `json:"confirm_details"`
23
                Deliver        int `json:"deliver"`
24
                DeliverDetails struct {
25
                        Rate float64 `json:"rate"`
26
                } `json:"deliver_details"`
27
                DeliverGet        int `json:"deliver_get"`
28
                DeliverGetDetails struct {
29
                        Rate float64 `json:"rate"`
30
                } `json:"deliver_get_details"`
31
                DeliverNoAck        int `json:"deliver_no_ack"`
32
                DeliverNoAckDetails struct {
33
                        Rate float64 `json:"rate"`
34
                } `json:"deliver_no_ack_details"`
35
                DropUnroutable        int `json:"drop_unroutable"`
36
                DropUnroutableDetails struct {
37
                        Rate float64 `json:"rate"`
38
                } `json:"drop_unroutable_details"`
39
                Get        int `json:"get"`
40
                GetDetails struct {
41
                        Rate float64 `json:"rate"`
42
                } `json:"get_details"`
43
                GetEmpty        int `json:"get_empty"`
44
                GetEmptyDetails struct {
45
                        Rate float64 `json:"rate"`
46
                } `json:"get_empty_details"`
47
                GetNoAck        int `json:"get_no_ack"`
48
                GetNoAckDetails struct {
49
                        Rate float64 `json:"rate"`
50
                } `json:"get_no_ack_details"`
51
                Publish        int `json:"publish"`
52
                PublishDetails struct {
53
                        Rate float64 `json:"rate"`
54
                } `json:"publish_details"`
55
                Redeliver        int `json:"redeliver"`
56
                RedeliverDetails struct {
57
                        Rate float64 `json:"rate"`
58
                } `json:"redeliver_details"`
59
                ReturnUnroutable        int `json:"return_unroutable"`
60
                ReturnUnroutableDetails struct {
61
                        Rate float64 `json:"rate"`
62
                } `json:"return_unroutable_details"`
63
        } `json:"message_stats"`
64
        Messages        int `json:"messages"`
65
        MessagesDetails struct {
66
                Rate float64 `json:"rate"`
67
        } `json:"messages_details"`
68
        MessagesReady        int `json:"messages_ready"`
69
        MessagesReadyDetails struct {
70
                Rate float64 `json:"rate"`
71
        } `json:"messages_ready_details"`
72
        MessagesUnacknowledged        int `json:"messages_unacknowledged"`
73
        MessagesUnacknowledgedDetails struct {
74
                Rate float64 `json:"rate"`
75
        } `json:"messages_unacknowledged_details"`
76
        Metadata struct {
77
                Description string        `json:"description"`
78
                Tags        []interface{} `json:"tags"`
79
        } `json:"metadata"`
80
        Name           string `json:"name"`
81
        RecvOct        int    `json:"recv_oct"`
82
        RecvOctDetails struct {
83
                Rate float64 `json:"rate"`
84
        } `json:"recv_oct_details"`
85
        SendOct        int `json:"send_oct"`
86
        SendOctDetails struct {
87
                Rate float64 `json:"rate"`
88
        } `json:"send_oct_details"`
89
        Tags    []interface{} `json:"tags"`
90
        Tracing bool          `json:"tracing"`
91
}
92

93
// RabbitConnection models the /connections resource of the rabbitmq http api
94
type RabbitConnection struct {
95
        ReductionsDetails struct {
96
                Rate float64 `json:"rate"`
97
        } `json:"reductions_details"`
98
        Reductions     int `json:"reductions"`
99
        RecvOctDetails struct {
100
                Rate float64 `json:"rate"`
101
        } `json:"recv_oct_details"`
102
        RecvOct        int `json:"recv_oct"`
103
        SendOctDetails struct {
104
                Rate float64 `json:"rate"`
105
        } `json:"send_oct_details"`
106
        SendOct          int   `json:"send_oct"`
107
        ConnectedAt      int64 `json:"connected_at"`
108
        ClientProperties struct {
109
                Product        string `json:"product"`
110
                Version        string `json:"version"`
111
                ConnectionName string `json:"connection_name"`
112
                Capabilities   struct {
113
                        ConnectionBlocked    bool `json:"connection.blocked"`
114
                        ConsumerCancelNotify bool `json:"consumer_cancel_notify"`
115
                } `json:"capabilities"`
116
        } `json:"client_properties"`
117
        ChannelMax        int         `json:"channel_max"`
118
        FrameMax          int         `json:"frame_max"`
119
        Timeout           int         `json:"timeout"`
120
        Vhost             string      `json:"vhost"`
121
        User              string      `json:"user"`
122
        Protocol          string      `json:"protocol"`
123
        SslHash           interface{} `json:"ssl_hash"`
124
        SslCipher         interface{} `json:"ssl_cipher"`
125
        SslKeyExchange    interface{} `json:"ssl_key_exchange"`
126
        SslProtocol       interface{} `json:"ssl_protocol"`
127
        AuthMechanism     string      `json:"auth_mechanism"`
128
        PeerCertValidity  interface{} `json:"peer_cert_validity"`
129
        PeerCertIssuer    interface{} `json:"peer_cert_issuer"`
130
        PeerCertSubject   interface{} `json:"peer_cert_subject"`
131
        Ssl               bool        `json:"ssl"`
132
        PeerHost          string      `json:"peer_host"`
133
        Host              string      `json:"host"`
134
        PeerPort          int         `json:"peer_port"`
135
        Port              int         `json:"port"`
136
        Name              string      `json:"name"`
137
        Node              string      `json:"node"`
138
        Type              string      `json:"type"`
139
        GarbageCollection struct {
140
                MinorGcs        int `json:"minor_gcs"`
141
                FullsweepAfter  int `json:"fullsweep_after"`
142
                MinHeapSize     int `json:"min_heap_size"`
143
                MinBinVheapSize int `json:"min_bin_vheap_size"`
144
                MaxHeapSize     int `json:"max_heap_size"`
145
        } `json:"garbage_collection"`
146
        Channels int    `json:"channels"`
147
        State    string `json:"state"`
148
        SendPend int    `json:"send_pend"`
149
        SendCnt  int    `json:"send_cnt"`
150
        RecvCnt  int    `json:"recv_cnt"`
151
}
152

153
// RabbitChannel models the /channels resource of the rabbitmq http api
154
type RabbitChannel struct {
155
        ReductionsDetails struct {
156
                Rate float64 `json:"rate"`
157
        } `json:"reductions_details"`
158
        Reductions   int `json:"reductions"`
159
        MessageStats struct {
160
                ReturnUnroutableDetails struct {
161
                        Rate float64 `json:"rate"`
162
                } `json:"return_unroutable_details"`
163
                ReturnUnroutable int `json:"return_unroutable"`
164
                ConfirmDetails   struct {
165
                        Rate float64 `json:"rate"`
166
                } `json:"confirm_details"`
167
                Confirm        int `json:"confirm"`
168
                PublishDetails struct {
169
                        Rate float64 `json:"rate"`
170
                } `json:"publish_details"`
171
                Publish    int `json:"publish"`
172
                Ack        int `json:"ack"`
173
                AckDetails struct {
174
                        Rate float64 `json:"rate"`
175
                } `json:"ack_details"`
176
                Deliver        int `json:"deliver"`
177
                DeliverDetails struct {
178
                        Rate float64 `json:"rate"`
179
                } `json:"deliver_details"`
180
                DeliverGet        int `json:"deliver_get"`
181
                DeliverGetDetails struct {
182
                        Rate float64 `json:"rate"`
183
                } `json:"deliver_get_details"`
184
                DeliverNoAck        int `json:"deliver_no_ack"`
185
                DeliverNoAckDetails struct {
186
                        Rate float64 `json:"rate"`
187
                } `json:"deliver_no_ack_details"`
188
                Get        int `json:"get"`
189
                GetDetails struct {
190
                        Rate float64 `json:"rate"`
191
                } `json:"get_details"`
192
                GetEmpty        int `json:"get_empty"`
193
                GetEmptyDetails struct {
194
                        Rate float64 `json:"rate"`
195
                } `json:"get_empty_details"`
196
                GetNoAck        int `json:"get_no_ack"`
197
                GetNoAckDetails struct {
198
                        Rate float64 `json:"rate"`
199
                } `json:"get_no_ack_details"`
200
                Redeliver        int `json:"redeliver"`
201
                RedeliverDetails struct {
202
                        Rate float64 `json:"rate"`
203
                } `json:"redeliver_details"`
204
        } `json:"message_stats"`
205
        Vhost             string            `json:"vhost"`
206
        User              string            `json:"user"`
207
        Number            int               `json:"number"`
208
        Name              string            `json:"name"`
209
        Node              string            `json:"node"`
210
        ConnectionDetails ConnectionDetails `json:"connection_details"`
211
        GarbageCollection struct {
212
                MinorGcs        int `json:"minor_gcs"`
213
                FullsweepAfter  int `json:"fullsweep_after"`
214
                MinHeapSize     int `json:"min_heap_size"`
215
                MinBinVheapSize int `json:"min_bin_vheap_size"`
216
                MaxHeapSize     int `json:"max_heap_size"`
217
        } `json:"garbage_collection"`
218
        State                  string `json:"state"`
219
        GlobalPrefetchCount    int    `json:"global_prefetch_count"`
220
        PrefetchCount          int    `json:"prefetch_count"`
221
        AcksUncommitted        int    `json:"acks_uncommitted"`
222
        MessagesUncommitted    int    `json:"messages_uncommitted"`
223
        MessagesUnconfirmed    int    `json:"messages_unconfirmed"`
224
        MessagesUnacknowledged int    `json:"messages_unacknowledged"`
225
        ConsumerCount          int    `json:"consumer_count"`
226
        Confirm                bool   `json:"confirm"`
227
        Transactional          bool   `json:"transactional"`
228
        IdleSince              string `json:"idle_since"`
229
}
230

231
// RabbitOverview models the /overview resource of the rabbitmq http api
232
type RabbitOverview struct {
233
        ManagementVersion string `json:"management_version"`
234
        RatesMode         string `json:"rates_mode"`
235
        ExchangeTypes     []struct {
236
                Name        string `json:"name"`
237
                Description string `json:"description"`
238
                Enabled     bool   `json:"enabled"`
239
        } `json:"exchange_types"`
240
        RabbitmqVersion   string `json:"rabbitmq_version"`
241
        ClusterName       string `json:"cluster_name"`
242
        ErlangVersion     string `json:"erlang_version"`
243
        ErlangFullVersion string `json:"erlang_full_version"`
244
        MessageStats      struct {
245
                DiskReads        int `json:"disk_reads"`
246
                DiskReadsDetails struct {
247
                        Rate float64 `json:"rate"`
248
                } `json:"disk_reads_details"`
249
                DiskWrites        int `json:"disk_writes"`
250
                DiskWritesDetails struct {
251
                        Rate float64 `json:"rate"`
252
                } `json:"disk_writes_details"`
253
        } `json:"message_stats"`
254
        QueueTotals struct {
255
                MessagesReady        int `json:"messages_ready"`
256
                MessagesReadyDetails struct {
257
                        Rate float64 `json:"rate"`
258
                } `json:"messages_ready_details"`
259
                MessagesUnacknowledged        int `json:"messages_unacknowledged"`
260
                MessagesUnacknowledgedDetails struct {
261
                        Rate float64 `json:"rate"`
262
                } `json:"messages_unacknowledged_details"`
263
                Messages        int `json:"messages"`
264
                MessagesDetails struct {
265
                        Rate float64 `json:"rate"`
266
                } `json:"messages_details"`
267
        } `json:"queue_totals"`
268
        ObjectTotals struct {
269
                Consumers   int `json:"consumers"`
270
                Queues      int `json:"queues"`
271
                Exchanges   int `json:"exchanges"`
272
                Connections int `json:"connections"`
273
                Channels    int `json:"channels"`
274
        } `json:"object_totals"`
275
        StatisticsDbEventQueue int    `json:"statistics_db_event_queue"`
276
        Node                   string `json:"node"`
277
        Listeners              []struct {
278
                Node      string `json:"node"`
279
                Protocol  string `json:"protocol"`
280
                IPAddress string `json:"ip_address"`
281
                Port      int    `json:"port"`
282
                // workaround for rabbitmq returning empty array OR valid object
283
                // here. TODO check / further investigate.-
284
                /*Dummy      []interface{} `json:"socket_opts,omitempty"`
285
                SocketOpts struct {
286
                        Backlog int  `json:"backlog"`
287
                        Nodelay bool `json:"nodelay"`
288
                        //Linger      []interface{} `json:"linger"`
289
                        ExitOnClose bool `json:"exit_on_close"`
290
                } `json:"socket_opts"`*/
291
        } `json:"listeners"`
292
        Contexts []struct {
293
                Node        string `json:"node"`
294
                Description string `json:"description"`
295
                Path        string `json:"path"`
296
                Port        string `json:"port"`
297
                Ssl         string `json:"ssl"`
298
        } `json:"contexts"`
299
}
300

301
// RabbitQueue models the /queues resource of the rabbitmq http api
302
type RabbitQueue struct {
303
        MessagesDetails struct {
304
                Rate float64 `json:"rate"`
305
        } `json:"messages_details"`
306
        Messages                      int `json:"messages"`
307
        MessagesUnacknowledgedDetails struct {
308
                Rate float64 `json:"rate"`
309
        } `json:"messages_unacknowledged_details"`
310
        MessagesUnacknowledged int `json:"messages_unacknowledged"`
311
        MessagesReadyDetails   struct {
312
                Rate float64 `json:"rate"`
313
        } `json:"messages_ready_details"`
314
        MessagesReady     int `json:"messages_ready"`
315
        ReductionsDetails struct {
316
                Rate float64 `json:"rate"`
317
        } `json:"reductions_details"`
318
        Reductions int    `json:"reductions"`
319
        Node       string `json:"node"`
320
        Arguments  struct {
321
        } `json:"arguments"`
322
        Exclusive            bool   `json:"exclusive"`
323
        AutoDelete           bool   `json:"auto_delete"`
324
        Durable              bool   `json:"durable"`
325
        Vhost                string `json:"vhost"`
326
        Name                 string `json:"name"`
327
        Type                 string `json:"type"`
328
        MessageBytesPagedOut int    `json:"message_bytes_paged_out"`
329
        MessagesPagedOut     int    `json:"messages_paged_out"`
330
        BackingQueueStatus   struct {
331
                Mode string `json:"mode"`
332
                Q1   int    `json:"q1"`
333
                Q2   int    `json:"q2"`
334
                //                Delta             []interface{} `json:"delta"`
335
                Q3  int `json:"q3"`
336
                Q4  int `json:"q4"`
337
                Len int `json:"len"`
338
                //                TargetRAMCount    int     `json:"target_ram_count"`        // string or int -> need further research here when attr is in need ("infinity")
339
                NextSeqID         int     `json:"next_seq_id"`
340
                AvgIngressRate    float64 `json:"avg_ingress_rate"`
341
                AvgEgressRate     float64 `json:"avg_egress_rate"`
342
                AvgAckIngressRate float64 `json:"avg_ack_ingress_rate"`
343
                AvgAckEgressRate  float64 `json:"avg_ack_egress_rate"`
344
        } `json:"backing_queue_status"`
345
        //        HeadMessageTimestamp       interface{} `json:"head_message_timestamp"`
346
        MessageBytesPersistent     int `json:"message_bytes_persistent"`
347
        MessageBytesRAM            int `json:"message_bytes_ram"`
348
        MessageBytesUnacknowledged int `json:"message_bytes_unacknowledged"`
349
        MessageBytesReady          int `json:"message_bytes_ready"`
350
        MessageBytes               int `json:"message_bytes"`
351
        MessagesPersistent         int `json:"messages_persistent"`
352
        MessagesUnacknowledgedRAM  int `json:"messages_unacknowledged_ram"`
353
        MessagesReadyRAM           int `json:"messages_ready_ram"`
354
        MessagesRAM                int `json:"messages_ram"`
355
        GarbageCollection          struct {
356
                MinorGcs        int `json:"minor_gcs"`
357
                FullsweepAfter  int `json:"fullsweep_after"`
358
                MinHeapSize     int `json:"min_heap_size"`
359
                MinBinVheapSize int `json:"min_bin_vheap_size"`
360
                MaxHeapSize     int `json:"max_heap_size"`
361
        } `json:"garbage_collection"`
362
        State string `json:"state"`
363
        //        RecoverableSlaves    interface{} `json:"recoverable_slaves"`
364
        Consumers int `json:"consumers"`
365
        //        ExclusiveConsumerTag interface{} `json:"exclusive_consumer_tag"`
366
        //        Policy               interface{} `json:"policy"`
367
        ConsumerUtilisation float64 `json:"consumer_utilisation"`
368
        // TODO use custom marshaller and parse into time.Time
369
        IdleSince string `json:"idle_since"`
370
        Memory    int    `json:"memory"`
371
}
372

373
// RabbitBinding models the /bindings resource of the rabbitmq http api
374
type RabbitBinding struct {
375
        Source          string                 `json:"source"`
376
        Vhost           string                 `json:"vhost"`
377
        Destination     string                 `json:"destination"`
378
        DestinationType string                 `json:"destination_type"`
379
        RoutingKey      string                 `json:"routing_key"`
380
        Arguments       map[string]interface{} `json:"arguments,omitempty"`
381
        PropertiesKey   string                 `json:"properties_key"`
382
}
383

384
// IsExchangeToExchange returns true if this is an exchange-to-exchange binding
385
func (s RabbitBinding) IsExchangeToExchange() bool {
×
386
        return s.DestinationType == "exchange"
×
387
}
×
388

389
// RabbitExchange models the /exchanges resource of the rabbitmq http api
390
type RabbitExchange struct {
391
        Name         string                 `json:"name"`
392
        Vhost        string                 `json:"vhost"`
393
        Type         string                 `json:"type"`
394
        Durable      bool                   `json:"durable"`
395
        AutoDelete   bool                   `json:"auto_delete"`
396
        Internal     bool                   `json:"internal"`
397
        Arguments    map[string]interface{} `json:"arguments,omitempty"`
398
        MessageStats struct {
399
                PublishOut        int `json:"publish_out"`
400
                PublishOutDetails struct {
401
                        Rate float64 `json:"rate"`
402
                } `json:"publish_out_details"`
403
                PublishIn        int `json:"publish_in"`
404
                PublishInDetails struct {
405
                        Rate float64 `json:"rate"`
406
                } `json:"publish_in_details"`
407
        } `json:"message_stats,omitempty"`
408
}
409

410
type OptInt int
411

412
// ChannelDetails model channel_details in RabbitConsumer
413
type ChannelDetails struct {
414
        PeerHost       string `json:"peer_host"`
415
        PeerPort       OptInt `json:"peer_port"`
416
        ConnectionName string `json:"connection_name"`
417
        User           string `json:"user"`
418
        Number         int    `json:"number"`
419
        Node           string `json:"node"`
420
        Name           string `json:"name"`
421
}
422

423
type ConnectionDetails struct {
424
        PeerHost string `json:"peer_host"`
425
        PeerPort OptInt `json:"peer_port"`
426
        Name     string `json:"name"`
427
}
428

429
// RabbitConsumer models the /consumers resource of the rabbitmq http api
430
type RabbitConsumer struct {
431
        //        Arguments      []interface{} `json:"arguments"`
432
        PrefetchCount  int    `json:"prefetch_count"`
433
        AckRequired    bool   `json:"ack_required"`
434
        Active         bool   `json:"active"`
435
        ActivityStatus string `json:"activity_status"`
436
        Exclusive      bool   `json:"exclusive"`
437
        ConsumerTag    string `json:"consumer_tag"`
438
        // see WORKAROUND above
439
        ChannelDetails ChannelDetails `json:"channel_details,omitempty"`
440
        Queue          struct {
441
                Vhost string `json:"vhost"`
442
                Name  string `json:"name"`
443
        } `json:"queue"`
444
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc