gomnitrix commented on code in PR #3045:
URL: https://github.com/apache/iggy/pull/3045#discussion_r3047537271
##########
core/connectors/sinks/iceberg_sink/src/sink.rs:
##########
@@ -30,22 +30,32 @@ use tracing::{debug, error, info};
#[async_trait]
impl Sink for IcebergSink {
async fn open(&mut self) -> Result<(), Error> {
- let redacted_store_key = self
- .config
- .store_access_key_id
- .chars()
- .take(3)
- .collect::<String>();
- let redacted_store_secret = self
- .config
- .store_secret_access_key
- .chars()
- .take(3)
- .collect::<String>();
- info!(
- "Opened Iceberg sink connector with ID: {} for URL: {}, store
access key ID: {redacted_store_key}*** store secret:
{redacted_store_secret}***",
- self.id, self.config.uri
- );
+ match (
+ &self.config.store_access_key_id,
+ &self.config.store_secret_access_key,
+ ) {
+ (Some(store_access_key_id), Some(store_secret_access_key)) => {
+ let redacted_store_key =
store_access_key_id.chars().take(3).collect::<String>();
+ let redacted_store_secret =
+
store_secret_access_key.chars().take(3).collect::<String>();
+ info!(
+ "Opened Iceberg sink connector with ID: {} for URL: {},
store access key ID: {redacted_store_key}*** store secret:
{redacted_store_secret}***",
+ self.id, self.config.uri
+ );
+ }
+ (None, None) => {
+ info!(
+ "Opened Iceberg sink connector with ID: {} for URL: {}. No
explicit credentials provided, falling back to default credential provider
chain",
+ self.id, self.config.uri
+ );
+ }
+ _ => {
+ error!(
+ "Partially configured Iceberg credentials. You must
provide both store_access_key_id and store_secret_access_key, or omit both."
+ );
+ return Err(Error::InvalidConfig);
Review Comment:
I've switched to `Error::InvalidConfigValue`, I think it's now much cleaner!
--
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]