1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414use rabbitmq_http_client:: blocking_api:: HttpClientError ;
15- use rabbitmq_http_client:: responses:: { HealthCheckFailureDetails , Overview } ;
15+ use rabbitmq_http_client:: responses:: {
16+ ClusterAlarmCheckDetails , HealthCheckFailureDetails , Overview , QuorumCriticalityCheckDetails ,
17+ } ;
1618use reqwest:: StatusCode ;
1719use tabled:: settings:: Panel ;
1820use tabled:: { Table , Tabled } ;
@@ -135,20 +137,18 @@ pub fn failure_details(error: &HttpClientError) -> Table {
135137 } ,
136138 ] ;
137139
138- match details {
139- HealthCheckFailureDetails :: AlarmCheck ( details) => {
140- data. push ( RowOfTwoStrings {
141- key : "reason" ,
142- value : details. reason . as_str ( ) ,
143- } ) ;
144- }
145- HealthCheckFailureDetails :: NodeIsQuorumCritical ( details) => {
146- data. push ( RowOfTwoStrings {
147- key : "reason" ,
148- value : details. reason . as_str ( ) ,
149- } ) ;
140+ let reason = match details {
141+ HealthCheckFailureDetails :: AlarmCheck ( details) => details. reason . clone ( ) ,
142+ HealthCheckFailureDetails :: NodeIsQuorumCritical ( details) => details. reason . clone ( ) ,
143+ HealthCheckFailureDetails :: NoActivePortListener ( details) => details. reason . clone ( ) ,
144+ HealthCheckFailureDetails :: NoActiveProtocolListener ( details) => {
145+ details. reason . clone ( )
150146 }
151147 } ;
148+ data. push ( RowOfTwoStrings {
149+ key : "reason" ,
150+ value : reason. as_str ( ) ,
151+ } ) ;
152152
153153 let tb = Table :: builder ( data) ;
154154 tb. build ( )
@@ -281,6 +281,8 @@ pub fn health_check_failure(
281281 let reason = match details {
282282 HealthCheckFailureDetails :: AlarmCheck ( ref details) => details. reason . clone ( ) ,
283283 HealthCheckFailureDetails :: NodeIsQuorumCritical ( ref details) => details. reason . clone ( ) ,
284+ HealthCheckFailureDetails :: NoActivePortListener ( ref details) => details. reason . clone ( ) ,
285+ HealthCheckFailureDetails :: NoActiveProtocolListener ( ref details) => details. reason . clone ( ) ,
284286 } ;
285287 let code_str = format ! ( "{}" , status_code) ;
286288
@@ -304,24 +306,32 @@ pub fn health_check_failure(
304306 ] ;
305307 let mut tb = Table :: builder ( vec) ;
306308 match details {
307- HealthCheckFailureDetails :: AlarmCheck (
308- rabbitmq_http_client:: responses:: ClusterAlarmCheckDetails { reason : _, alarms } ,
309- ) => {
309+ HealthCheckFailureDetails :: AlarmCheck ( ClusterAlarmCheckDetails { reason : _, alarms } ) => {
310310 for alarm in alarms {
311311 let key = format ! ( "alarm in effect on node {}" , alarm. node) ;
312312 let value = alarm. resource ;
313313 tb. push_record ( [ key. as_str ( ) , value. as_str ( ) ] ) ;
314314 }
315315 }
316- HealthCheckFailureDetails :: NodeIsQuorumCritical (
317- rabbitmq_http_client:: responses:: QuorumCriticalityCheckDetails { reason : _, queues } ,
318- ) => {
316+ HealthCheckFailureDetails :: NodeIsQuorumCritical ( QuorumCriticalityCheckDetails {
317+ reason : _,
318+ queues,
319+ } ) => {
319320 for q in queues {
320321 let key = "affected queue, stream or internal component" ;
321322 let value = q. readable_name ;
322323 tb. push_record ( [ key, value. as_str ( ) ] ) ;
323324 }
324325 }
326+ HealthCheckFailureDetails :: NoActivePortListener ( details) => {
327+ tb. push_record ( [ "inactive port" , details. inactive_port . to_string ( ) . as_str ( ) ] ) ;
328+ }
329+ HealthCheckFailureDetails :: NoActiveProtocolListener ( details) => {
330+ tb. push_record ( [
331+ "inactive protocol" ,
332+ details. inactive_protocol . to_string ( ) . as_str ( ) ,
333+ ] ) ;
334+ }
325335 } ;
326336
327337 tb. build ( )
0 commit comments