Skip to main content

Crate iceberg_catalog_rest

Crate iceberg_catalog_rest 

Source
Expand description

Iceberg REST API implementation.

The crate provides two REST catalog APIs:

  • RestCatalog implements [iceberg::Catalog] by binding one [iceberg::SessionContext] to every operation.
  • RestSessionCatalog implements [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§

CommitTableRequest
Request to commit updates to a table.
CommitTableResponse
Response returned when a table is successfully updated.
CreateNamespaceRequest
Create namespace request
CreateTableRequest
Request to create a new table in a namespace.
Endpoint
A single route a REST server advertises support for, parsed from the endpoints field of GET /v1/config.
ErrorModel
Error payload returned in a response with further details on the error
ErrorResponse
Wrapper for all non-2xx error responses from the REST API
HttpClient
The catalog’s HTTP client, handed to an AuthManager so its own requests share the catalog’s connection pool and configuration.
HttpRequest
An outgoing REST request being authenticated by an AuthSession.
HttpResponse
A REST catalog response, read into memory.
ListNamespaceResponse
Response containing a list of namespace identifiers, with optional pagination support.
ListTablesResponse
Response containing a list of table identifiers, with optional pagination support.
LoadTableResult
Result returned when a table is successfully loaded or created.
NamespaceResponse
Namespace response
NoopAuthManager
AuthManager that performs no authentication.
OAuth2Manager
AuthManager implementing the OAuth2 client-credentials flow used by Iceberg REST catalogs.
RegisterTableRequest
Request to register a table using an existing metadata file location.
RenameTableRequest
Request to rename a table from one identifier to another.
RestCatalog
A [Catalog]-compatible façade over RestSessionCatalog.
RestCatalogBuilder
Builder for RestCatalog, the [Catalog]-compatible façade over a RestSessionCatalog.
RestSessionCatalog
REST catalog implementation of [SessionCatalog].
RestSessionCatalogBuilder
Builder for an unbound RestSessionCatalog.
StorageCredential
Storage credential for a specific location prefix.
UpdateNamespacePropertiesRequest
Request to update properties on a namespace.
UpdateNamespacePropertiesResponse
Response from updating namespace properties, indicating which properties were changed.

Enums§

HttpRequestBody
The body of an HttpRequest, as seen by authentication.

Constants§

AUTH_TYPE_NONE
rest.auth.type value disabling authentication.
AUTH_TYPE_OAUTH2
rest.auth.type value selecting OAuth2 token authentication.
REST_CATALOG_PROP_AUTH_TYPE
Authentication scheme: none or oauth2. When unset, oauth2 is used if a token, credential or oauth2-server-uri is configured, none otherwise.
REST_CATALOG_PROP_DISABLE_HEADER_REDACTION
Disable header redaction in error logs and Debug output (defaults to false for security)
REST_CATALOG_PROP_URI
REST catalog URI
REST_CATALOG_PROP_WAREHOUSE
REST catalog warehouse location

Traits§

AuthManager
Creates the AuthSessions used to authenticate REST catalog requests.
AuthSession
Authenticates outgoing REST catalog requests.