Expand description
Iceberg REST API implementation.
The crate provides two REST catalog APIs:
RestCatalogimplements [iceberg::Catalog] by binding one [iceberg::SessionContext] to every operation.RestSessionCatalogimplements [iceberg::SessionCatalog] and accepts a session context with each operation.
§Catalog compatibility API
use std::collections::HashMap;
use iceberg::CatalogBuilder;
use iceberg_catalog_rest::{
REST_CATALOG_PROP_URI, REST_CATALOG_PROP_WAREHOUSE, RestCatalogBuilder,
};
#[tokio::main]
async fn main() {
let catalog = RestCatalogBuilder::default()
.load(
"rest",
HashMap::from([
(
REST_CATALOG_PROP_URI.to_string(),
"http://localhost:8181".to_string(),
),
(
REST_CATALOG_PROP_WAREHOUSE.to_string(),
"s3://warehouse".to_string(),
),
]),
)
.await
.unwrap();
}§Session catalog API
use std::collections::HashMap;
use iceberg::{SessionCatalog, SessionContext};
use iceberg_catalog_rest::{REST_CATALOG_PROP_URI, RestSessionCatalogBuilder};
#[tokio::main]
async fn main() {
let catalog = RestSessionCatalogBuilder::default()
.load(
"rest",
HashMap::from([(
REST_CATALOG_PROP_URI.to_string(),
"http://localhost:8181".to_string(),
)]),
)
.await
.unwrap();
let context = SessionContext::builder()
.identity("user123".to_string())
.build();
let namespaces = catalog.list_namespaces(&context, None).await.unwrap();
}Structs§
- Commit
Table Request - Request to commit updates to a table.
- Commit
Table Response - Response returned when a table is successfully updated.
- Create
Namespace Request - Create namespace request
- Create
Table Request - Request to create a new table in a namespace.
- Endpoint
- A single route a REST server advertises support for, parsed from the
endpointsfield ofGET /v1/config. - Error
Model - Error payload returned in a response with further details on the error
- Error
Response - Wrapper for all non-2xx error responses from the REST API
- Http
Client - The catalog’s HTTP client, handed to an
AuthManagerso its own requests share the catalog’s connection pool and configuration. - Http
Request - An outgoing REST request being authenticated by an
AuthSession. - Http
Response - A REST catalog response, read into memory.
- List
Namespace Response - Response containing a list of namespace identifiers, with optional pagination support.
- List
Tables Response - Response containing a list of table identifiers, with optional pagination support.
- Load
Table Result - Result returned when a table is successfully loaded or created.
- Namespace
Response - Namespace response
- Noop
Auth Manager AuthManagerthat performs no authentication.- OAuth2
Manager AuthManagerimplementing the OAuth2 client-credentials flow used by Iceberg REST catalogs.- Register
Table Request - Request to register a table using an existing metadata file location.
- Rename
Table Request - Request to rename a table from one identifier to another.
- Rest
Catalog - A [
Catalog]-compatible façade overRestSessionCatalog. - Rest
Catalog Builder - Builder for
RestCatalog, the [Catalog]-compatible façade over aRestSessionCatalog. - Rest
Session Catalog - REST catalog implementation of [
SessionCatalog]. - Rest
Session Catalog Builder - Builder for an unbound
RestSessionCatalog. - Storage
Credential - Storage credential for a specific location prefix.
- Update
Namespace Properties Request - Request to update properties on a namespace.
- Update
Namespace Properties Response - Response from updating namespace properties, indicating which properties were changed.
Enums§
- Http
Request Body - The body of an
HttpRequest, as seen by authentication.
Constants§
- AUTH_
TYPE_ NONE rest.auth.typevalue disabling authentication.- AUTH_
TYPE_ OAUT H2 rest.auth.typevalue selecting OAuth2 token authentication.- REST_
CATALOG_ PROP_ AUTH_ TYPE - Authentication scheme:
noneoroauth2. When unset,oauth2is used if atoken,credentialoroauth2-server-uriis configured,noneotherwise. - REST_
CATALOG_ PROP_ DISABLE_ HEADER_ REDACTION - Disable header redaction in error logs and
Debugoutput (defaults to false for security) - REST_
CATALOG_ PROP_ URI - REST catalog URI
- REST_
CATALOG_ PROP_ WAREHOUSE - REST catalog warehouse location
Traits§
- Auth
Manager - Creates the
AuthSessions used to authenticate REST catalog requests. - Auth
Session - Authenticates outgoing REST catalog requests.