pub struct HeadwatersClient<T = HttpClient>where
T: ClientTransport,{ /* private fields */ }Expand description
An async client for the Headwaters read API.
Construct one from a base URL with connect, from the
environment with from_env, or from a prepared
HeadwatersConfig with new. Each method maps to one read
RPC and returns an owned response message; the open-ended facets / data
fields on those messages are google.protobuf.Struct, which you can turn
into a serde_json::Value with struct_to_json.
§Examples
use headwaters_client::HeadwatersClient;
let client = HeadwatersClient::connect("http://localhost:8091")?;
let namespaces = client.list_namespaces().await?;
for ns in &namespaces.namespaces {
println!("{}", ns.name);
}The transport T defaults to HttpClient (plaintext/TLS over hyper),
which is what connect, new, and
from_env build. With the cloud-auth feature, the
cloud constructors return a client over olai-http’s CloudTransport, which
signs each request for a cloud provider (AWS/Azure/GCP/Databricks).
Implementations§
Source§impl HeadwatersClient<HttpClient>
impl HeadwatersClient<HttpClient>
Sourcepub fn connect(base_url: impl Into<String>) -> Result<Self, Error>
pub fn connect(base_url: impl Into<String>) -> Result<Self, Error>
Connect to a server at base_url (e.g. http://localhost:8091) with
default settings. Shorthand for new(HeadwatersConfig::new(base_url)).
Sourcepub fn new(config: HeadwatersConfig) -> Result<Self, Error>
pub fn new(config: HeadwatersConfig) -> Result<Self, Error>
Build a client from a HeadwatersConfig.
Only http:// base URLs are supported today; an https:// URL returns
Error::InvalidBaseUrl (TLS support is a planned follow-up).
Sourcepub fn from_env() -> Result<Self, Error>
pub fn from_env() -> Result<Self, Error>
Build a client from the environment (HEADWATERS_URL, HEADWATERS_TOKEN,
HEADWATERS_TIMEOUT_MS). See HeadwatersConfig::from_env.
Source§impl<T> HeadwatersClient<T>
impl<T> HeadwatersClient<T>
Sourcepub async fn list_namespaces(&self) -> Result<ListNamespacesResponse, Error>
pub async fn list_namespaces(&self) -> Result<ListNamespacesResponse, Error>
List every namespace.
Sourcepub async fn list_jobs(
&self,
namespace: &str,
limit: i32,
offset: i32,
) -> Result<ListJobsResponse, Error>
pub async fn list_jobs( &self, namespace: &str, limit: i32, offset: i32, ) -> Result<ListJobsResponse, Error>
List jobs, optionally scoped to one namespace ("" = all).
Sourcepub async fn get_job(
&self,
namespace: &str,
name: &str,
) -> Result<JobDetail, Error>
pub async fn get_job( &self, namespace: &str, name: &str, ) -> Result<JobDetail, Error>
Get one job by namespace and name.
Sourcepub async fn get_job_runs(
&self,
namespace: &str,
name: &str,
) -> Result<ListRunsResponse, Error>
pub async fn get_job_runs( &self, namespace: &str, name: &str, ) -> Result<ListRunsResponse, Error>
List the runs of one job.
Sourcepub async fn list_datasets(
&self,
namespace: &str,
limit: i32,
offset: i32,
) -> Result<ListDatasetsResponse, Error>
pub async fn list_datasets( &self, namespace: &str, limit: i32, offset: i32, ) -> Result<ListDatasetsResponse, Error>
List datasets, optionally scoped to one namespace ("" = all).
Sourcepub async fn get_dataset(
&self,
namespace: &str,
name: &str,
) -> Result<Dataset, Error>
pub async fn get_dataset( &self, namespace: &str, name: &str, ) -> Result<Dataset, Error>
Get one dataset by namespace and name.
Sourcepub async fn list_dataset_versions(
&self,
namespace: &str,
name: &str,
limit: i32,
offset: i32,
) -> Result<ListDatasetVersionsResponse, Error>
pub async fn list_dataset_versions( &self, namespace: &str, name: &str, limit: i32, offset: i32, ) -> Result<ListDatasetVersionsResponse, Error>
List the schema versions of one dataset, newest first.
Sourcepub async fn search(
&self,
q: &str,
limit: i32,
kind: EntityKind,
namespace: &str,
) -> Result<SearchResponse, Error>
pub async fn search( &self, q: &str, limit: i32, kind: EntityKind, namespace: &str, ) -> Result<SearchResponse, Error>
Substring search over job and dataset names. kind restricts to one
entity kind (ENTITY_KIND_UNSPECIFIED = both); namespace restricts to
one namespace ("" = all).
Sourcepub async fn get_lineage(
&self,
node_id: &str,
depth: i32,
) -> Result<LineageGraph, Error>
pub async fn get_lineage( &self, node_id: &str, depth: i32, ) -> Result<LineageGraph, Error>
Entity-level lineage: the jobs and datasets within depth hops of the
seed node_id, with the edges between them.
Sourcepub async fn get_column_lineage(
&self,
node_id: &str,
) -> Result<LineageGraph, Error>
pub async fn get_column_lineage( &self, node_id: &str, ) -> Result<LineageGraph, Error>
Column-level lineage for the seed node_id (a dataset: or
datasetField: nodeId).
Sourcepub async fn list_events(
&self,
limit: i32,
offset: i32,
) -> Result<ListEventsResponse, Error>
pub async fn list_events( &self, limit: i32, offset: i32, ) -> Result<ListEventsResponse, Error>
The raw OpenLineage events feed, newest first.
Sourcepub async fn get_run_facets(
&self,
run_id: &str,
) -> Result<RunFacetsResponse, Error>
pub async fn get_run_facets( &self, run_id: &str, ) -> Result<RunFacetsResponse, Error>
The merged facets observed across all of a run’s events.
List every tag in the catalog.
Sourcepub async fn get_tag_downstream(
&self,
tag: &str,
) -> Result<TagPropagation, Error>
pub async fn get_tag_downstream( &self, tag: &str, ) -> Result<TagPropagation, Error>
Every field a tag reaches downstream through column lineage.
Sourcepub async fn get_lineage_event_stats(
&self,
period: &str,
limit: i32,
) -> Result<StatsResponse, Error>
pub async fn get_lineage_event_stats( &self, period: &str, limit: i32, ) -> Result<StatsResponse, Error>
Time-bucketed counts of lineage events. period is HOUR | DAY |
WEEK | MONTH; limit caps the number of buckets.
Sourcepub async fn get_asset_stats(
&self,
asset: &str,
period: &str,
limit: i32,
) -> Result<StatsResponse, Error>
pub async fn get_asset_stats( &self, asset: &str, period: &str, limit: i32, ) -> Result<StatsResponse, Error>
Time-bucketed first-seen counts of an asset kind (jobs | datasets).
Trait Implementations§
Source§impl<T> Clone for HeadwatersClient<T>where
T: ClientTransport + Clone,
impl<T> Clone for HeadwatersClient<T>where
T: ClientTransport + Clone,
Source§fn clone(&self) -> HeadwatersClient<T>
fn clone(&self) -> HeadwatersClient<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more