Skip to content

Commit

Permalink
also this
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao committed Jan 3, 2025
1 parent 2f6b61c commit 37c4d02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import io.airbyte.cdk.output.ExceptionHandler
import io.airbyte.cdk.output.OutputConsumer
import io.airbyte.protocol.models.v0.AirbyteConnectionStatus
import io.airbyte.protocol.models.v0.AirbyteMessage
import io.github.oshai.kotlinlogging.KotlinLogging
import io.micronaut.context.annotation.Requires
import jakarta.inject.Singleton

private val logger = KotlinLogging.logger {}

@Singleton
@Requires(property = Operation.PROPERTY, value = "check")
@Requires(env = ["destination"])
Expand All @@ -40,6 +43,7 @@ class CheckOperation<T : ConfigurationSpecification, C : DestinationConfiguratio
)
outputConsumer.accept(successMessage)
} catch (t: Throwable) {
logger.warn(t) { "Caught throwable during CHECK" }
val (traceMessage, statusMessage) = exceptionHandler.handleCheckFailure(t)
outputConsumer.accept(traceMessage)
outputConsumer.accept(statusMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ package io.airbyte.integrations.destination.iceberg.v2
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
import software.amazon.awssdk.auth.credentials.AwsCredentials
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider

const val ACCESS_KEY_ID = "access-key-id"
const val SECRET_ACCESS_KEY = "secret-access-key"

class GlueCredentialsProvider private constructor(private val credentials: AwsBasicCredentials) :
class GlueCredentialsProvider private constructor(private val credentials: AwsCredentials) :
AwsCredentialsProvider {
override fun resolveCredentials(): AwsCredentials {
return this.credentials
Expand All @@ -20,13 +21,15 @@ class GlueCredentialsProvider private constructor(private val credentials: AwsBa
companion object {
@JvmStatic
fun create(properties: Map<String, String>): GlueCredentialsProvider {
val accessKey =
properties[ACCESS_KEY_ID]
?: throw IllegalArgumentException("Missing property: access-key-id")
val secretKey =
properties[SECRET_ACCESS_KEY]
?: throw IllegalArgumentException("Missing property: secret-access-key")
return GlueCredentialsProvider(AwsBasicCredentials.create(accessKey, secretKey))
val accessKey = properties[ACCESS_KEY_ID]
val secretKey = properties[SECRET_ACCESS_KEY]
val creds =
if (accessKey != null && secretKey != null) {
AwsBasicCredentials.create(accessKey, secretKey)
} else {
DefaultCredentialsProvider.create().resolveCredentials()
}
return GlueCredentialsProvider(creds)
}
}
}

0 comments on commit 37c4d02

Please sign in to comment.