pub async fn module_to_container_id(
    mut cri_client: RuntimeServiceClient<tonic::transport::Channel>,
    name: &str,
) -> Result<String> {
    // get the corresponding container_id
    let containers = cri_client
        .list_containers(ListContainersRequest { filter: None })
        .await
        .context(ErrorKind::GrpcUnexpectedErr)?
        .into_inner()
        .containers;
    let container = containers.into_iter().find(|c| {
        name == c
            .metadata
            .as_ref()
            .expect("somehow received a null container metadata response")
            .name
    });
    match container {
        Some(container) => Ok(container.id),
        None => Err(ErrorKind::ModuleDoesNotExist.into()),
    }
}
/// Returns the container_id associated with a moddule name. Returns an error if
/// the module doesn't exist.
Returns the container_id associated with a moddule name. Returns an error if
the module doesn't exist.
Returns the container_id associated with a moddule name . Returns an error if the module doesn ' t exist .
pub async fn module_to_container_id(
    mut cri_client: RuntimeServiceClient<tonic::transport::Channel>,
    name: &str,
) -> Result<String> {
    // get the corresponding container_id
    let containers = cri_client
        .list_containers(ListContainersRequest { filter: None })
        .await
        .context(ErrorKind::GrpcUnexpectedErr)?
        .into_inner()
        .containers;
    let container = containers.into_iter().find(|c| {
        name == c
            .metadata
            .as_ref()
            .expect("somehow received a null container metadata response")
            .name
    });
    match container {
        Some(container) => Ok(container.id),
        None => Err(ErrorKind::ModuleDoesNotExist.into()),
    }
}
pub async fn module_to_container_id ( mut cri_client : RuntimeServiceClient < tonic :: transport :: Channel > , name : & str , ) -> Result < String > { // get the corresponding container_id let containers = cri_client . list_containers ( ListContainersRequest { filter : None } ) . await . context ( ErrorKind :: GrpcUnexpectedErr ) ? . into_inner ( ) . containers ; let container = containers . into_iter ( ) . find ( | c | { name == c . metadata . as_ref ( ) . expect ( " " ) . name } ) ; match container { Some ( container ) => Ok ( container . id ) , None => Err ( ErrorKind :: ModuleDoesNotExist . into ( ) ) , } }
Returns the container_id associated with a moddule name.
Returns the container_id associated with a moddule name .
cri_client
RuntimeServiceClient<tonic::transport::Channel>
name
&str
cri_client
RuntimeServiceClient<tonic::transport::Channel>
name
&str