pub struct Connection {
pub id: String,
pub provider_type: ProviderType,
pub display_name: String,
pub base_url: Option<String>,
pub organization: Option<String>,
pub project: Option<String>,
pub repository: Option<String>,
pub username: Option<String>,
pub credential_ref: Option<String>,
pub repo_scope: Option<Vec<String>>,
}Expand description
A configured connection: identity, optional scope, and a reference to the PAT in the secret store (never the secret itself).
Fields§
§id: String§provider_type: ProviderType§display_name: String§base_url: Option<String>§organization: Option<String>§project: Option<String>§repository: Option<String>§username: Option<String>Identity for Basic-auth providers (e.g. Jira email, Bitbucket username).
credential_ref: Option<String>§repo_scope: Option<Vec<String>>The repositories this connection fetches from, connection-relative (acme/pay — see
crate::repo).
Three states, all distinct and all meaningful:
None— never established. Fall back to the legacy singleSelf::repository.Some([])— the user chose no repositories. Fetch nothing; do not refill from the legacy field, or an intentionally-emptied scope silently comes back on the next load.Some([…])— fetch these.
Fallbacks must therefore key on the scope being absent, never on it being empty.
Implementations§
Source§impl Connection
impl Connection
pub fn new_id(provider: ProviderType) -> String
Sourcepub fn resolve_repo_scope(
&self,
legacy: impl FnOnce() -> Option<String>,
) -> Vec<String>
pub fn resolve_repo_scope( &self, legacy: impl FnOnce() -> Option<String>, ) -> Vec<String>
The repositories to fetch from, resolved at factory time so nothing on disk is rewritten:
an explicit scope wins whenever it is Some, and only its absence falls back to the
legacy single repository (via legacy, which each provider spells its own way). An
existing single-repository connection therefore yields a one-element scope and behaves
exactly as before.