ic_query_cli/presentation/subnet_catalog/
mod.rs1mod info;
2mod list;
3mod refresh;
4
5pub use crate::presentation::subnet_catalog::info::subnet_catalog_info_report_text;
6pub use crate::presentation::subnet_catalog::list::subnet_catalog_list_report_text;
7pub use crate::presentation::subnet_catalog::refresh::subnet_catalog_refresh_report_text;
8
9use ic_query::subnet_catalog::CacheDisposition;
10use ic_query::subnet_catalog::SubnetCatalogReportMetadata;
11
12pub(super) fn append_catalog_authority(
13 lines: &mut Vec<String>,
14 metadata: &SubnetCatalogReportMetadata,
15 disposition: CacheDisposition,
16) {
17 lines.extend(crate::presentation::text_value::report_fields!(metadata;
18 assurance = metadata.assurance.as_str(),
19 cache_disposition = disposition.as_str(),
20 catalog_digest,
21 source_endpoints = metadata
22 .source_endpoints
23 .join(","),
24 agreement_digest = metadata.agreement_digest.as_deref().unwrap_or("-"),
25 registry_query_call_count,
26 routing_source = metadata.routing_source.as_str(),
27 registry_record_count = metadata.registry_records.len(),
28 ));
29}
30
31pub(super) fn append_catalog_policy(
32 lines: &mut Vec<String>,
33 metadata: &SubnetCatalogReportMetadata,
34) {
35 lines.extend(crate::presentation::text_value::report_fields!(metadata;
36 collector_version,
37 classification_schema_version,
38 classification_policy_digest,
39 resolver_schema_version,
40 resolver_backend,
41 ));
42}
43
44fn compact_principal(value: &str) -> String {
45 crate::presentation::text_value::compact_text(value, 5)
46}