Skip to main content

HeadwatersClient

Struct HeadwatersClient 

Source
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>

Source

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)).

Source

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).

Source

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>

Source

pub async fn list_namespaces(&self) -> Result<ListNamespacesResponse, Error>

List every namespace.

Source

pub async fn list_jobs( &self, namespace: &str, limit: i32, offset: i32, ) -> Result<ListJobsResponse, Error>

List jobs, optionally scoped to one namespace ("" = all).

Source

pub async fn get_job( &self, namespace: &str, name: &str, ) -> Result<JobDetail, Error>

Get one job by namespace and name.

Source

pub async fn get_job_runs( &self, namespace: &str, name: &str, ) -> Result<ListRunsResponse, Error>

List the runs of one job.

Source

pub async fn list_datasets( &self, namespace: &str, limit: i32, offset: i32, ) -> Result<ListDatasetsResponse, Error>

List datasets, optionally scoped to one namespace ("" = all).

Source

pub async fn get_dataset( &self, namespace: &str, name: &str, ) -> Result<Dataset, Error>

Get one dataset by namespace and name.

Source

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.

Source

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).

Source

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.

Source

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).

Source

pub async fn list_events( &self, limit: i32, offset: i32, ) -> Result<ListEventsResponse, Error>

The raw OpenLineage events feed, newest first.

Source

pub async fn get_run_facets( &self, run_id: &str, ) -> Result<RunFacetsResponse, Error>

The merged facets observed across all of a run’s events.

Source

pub async fn list_tags(&self) -> Result<ListTagsResponse, Error>

List every tag in the catalog.

Source

pub async fn get_tag_downstream( &self, tag: &str, ) -> Result<TagPropagation, Error>

Every field a tag reaches downstream through column lineage.

Source

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.

Source

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>

Source§

fn clone(&self) -> HeadwatersClient<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more