pub fn fetch_releases(
    registry: &str,
    repo: &str,
    username: Option<&str>,
    password: Option<&str>,
) -> Result<Vec<Release>, Error> {
    let mut tcore = Core::new()?;

    let registry_host = trim_protocol(&registry);

    let mut client = dkregistry::v2::Client::configure(&tcore.handle())
        .registry(registry_host)
        .insecure_registry(false)
        .username(username.map(|s| s.to_string()))
        .password(password.map(|s| s.to_string()))
        .build()
        .map_err(|e| format_err!("{}", e))?;

    let authenticated_client = tcore
        .run(authenticate_client(
            &mut client,
            format!("repository:{}:pull", &repo),
        ))
        .map_err(|e| format_err!("{}", e))?;

    let releases = get_tags(repo.to_owned(), authenticated_client)
        .and_then(|tag| get_manifest_and_layers(tag, repo.to_owned(), authenticated_client))
        .and_then(|(tag, layer_digests)| {
            find_first_release(
                layer_digests,
                authenticated_client.to_owned(),
                registry_host.to_owned(),
                repo.to_owned(),
                tag.to_owned(),
            )
        })
        .collect();

    tcore.run(releases)
}
/// Fetches a vector of all release metadata from the given repository, hosted on the given
/// registry.
Fetches a vector of all release metadata from the given repository, hosted on the given
registry.
Fetches a vector of all release metadata from the given repository hosted on the given registry .
pub fn fetch_releases(
    registry: &str,
    repo: &str,
    username: Option<&str>,
    password: Option<&str>,
) -> Result<Vec<Release>, Error> {
    let mut tcore = Core::new()?;
    let registry_host = trim_protocol(&registry);
    let mut client = dkregistry::v2::Client::configure(&tcore.handle())
        .registry(registry_host)
        .insecure_registry(false)
        .username(username.map(|s| s.to_string()))
        .password(password.map(|s| s.to_string()))
        .build()
        .map_err(|e| format_err!("{}", e))?;
    let authenticated_client = tcore
        .run(authenticate_client(
            &mut client,
            format!("repository:{}:pull", &repo),
        ))
        .map_err(|e| format_err!("{}", e))?;
    let releases = get_tags(repo.to_owned(), authenticated_client)
        .and_then(|tag| get_manifest_and_layers(tag, repo.to_owned(), authenticated_client))
        .and_then(|(tag, layer_digests)| {
            find_first_release(
                layer_digests,
                authenticated_client.to_owned(),
                registry_host.to_owned(),
                repo.to_owned(),
                tag.to_owned(),
            )
        })
        .collect();
    tcore.run(releases)
}
pub fn fetch_releases ( registry : & str , repo : & str , username : Option < & str > , password : Option < & str > , ) -> Result < Vec < Release > , Error > { let mut tcore = Core :: new ( ) ? ; let registry_host = trim_protocol ( & registry ) ; let mut client = dkregistry :: v2 :: Client :: configure ( & tcore . handle ( ) ) . registry ( registry_host ) . insecure_registry ( false ) . username ( username . map ( | s | s . to_string ( ) ) ) . password ( password . map ( | s | s . to_string ( ) ) ) . build ( ) . map_err ( | e | format_err ! ( " " e ) ) ? ; let authenticated_client = tcore . run ( authenticate_client ( & mut client , format ! ( " " repo ) , ) ) . map_err ( | e | format_err ! ( " " e ) ) ? ; let releases = get_tags ( repo . to_owned ( ) , authenticated_client ) . and_then ( | tag | get_manifest_and_layers ( tag , repo . to_owned ( ) , authenticated_client ) ) . and_then ( | ( tag , layer_digests ) | { find_first_release ( layer_digests , authenticated_client . to_owned ( ) , registry_host . to_owned ( ) , repo . to_owned ( ) , tag . to_owned ( ) , ) } ) . collect ( ) ; tcore . run ( releases ) }
Fetches a vector of all release metadata from the given repository, hosted on the given
registry.
Fetches a vector of all release metadata from the given repository hosted on the given registry .
registry
&str
repo
&str
username
Option<&str>
password
Option<&str>
registry
&str
repo
&str
username
Option<&str>
password
Option<&str>