in azure-kusto-ingest/src/resource_manager/ingest_client_resources.rs [45:66]
fn get_resource_by_name(table: &TableV1, resource_name: String) -> Result<Vec<ResourceUri>> {
let storage_root_index = get_column_index(table, "StorageRoot")?;
let resource_type_name_index = get_column_index(table, "ResourceTypeName")?;
let resource_uris: Vec<Result<ResourceUri>> = table
.rows
.iter()
.filter(|r| r[resource_type_name_index] == resource_name)
.map(|r| {
let x = r[storage_root_index].as_str().ok_or(
IngestionResourceError::ParseAsStringError(r[storage_root_index].clone()),
)?;
ResourceUri::try_from(x).map_err(IngestionResourceError::ResourceUriError)
})
.collect();
if resource_uris.is_empty() {
return Err(IngestionResourceError::NoResourcesFound(resource_name));
}
resource_uris.into_iter().collect()
}