mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-28 12:24:52 +02:00
Show parent name for resource class when showing CA with command line. (#3)
This commit is contained in:
+3
-2
@@ -155,9 +155,10 @@ impl Report for CertAuthInfo {
|
||||
}
|
||||
}
|
||||
|
||||
for info in self.parents().values() {
|
||||
res.push_str(&format!("Parent: {}\n", info));
|
||||
for (name, kind) in self.parents().iter() {
|
||||
res.push_str(&format!("Parent: {}, Kind: {}\n", name, kind));
|
||||
}
|
||||
res.push_str("\n");
|
||||
|
||||
for (name, rc) in self.resources() {
|
||||
res.push_str(&format!("Resource Class: {}\n", name));
|
||||
|
||||
+13
-6
@@ -28,6 +28,7 @@ use crate::commons::eventsourcing::AggregateHistory;
|
||||
use crate::commons::remote::id::IdCert;
|
||||
use crate::commons::util::ext_serde;
|
||||
use crate::daemon::ca::{self, CertAuth, Signer};
|
||||
use commons::api::ParentHandle;
|
||||
|
||||
//------------ ResourceClassName -------------------------------------------
|
||||
|
||||
@@ -1352,7 +1353,7 @@ pub struct CertAuthInfo {
|
||||
handle: Handle,
|
||||
base_repo: RepoInfo,
|
||||
parents: HashMap<Handle, ParentCaContact>,
|
||||
resources: HashMap<ResourceClassName, KeyStateInfo>,
|
||||
resources: HashMap<ResourceClassName, ResourceClassInfo>,
|
||||
children: HashMap<Handle, ChildCaInfo>,
|
||||
route_authorizations: HashSet<RouteAuthorization>,
|
||||
}
|
||||
@@ -1362,7 +1363,7 @@ impl CertAuthInfo {
|
||||
handle: Handle,
|
||||
base_repo: RepoInfo,
|
||||
parents: HashMap<Handle, ParentCaContact>,
|
||||
resources: HashMap<ResourceClassName, KeyStateInfo>,
|
||||
resources: HashMap<ResourceClassName, ResourceClassInfo>,
|
||||
children: HashMap<Handle, ChildCaInfo>,
|
||||
route_authorizations: HashSet<RouteAuthorization>,
|
||||
) -> Self {
|
||||
@@ -1392,7 +1393,7 @@ impl CertAuthInfo {
|
||||
self.parents.get(parent)
|
||||
}
|
||||
|
||||
pub fn resources(&self) -> &HashMap<ResourceClassName, KeyStateInfo> {
|
||||
pub fn resources(&self) -> &HashMap<ResourceClassName, ResourceClassInfo> {
|
||||
&self.resources
|
||||
}
|
||||
|
||||
@@ -1442,20 +1443,23 @@ impl fmt::Display for CertAuthHistory {
|
||||
//------------ KeyStateInfo -------------------------------------------------
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
pub struct KeyStateInfo {
|
||||
pub struct ResourceClassInfo {
|
||||
name_space: String,
|
||||
parent_handle: ParentHandle,
|
||||
keys: ResourceClassKeysInfo,
|
||||
current_objects: CurrentObjects,
|
||||
}
|
||||
|
||||
impl KeyStateInfo {
|
||||
impl ResourceClassInfo {
|
||||
pub fn new(
|
||||
name_space: String,
|
||||
parent_handle: ParentHandle,
|
||||
keys: ResourceClassKeysInfo,
|
||||
current_objects: CurrentObjects,
|
||||
) -> Self {
|
||||
KeyStateInfo {
|
||||
ResourceClassInfo {
|
||||
name_space,
|
||||
parent_handle,
|
||||
keys,
|
||||
current_objects,
|
||||
}
|
||||
@@ -1464,6 +1468,9 @@ impl KeyStateInfo {
|
||||
pub fn name_space(&self) -> &str {
|
||||
&self.name_space
|
||||
}
|
||||
pub fn parent_handle(&self) -> &ParentHandle {
|
||||
&self.parent_handle
|
||||
}
|
||||
pub fn keys(&self) -> &ResourceClassKeysInfo {
|
||||
&self.keys
|
||||
}
|
||||
|
||||
+5
-4
@@ -9,8 +9,8 @@ use rpki::x509::Time;
|
||||
|
||||
use crate::commons::api::{
|
||||
AddedObject, CurrentObject, CurrentObjects, EntitlementClass, HexEncodedHash, IssuanceRequest,
|
||||
IssuanceResponse, IssuedCert, KeyStateInfo, ObjectName, ObjectsDelta, ParentHandle, RcvdCert,
|
||||
ReplacedObject, RepoInfo, RequestResourceLimit, ResourceClassName, ResourceSet, Revocation,
|
||||
IssuanceResponse, IssuedCert, ObjectName, ObjectsDelta, ParentHandle, RcvdCert, ReplacedObject,
|
||||
RepoInfo, RequestResourceLimit, ResourceClassInfo, ResourceClassName, ResourceSet, Revocation,
|
||||
RevocationRequest, RevokedObject, RouteAuthorization, SigningCert, UpdatedObject,
|
||||
WithdrawnObject,
|
||||
};
|
||||
@@ -188,9 +188,10 @@ impl ResourceClass {
|
||||
|
||||
/// Returns a ResourceClassInfo for this, which contains all the
|
||||
/// same data, but which does not have any behaviour.
|
||||
pub fn as_info(&self) -> KeyStateInfo {
|
||||
KeyStateInfo::new(
|
||||
pub fn as_info(&self) -> ResourceClassInfo {
|
||||
ResourceClassInfo::new(
|
||||
self.name_space.clone(),
|
||||
self.parent_handle.clone(),
|
||||
self.key_state.as_info(),
|
||||
self.current_objects(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user