blackmwk commented on code in PR #3106:
URL: https://github.com/apache/iceberg-rust/pull/3106#discussion_r4717914149


##########
crates/catalog/rest/src/properties.rs:
##########
@@ -0,0 +1,714 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Typed REST catalog properties and property keys.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::str::FromStr;
+use std::sync::OnceLock;
+
+use iceberg::properties::{BoolProp, DurationMsProp, U32Prop};
+use iceberg::sensitive::SensitiveString;
+use iceberg::{Error, ErrorKind, NamespaceIdent, Result, TableIdent};
+use iceberg_property_macro::Properties;
+use itertools::Itertools;
+use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
+
+use crate::auth::{AUTH_TYPE_NONE, AUTH_TYPE_OAUTH2};
+
+/// REST catalog URI
+pub const REST_CATALOG_PROP_URI: &str = "uri";
+/// REST catalog warehouse location
+pub const REST_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
+/// REST catalog endpoint prefix.
+pub const REST_CATALOG_PROP_PREFIX: &str = "prefix";
+/// Bearer token used to authenticate REST catalog requests.
+pub const REST_CATALOG_PROP_TOKEN: &str = "token";
+/// OAuth2 client secret, optionally prefixed by a client ID and colon.
+pub const REST_CATALOG_PROP_CREDENTIAL: &str = "credential";
+/// OAuth2 token endpoint URI.
+pub const REST_CATALOG_PROP_OAUTH2_SERVER_URI: &str = "oauth2-server-uri";
+/// OAuth2 scope requested when exchanging credentials.
+pub const REST_CATALOG_PROP_SCOPE: &str = "scope";
+/// OAuth2 audience requested when exchanging credentials.
+pub const REST_CATALOG_PROP_AUDIENCE: &str = "audience";
+/// OAuth2 resource requested when exchanging credentials.
+pub const REST_CATALOG_PROP_RESOURCE: &str = "resource";
+/// Requested page size for namespace and table listings; see
+/// [`crate::RestSessionCatalogBuilder::with_page_size`].
+pub const REST_CATALOG_PROP_PAGE_SIZE: &str = "rest-page-size";
+/// Disable header redaction in error logs and `Debug` output (defaults to
+/// false for security)
+pub const REST_CATALOG_PROP_DISABLE_HEADER_REDACTION: &str = 
"disable-header-redaction";
+/// Authentication scheme: `none` or `oauth2`. When unset, `oauth2` is used
+/// if a `token`, `credential` or `oauth2-server-uri` is configured, `none`
+/// otherwise.
+pub const REST_CATALOG_PROP_AUTH_TYPE: &str = "rest.auth.type";
+/// Maximum number of loaded tables kept for freshness-aware loading (defaults
+/// to 100; 0 disables the cache). The cache is keyed by session id, so it only
+/// helps callers that reuse a [`iceberg::SessionContext`], and a table 
changed through
+/// this catalog is invalidated only for the session that changed it. Loads 
that
+/// vend short-lived storage credentials are never cached.
+pub const REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES: &str = 
"rest-table-cache.max-entries";
+/// How long a loaded table stays cached for freshness-aware loading, in
+/// milliseconds (defaults to 5 minutes; must be positive and at most 1000 
years).
+pub const REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS: &str =
+    "rest-table-cache.expire-after-write-ms";
+
+const REST_CATALOG_PROP_HEADER_PREFIX: &str = "header.";
+
+const TABLE_CACHE_MAX_ENTRIES_DEFAULT: u64 = 100;
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT: u64 = 5 * 60 * 1000;
+/// moka panics on a time-to-live beyond 1000 years.
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS: u64 = 1000 * 365 * 24 * 3600 * 
1000;
+
+const ICEBERG_REST_SPEC_VERSION: &str = "0.14.1";
+const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+const PATH_V1: &str = "v1";
+
+/// Typed REST catalog properties.
+// PartialEq supports whole-configuration assertions in parsing tests.
+#[derive(Clone, Properties, PartialEq)]
+pub(crate) struct RestCatalogProperties {
+    /// Catalog URI.
+    #[property(key = REST_CATALOG_PROP_URI, default = "", getter)]
+    uri: String,
+    /// Warehouse location or identifier.
+    #[property(key = REST_CATALOG_PROP_WAREHOUSE, default = None, getter)]
+    warehouse: Option<String>,
+    /// Catalog endpoint prefix.
+    #[property(key = REST_CATALOG_PROP_PREFIX, default = None, getter)]
+    prefix: Option<String>,
+    /// Explicit authentication scheme.
+    #[property(key = REST_CATALOG_PROP_AUTH_TYPE, default = None, getter)]
+    auth_type: Option<AuthType>,
+    /// Configured bearer token.
+    #[property(key = REST_CATALOG_PROP_TOKEN, default = None, getter)]
+    token: Option<SensitiveString>,
+    /// Configured OAuth2 client ID and secret.
+    #[property(key = REST_CATALOG_PROP_CREDENTIAL, default = None, getter)]
+    credential: Option<OAuth2Credential>,
+    /// Explicit OAuth2 token endpoint.
+    #[property(key = REST_CATALOG_PROP_OAUTH2_SERVER_URI, default = None, 
getter)]
+    oauth2_server_uri: Option<String>,
+    /// Explicit OAuth2 scope.
+    #[property(key = REST_CATALOG_PROP_SCOPE, default = None, getter)]
+    scope: Option<String>,
+    /// OAuth2 audience.
+    #[property(key = REST_CATALOG_PROP_AUDIENCE, default = None, getter)]
+    audience: Option<String>,
+    /// OAuth2 resource.
+    #[property(key = REST_CATALOG_PROP_RESOURCE, default = None, getter)]
+    resource: Option<String>,
+    /// Explicit headers added to requests.
+    #[property(nested, getter)]
+    headers: RestHeaders,
+    /// Lazily initialized catalog endpoints.
+    #[property(nested, getter)]
+    endpoint_cache: RestEndpointCache,
+    /// Whether header redaction is disabled.
+    #[property(
+        key = REST_CATALOG_PROP_DISABLE_HEADER_REDACTION,
+        default = BoolProp::from(false),
+        getter
+    )]
+    disable_header_redaction: BoolProp,

Review Comment:
   No, just keep it bool. Remove `BoolProp`



##########
crates/catalog/rest/src/properties.rs:
##########
@@ -0,0 +1,714 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Typed REST catalog properties and property keys.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::str::FromStr;
+use std::sync::OnceLock;
+
+use iceberg::properties::{BoolProp, DurationMsProp, U32Prop};
+use iceberg::sensitive::SensitiveString;
+use iceberg::{Error, ErrorKind, NamespaceIdent, Result, TableIdent};
+use iceberg_property_macro::Properties;
+use itertools::Itertools;
+use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
+
+use crate::auth::{AUTH_TYPE_NONE, AUTH_TYPE_OAUTH2};
+
+/// REST catalog URI
+pub const REST_CATALOG_PROP_URI: &str = "uri";
+/// REST catalog warehouse location
+pub const REST_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
+/// REST catalog endpoint prefix.
+pub const REST_CATALOG_PROP_PREFIX: &str = "prefix";
+/// Bearer token used to authenticate REST catalog requests.
+pub const REST_CATALOG_PROP_TOKEN: &str = "token";
+/// OAuth2 client secret, optionally prefixed by a client ID and colon.
+pub const REST_CATALOG_PROP_CREDENTIAL: &str = "credential";
+/// OAuth2 token endpoint URI.
+pub const REST_CATALOG_PROP_OAUTH2_SERVER_URI: &str = "oauth2-server-uri";
+/// OAuth2 scope requested when exchanging credentials.
+pub const REST_CATALOG_PROP_SCOPE: &str = "scope";
+/// OAuth2 audience requested when exchanging credentials.
+pub const REST_CATALOG_PROP_AUDIENCE: &str = "audience";
+/// OAuth2 resource requested when exchanging credentials.
+pub const REST_CATALOG_PROP_RESOURCE: &str = "resource";
+/// Requested page size for namespace and table listings; see
+/// [`crate::RestSessionCatalogBuilder::with_page_size`].
+pub const REST_CATALOG_PROP_PAGE_SIZE: &str = "rest-page-size";
+/// Disable header redaction in error logs and `Debug` output (defaults to
+/// false for security)
+pub const REST_CATALOG_PROP_DISABLE_HEADER_REDACTION: &str = 
"disable-header-redaction";
+/// Authentication scheme: `none` or `oauth2`. When unset, `oauth2` is used
+/// if a `token`, `credential` or `oauth2-server-uri` is configured, `none`
+/// otherwise.
+pub const REST_CATALOG_PROP_AUTH_TYPE: &str = "rest.auth.type";
+/// Maximum number of loaded tables kept for freshness-aware loading (defaults
+/// to 100; 0 disables the cache). The cache is keyed by session id, so it only
+/// helps callers that reuse a [`iceberg::SessionContext`], and a table 
changed through
+/// this catalog is invalidated only for the session that changed it. Loads 
that
+/// vend short-lived storage credentials are never cached.
+pub const REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES: &str = 
"rest-table-cache.max-entries";
+/// How long a loaded table stays cached for freshness-aware loading, in
+/// milliseconds (defaults to 5 minutes; must be positive and at most 1000 
years).
+pub const REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS: &str =
+    "rest-table-cache.expire-after-write-ms";
+
+const REST_CATALOG_PROP_HEADER_PREFIX: &str = "header.";
+
+const TABLE_CACHE_MAX_ENTRIES_DEFAULT: u64 = 100;
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT: u64 = 5 * 60 * 1000;
+/// moka panics on a time-to-live beyond 1000 years.
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS: u64 = 1000 * 365 * 24 * 3600 * 
1000;
+
+const ICEBERG_REST_SPEC_VERSION: &str = "0.14.1";
+const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+const PATH_V1: &str = "v1";
+
+/// Typed REST catalog properties.
+// PartialEq supports whole-configuration assertions in parsing tests.
+#[derive(Clone, Properties, PartialEq)]
+pub(crate) struct RestCatalogProperties {
+    /// Catalog URI.
+    #[property(key = REST_CATALOG_PROP_URI, default = "", getter)]
+    uri: String,
+    /// Warehouse location or identifier.
+    #[property(key = REST_CATALOG_PROP_WAREHOUSE, default = None, getter)]
+    warehouse: Option<String>,
+    /// Catalog endpoint prefix.
+    #[property(key = REST_CATALOG_PROP_PREFIX, default = None, getter)]
+    prefix: Option<String>,
+    /// Explicit authentication scheme.
+    #[property(key = REST_CATALOG_PROP_AUTH_TYPE, default = None, getter)]
+    auth_type: Option<AuthType>,
+    /// Configured bearer token.
+    #[property(key = REST_CATALOG_PROP_TOKEN, default = None, getter)]
+    token: Option<SensitiveString>,
+    /// Configured OAuth2 client ID and secret.
+    #[property(key = REST_CATALOG_PROP_CREDENTIAL, default = None, getter)]
+    credential: Option<OAuth2Credential>,
+    /// Explicit OAuth2 token endpoint.
+    #[property(key = REST_CATALOG_PROP_OAUTH2_SERVER_URI, default = None, 
getter)]
+    oauth2_server_uri: Option<String>,
+    /// Explicit OAuth2 scope.
+    #[property(key = REST_CATALOG_PROP_SCOPE, default = None, getter)]
+    scope: Option<String>,
+    /// OAuth2 audience.
+    #[property(key = REST_CATALOG_PROP_AUDIENCE, default = None, getter)]
+    audience: Option<String>,
+    /// OAuth2 resource.
+    #[property(key = REST_CATALOG_PROP_RESOURCE, default = None, getter)]
+    resource: Option<String>,
+    /// Explicit headers added to requests.
+    #[property(nested, getter)]
+    headers: RestHeaders,
+    /// Lazily initialized catalog endpoints.
+    #[property(nested, getter)]
+    endpoint_cache: RestEndpointCache,

Review Comment:
   It should not be in this struct, it should be in `RestCatalog`



##########
crates/catalog/rest/src/properties.rs:
##########
@@ -0,0 +1,714 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Typed REST catalog properties and property keys.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::str::FromStr;
+use std::sync::OnceLock;
+
+use iceberg::properties::{BoolProp, DurationMsProp, U32Prop};
+use iceberg::sensitive::SensitiveString;
+use iceberg::{Error, ErrorKind, NamespaceIdent, Result, TableIdent};
+use iceberg_property_macro::Properties;
+use itertools::Itertools;
+use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
+
+use crate::auth::{AUTH_TYPE_NONE, AUTH_TYPE_OAUTH2};
+
+/// REST catalog URI
+pub const REST_CATALOG_PROP_URI: &str = "uri";
+/// REST catalog warehouse location
+pub const REST_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
+/// REST catalog endpoint prefix.
+pub const REST_CATALOG_PROP_PREFIX: &str = "prefix";
+/// Bearer token used to authenticate REST catalog requests.
+pub const REST_CATALOG_PROP_TOKEN: &str = "token";
+/// OAuth2 client secret, optionally prefixed by a client ID and colon.
+pub const REST_CATALOG_PROP_CREDENTIAL: &str = "credential";
+/// OAuth2 token endpoint URI.
+pub const REST_CATALOG_PROP_OAUTH2_SERVER_URI: &str = "oauth2-server-uri";
+/// OAuth2 scope requested when exchanging credentials.
+pub const REST_CATALOG_PROP_SCOPE: &str = "scope";
+/// OAuth2 audience requested when exchanging credentials.
+pub const REST_CATALOG_PROP_AUDIENCE: &str = "audience";
+/// OAuth2 resource requested when exchanging credentials.
+pub const REST_CATALOG_PROP_RESOURCE: &str = "resource";
+/// Requested page size for namespace and table listings; see
+/// [`crate::RestSessionCatalogBuilder::with_page_size`].
+pub const REST_CATALOG_PROP_PAGE_SIZE: &str = "rest-page-size";
+/// Disable header redaction in error logs and `Debug` output (defaults to
+/// false for security)
+pub const REST_CATALOG_PROP_DISABLE_HEADER_REDACTION: &str = 
"disable-header-redaction";
+/// Authentication scheme: `none` or `oauth2`. When unset, `oauth2` is used
+/// if a `token`, `credential` or `oauth2-server-uri` is configured, `none`
+/// otherwise.
+pub const REST_CATALOG_PROP_AUTH_TYPE: &str = "rest.auth.type";
+/// Maximum number of loaded tables kept for freshness-aware loading (defaults
+/// to 100; 0 disables the cache). The cache is keyed by session id, so it only
+/// helps callers that reuse a [`iceberg::SessionContext`], and a table 
changed through
+/// this catalog is invalidated only for the session that changed it. Loads 
that
+/// vend short-lived storage credentials are never cached.
+pub const REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES: &str = 
"rest-table-cache.max-entries";
+/// How long a loaded table stays cached for freshness-aware loading, in
+/// milliseconds (defaults to 5 minutes; must be positive and at most 1000 
years).
+pub const REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS: &str =
+    "rest-table-cache.expire-after-write-ms";
+
+const REST_CATALOG_PROP_HEADER_PREFIX: &str = "header.";
+
+const TABLE_CACHE_MAX_ENTRIES_DEFAULT: u64 = 100;
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT: u64 = 5 * 60 * 1000;
+/// moka panics on a time-to-live beyond 1000 years.
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS: u64 = 1000 * 365 * 24 * 3600 * 
1000;
+
+const ICEBERG_REST_SPEC_VERSION: &str = "0.14.1";
+const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+const PATH_V1: &str = "v1";
+
+/// Typed REST catalog properties.
+// PartialEq supports whole-configuration assertions in parsing tests.
+#[derive(Clone, Properties, PartialEq)]
+pub(crate) struct RestCatalogProperties {
+    /// Catalog URI.
+    #[property(key = REST_CATALOG_PROP_URI, default = "", getter)]
+    uri: String,
+    /// Warehouse location or identifier.
+    #[property(key = REST_CATALOG_PROP_WAREHOUSE, default = None, getter)]
+    warehouse: Option<String>,
+    /// Catalog endpoint prefix.
+    #[property(key = REST_CATALOG_PROP_PREFIX, default = None, getter)]
+    prefix: Option<String>,
+    /// Explicit authentication scheme.
+    #[property(key = REST_CATALOG_PROP_AUTH_TYPE, default = None, getter)]
+    auth_type: Option<AuthType>,
+    /// Configured bearer token.
+    #[property(key = REST_CATALOG_PROP_TOKEN, default = None, getter)]
+    token: Option<SensitiveString>,
+    /// Configured OAuth2 client ID and secret.
+    #[property(key = REST_CATALOG_PROP_CREDENTIAL, default = None, getter)]
+    credential: Option<OAuth2Credential>,
+    /// Explicit OAuth2 token endpoint.
+    #[property(key = REST_CATALOG_PROP_OAUTH2_SERVER_URI, default = None, 
getter)]
+    oauth2_server_uri: Option<String>,
+    /// Explicit OAuth2 scope.
+    #[property(key = REST_CATALOG_PROP_SCOPE, default = None, getter)]
+    scope: Option<String>,
+    /// OAuth2 audience.
+    #[property(key = REST_CATALOG_PROP_AUDIENCE, default = None, getter)]
+    audience: Option<String>,
+    /// OAuth2 resource.
+    #[property(key = REST_CATALOG_PROP_RESOURCE, default = None, getter)]
+    resource: Option<String>,

Review Comment:
   These are all oauth related stuff, and I think it should be recognized and 
managed by AuthManager.



##########
crates/catalog/rest/src/properties.rs:
##########
@@ -0,0 +1,714 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Typed REST catalog properties and property keys.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::str::FromStr;
+use std::sync::OnceLock;
+
+use iceberg::properties::{BoolProp, DurationMsProp, U32Prop};
+use iceberg::sensitive::SensitiveString;
+use iceberg::{Error, ErrorKind, NamespaceIdent, Result, TableIdent};
+use iceberg_property_macro::Properties;
+use itertools::Itertools;
+use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
+
+use crate::auth::{AUTH_TYPE_NONE, AUTH_TYPE_OAUTH2};
+
+/// REST catalog URI
+pub const REST_CATALOG_PROP_URI: &str = "uri";
+/// REST catalog warehouse location
+pub const REST_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
+/// REST catalog endpoint prefix.
+pub const REST_CATALOG_PROP_PREFIX: &str = "prefix";
+/// Bearer token used to authenticate REST catalog requests.
+pub const REST_CATALOG_PROP_TOKEN: &str = "token";
+/// OAuth2 client secret, optionally prefixed by a client ID and colon.
+pub const REST_CATALOG_PROP_CREDENTIAL: &str = "credential";
+/// OAuth2 token endpoint URI.
+pub const REST_CATALOG_PROP_OAUTH2_SERVER_URI: &str = "oauth2-server-uri";
+/// OAuth2 scope requested when exchanging credentials.
+pub const REST_CATALOG_PROP_SCOPE: &str = "scope";
+/// OAuth2 audience requested when exchanging credentials.
+pub const REST_CATALOG_PROP_AUDIENCE: &str = "audience";
+/// OAuth2 resource requested when exchanging credentials.
+pub const REST_CATALOG_PROP_RESOURCE: &str = "resource";
+/// Requested page size for namespace and table listings; see
+/// [`crate::RestSessionCatalogBuilder::with_page_size`].
+pub const REST_CATALOG_PROP_PAGE_SIZE: &str = "rest-page-size";
+/// Disable header redaction in error logs and `Debug` output (defaults to
+/// false for security)
+pub const REST_CATALOG_PROP_DISABLE_HEADER_REDACTION: &str = 
"disable-header-redaction";
+/// Authentication scheme: `none` or `oauth2`. When unset, `oauth2` is used
+/// if a `token`, `credential` or `oauth2-server-uri` is configured, `none`
+/// otherwise.
+pub const REST_CATALOG_PROP_AUTH_TYPE: &str = "rest.auth.type";
+/// Maximum number of loaded tables kept for freshness-aware loading (defaults
+/// to 100; 0 disables the cache). The cache is keyed by session id, so it only
+/// helps callers that reuse a [`iceberg::SessionContext`], and a table 
changed through
+/// this catalog is invalidated only for the session that changed it. Loads 
that
+/// vend short-lived storage credentials are never cached.
+pub const REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES: &str = 
"rest-table-cache.max-entries";
+/// How long a loaded table stays cached for freshness-aware loading, in
+/// milliseconds (defaults to 5 minutes; must be positive and at most 1000 
years).
+pub const REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS: &str =
+    "rest-table-cache.expire-after-write-ms";
+
+const REST_CATALOG_PROP_HEADER_PREFIX: &str = "header.";
+
+const TABLE_CACHE_MAX_ENTRIES_DEFAULT: u64 = 100;
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT: u64 = 5 * 60 * 1000;
+/// moka panics on a time-to-live beyond 1000 years.
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS: u64 = 1000 * 365 * 24 * 3600 * 
1000;
+
+const ICEBERG_REST_SPEC_VERSION: &str = "0.14.1";
+const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+const PATH_V1: &str = "v1";
+
+/// Typed REST catalog properties.
+// PartialEq supports whole-configuration assertions in parsing tests.
+#[derive(Clone, Properties, PartialEq)]
+pub(crate) struct RestCatalogProperties {
+    /// Catalog URI.
+    #[property(key = REST_CATALOG_PROP_URI, default = "", getter)]
+    uri: String,
+    /// Warehouse location or identifier.
+    #[property(key = REST_CATALOG_PROP_WAREHOUSE, default = None, getter)]
+    warehouse: Option<String>,
+    /// Catalog endpoint prefix.
+    #[property(key = REST_CATALOG_PROP_PREFIX, default = None, getter)]
+    prefix: Option<String>,
+    /// Explicit authentication scheme.
+    #[property(key = REST_CATALOG_PROP_AUTH_TYPE, default = None, getter)]
+    auth_type: Option<AuthType>,
+    /// Configured bearer token.
+    #[property(key = REST_CATALOG_PROP_TOKEN, default = None, getter)]
+    token: Option<SensitiveString>,
+    /// Configured OAuth2 client ID and secret.
+    #[property(key = REST_CATALOG_PROP_CREDENTIAL, default = None, getter)]
+    credential: Option<OAuth2Credential>,
+    /// Explicit OAuth2 token endpoint.
+    #[property(key = REST_CATALOG_PROP_OAUTH2_SERVER_URI, default = None, 
getter)]
+    oauth2_server_uri: Option<String>,
+    /// Explicit OAuth2 scope.
+    #[property(key = REST_CATALOG_PROP_SCOPE, default = None, getter)]
+    scope: Option<String>,
+    /// OAuth2 audience.
+    #[property(key = REST_CATALOG_PROP_AUDIENCE, default = None, getter)]
+    audience: Option<String>,
+    /// OAuth2 resource.
+    #[property(key = REST_CATALOG_PROP_RESOURCE, default = None, getter)]
+    resource: Option<String>,
+    /// Explicit headers added to requests.
+    #[property(nested, getter)]
+    headers: RestHeaders,
+    /// Lazily initialized catalog endpoints.
+    #[property(nested, getter)]
+    endpoint_cache: RestEndpointCache,
+    /// Whether header redaction is disabled.
+    #[property(
+        key = REST_CATALOG_PROP_DISABLE_HEADER_REDACTION,
+        default = BoolProp::from(false),
+        getter
+    )]
+    disable_header_redaction: BoolProp,
+    /// Requested page size for namespace and table listings.
+    #[property(key = REST_CATALOG_PROP_PAGE_SIZE, default = None, getter)]
+    page_size: Option<U32Prop<1, { i32::MAX as u32 }>>,
+    /// Maximum number of cached tables.
+    #[property(key = REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES, default = 
TABLE_CACHE_MAX_ENTRIES_DEFAULT, getter)]
+    table_cache_max_entries: u64,
+    /// How long a loaded table stays cached.
+    #[property(
+        key = REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS,
+        default = 
DurationMsProp::try_from(TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT).unwrap(),
+        getter
+    )]
+    table_cache_expire_after_write: DurationMsProp<1, 
TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS>,

Review Comment:
   Similarly, just Duration



##########
crates/catalog/rest/src/properties.rs:
##########
@@ -0,0 +1,714 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Typed REST catalog properties and property keys.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::str::FromStr;
+use std::sync::OnceLock;
+
+use iceberg::properties::{BoolProp, DurationMsProp, U32Prop};
+use iceberg::sensitive::SensitiveString;
+use iceberg::{Error, ErrorKind, NamespaceIdent, Result, TableIdent};
+use iceberg_property_macro::Properties;
+use itertools::Itertools;
+use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
+
+use crate::auth::{AUTH_TYPE_NONE, AUTH_TYPE_OAUTH2};
+
+/// REST catalog URI
+pub const REST_CATALOG_PROP_URI: &str = "uri";
+/// REST catalog warehouse location
+pub const REST_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
+/// REST catalog endpoint prefix.
+pub const REST_CATALOG_PROP_PREFIX: &str = "prefix";
+/// Bearer token used to authenticate REST catalog requests.
+pub const REST_CATALOG_PROP_TOKEN: &str = "token";
+/// OAuth2 client secret, optionally prefixed by a client ID and colon.
+pub const REST_CATALOG_PROP_CREDENTIAL: &str = "credential";
+/// OAuth2 token endpoint URI.
+pub const REST_CATALOG_PROP_OAUTH2_SERVER_URI: &str = "oauth2-server-uri";
+/// OAuth2 scope requested when exchanging credentials.
+pub const REST_CATALOG_PROP_SCOPE: &str = "scope";
+/// OAuth2 audience requested when exchanging credentials.
+pub const REST_CATALOG_PROP_AUDIENCE: &str = "audience";
+/// OAuth2 resource requested when exchanging credentials.
+pub const REST_CATALOG_PROP_RESOURCE: &str = "resource";
+/// Requested page size for namespace and table listings; see
+/// [`crate::RestSessionCatalogBuilder::with_page_size`].
+pub const REST_CATALOG_PROP_PAGE_SIZE: &str = "rest-page-size";
+/// Disable header redaction in error logs and `Debug` output (defaults to
+/// false for security)
+pub const REST_CATALOG_PROP_DISABLE_HEADER_REDACTION: &str = 
"disable-header-redaction";
+/// Authentication scheme: `none` or `oauth2`. When unset, `oauth2` is used
+/// if a `token`, `credential` or `oauth2-server-uri` is configured, `none`
+/// otherwise.
+pub const REST_CATALOG_PROP_AUTH_TYPE: &str = "rest.auth.type";
+/// Maximum number of loaded tables kept for freshness-aware loading (defaults
+/// to 100; 0 disables the cache). The cache is keyed by session id, so it only
+/// helps callers that reuse a [`iceberg::SessionContext`], and a table 
changed through
+/// this catalog is invalidated only for the session that changed it. Loads 
that
+/// vend short-lived storage credentials are never cached.
+pub const REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES: &str = 
"rest-table-cache.max-entries";
+/// How long a loaded table stays cached for freshness-aware loading, in
+/// milliseconds (defaults to 5 minutes; must be positive and at most 1000 
years).
+pub const REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS: &str =
+    "rest-table-cache.expire-after-write-ms";
+
+const REST_CATALOG_PROP_HEADER_PREFIX: &str = "header.";
+
+const TABLE_CACHE_MAX_ENTRIES_DEFAULT: u64 = 100;
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT: u64 = 5 * 60 * 1000;
+/// moka panics on a time-to-live beyond 1000 years.
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS: u64 = 1000 * 365 * 24 * 3600 * 
1000;
+
+const ICEBERG_REST_SPEC_VERSION: &str = "0.14.1";
+const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+const PATH_V1: &str = "v1";
+
+/// Typed REST catalog properties.
+// PartialEq supports whole-configuration assertions in parsing tests.
+#[derive(Clone, Properties, PartialEq)]
+pub(crate) struct RestCatalogProperties {
+    /// Catalog URI.
+    #[property(key = REST_CATALOG_PROP_URI, default = "", getter)]
+    uri: String,
+    /// Warehouse location or identifier.
+    #[property(key = REST_CATALOG_PROP_WAREHOUSE, default = None, getter)]
+    warehouse: Option<String>,
+    /// Catalog endpoint prefix.
+    #[property(key = REST_CATALOG_PROP_PREFIX, default = None, getter)]
+    prefix: Option<String>,
+    /// Explicit authentication scheme.
+    #[property(key = REST_CATALOG_PROP_AUTH_TYPE, default = None, getter)]
+    auth_type: Option<AuthType>,

Review Comment:
   I think by default it should be AuthTYpe::None?



##########
crates/catalog/rest/src/properties.rs:
##########
@@ -0,0 +1,714 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Typed REST catalog properties and property keys.
+
+use std::collections::HashMap;
+use std::fmt::{Debug, Formatter};
+use std::str::FromStr;
+use std::sync::OnceLock;
+
+use iceberg::properties::{BoolProp, DurationMsProp, U32Prop};
+use iceberg::sensitive::SensitiveString;
+use iceberg::{Error, ErrorKind, NamespaceIdent, Result, TableIdent};
+use iceberg_property_macro::Properties;
+use itertools::Itertools;
+use reqwest::header::{self, HeaderMap, HeaderName, HeaderValue};
+
+use crate::auth::{AUTH_TYPE_NONE, AUTH_TYPE_OAUTH2};
+
+/// REST catalog URI
+pub const REST_CATALOG_PROP_URI: &str = "uri";
+/// REST catalog warehouse location
+pub const REST_CATALOG_PROP_WAREHOUSE: &str = "warehouse";
+/// REST catalog endpoint prefix.
+pub const REST_CATALOG_PROP_PREFIX: &str = "prefix";
+/// Bearer token used to authenticate REST catalog requests.
+pub const REST_CATALOG_PROP_TOKEN: &str = "token";
+/// OAuth2 client secret, optionally prefixed by a client ID and colon.
+pub const REST_CATALOG_PROP_CREDENTIAL: &str = "credential";
+/// OAuth2 token endpoint URI.
+pub const REST_CATALOG_PROP_OAUTH2_SERVER_URI: &str = "oauth2-server-uri";
+/// OAuth2 scope requested when exchanging credentials.
+pub const REST_CATALOG_PROP_SCOPE: &str = "scope";
+/// OAuth2 audience requested when exchanging credentials.
+pub const REST_CATALOG_PROP_AUDIENCE: &str = "audience";
+/// OAuth2 resource requested when exchanging credentials.
+pub const REST_CATALOG_PROP_RESOURCE: &str = "resource";
+/// Requested page size for namespace and table listings; see
+/// [`crate::RestSessionCatalogBuilder::with_page_size`].
+pub const REST_CATALOG_PROP_PAGE_SIZE: &str = "rest-page-size";
+/// Disable header redaction in error logs and `Debug` output (defaults to
+/// false for security)
+pub const REST_CATALOG_PROP_DISABLE_HEADER_REDACTION: &str = 
"disable-header-redaction";
+/// Authentication scheme: `none` or `oauth2`. When unset, `oauth2` is used
+/// if a `token`, `credential` or `oauth2-server-uri` is configured, `none`
+/// otherwise.
+pub const REST_CATALOG_PROP_AUTH_TYPE: &str = "rest.auth.type";
+/// Maximum number of loaded tables kept for freshness-aware loading (defaults
+/// to 100; 0 disables the cache). The cache is keyed by session id, so it only
+/// helps callers that reuse a [`iceberg::SessionContext`], and a table 
changed through
+/// this catalog is invalidated only for the session that changed it. Loads 
that
+/// vend short-lived storage credentials are never cached.
+pub const REST_CATALOG_PROP_TABLE_CACHE_MAX_ENTRIES: &str = 
"rest-table-cache.max-entries";
+/// How long a loaded table stays cached for freshness-aware loading, in
+/// milliseconds (defaults to 5 minutes; must be positive and at most 1000 
years).
+pub const REST_CATALOG_PROP_TABLE_CACHE_EXPIRE_AFTER_WRITE_MS: &str =
+    "rest-table-cache.expire-after-write-ms";
+
+const REST_CATALOG_PROP_HEADER_PREFIX: &str = "header.";
+
+const TABLE_CACHE_MAX_ENTRIES_DEFAULT: u64 = 100;
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MS_DEFAULT: u64 = 5 * 60 * 1000;
+/// moka panics on a time-to-live beyond 1000 years.
+const TABLE_CACHE_EXPIRE_AFTER_WRITE_MAX_MS: u64 = 1000 * 365 * 24 * 3600 * 
1000;
+
+const ICEBERG_REST_SPEC_VERSION: &str = "0.14.1";
+const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
+const PATH_V1: &str = "v1";
+
+/// Typed REST catalog properties.
+// PartialEq supports whole-configuration assertions in parsing tests.
+#[derive(Clone, Properties, PartialEq)]
+pub(crate) struct RestCatalogProperties {
+    /// Catalog URI.
+    #[property(key = REST_CATALOG_PROP_URI, default = "", getter)]
+    uri: String,
+    /// Warehouse location or identifier.
+    #[property(key = REST_CATALOG_PROP_WAREHOUSE, default = None, getter)]
+    warehouse: Option<String>,
+    /// Catalog endpoint prefix.
+    #[property(key = REST_CATALOG_PROP_PREFIX, default = None, getter)]
+    prefix: Option<String>,
+    /// Explicit authentication scheme.
+    #[property(key = REST_CATALOG_PROP_AUTH_TYPE, default = None, getter)]
+    auth_type: Option<AuthType>,
+    /// Configured bearer token.
+    #[property(key = REST_CATALOG_PROP_TOKEN, default = None, getter)]
+    token: Option<SensitiveString>,
+    /// Configured OAuth2 client ID and secret.
+    #[property(key = REST_CATALOG_PROP_CREDENTIAL, default = None, getter)]
+    credential: Option<OAuth2Credential>,
+    /// Explicit OAuth2 token endpoint.
+    #[property(key = REST_CATALOG_PROP_OAUTH2_SERVER_URI, default = None, 
getter)]
+    oauth2_server_uri: Option<String>,
+    /// Explicit OAuth2 scope.
+    #[property(key = REST_CATALOG_PROP_SCOPE, default = None, getter)]
+    scope: Option<String>,
+    /// OAuth2 audience.
+    #[property(key = REST_CATALOG_PROP_AUDIENCE, default = None, getter)]
+    audience: Option<String>,
+    /// OAuth2 resource.
+    #[property(key = REST_CATALOG_PROP_RESOURCE, default = None, getter)]
+    resource: Option<String>,
+    /// Explicit headers added to requests.
+    #[property(nested, getter)]
+    headers: RestHeaders,
+    /// Lazily initialized catalog endpoints.
+    #[property(nested, getter)]
+    endpoint_cache: RestEndpointCache,
+    /// Whether header redaction is disabled.
+    #[property(
+        key = REST_CATALOG_PROP_DISABLE_HEADER_REDACTION,
+        default = BoolProp::from(false),
+        getter
+    )]
+    disable_header_redaction: BoolProp,
+    /// Requested page size for namespace and table listings.
+    #[property(key = REST_CATALOG_PROP_PAGE_SIZE, default = None, getter)]
+    page_size: Option<U32Prop<1, { i32::MAX as u32 }>>,

Review Comment:
   Just use u32, you can do the check in the parse function.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to