Skip to main content

identity_string

Function identity_string 

Source
pub fn identity_string(id: &ResolvedIdentity) -> String
Expand description

Format a kopia identity string. With a source path: username@hostname:path; without one: username@hostname (kopia’s identity-only form, used for catalog queries that aren’t pinned to a path).

use kopiur_api::{IdentityInputs, resolve_identity, identity_string};

// No PVC => no sourcePath => kopia's identity-only `username@hostname` form.
let inputs = IdentityInputs {
    object_name: "cfg",
    namespace: "ns",
    overrides: None,
    template: None,
    pvc_name: None,
    source_path_override: None,
};
let id = resolve_identity(&inputs).unwrap();
assert_eq!(id.source_path, None);
assert_eq!(identity_string(&id), "cfg@ns");