-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.quarkus.amazon.s3.deployment; | ||
|
||
import org.jboss.jandex.DotName; | ||
|
||
import io.quarkus.amazon.common.deployment.RequireAmazonClientInjectionBuildItem; | ||
import io.quarkus.amazon.common.runtime.ClientUtil; | ||
import io.quarkus.amazon.s3.runtime.S3PresignerBuildTimeConfig; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.CombinedIndexBuildItem; | ||
import software.amazon.awssdk.services.s3.presigner.S3Presigner; | ||
|
||
/** | ||
* This processor ensures backward compatibility for applications using `S3Presigner`, such as `camel-quarkus-aws2-s3`. | ||
* Previously, `S3Presigner` was produced even when no injection points were discovered. | ||
* With support for multiple named clients, `S3Presigner` beans are now produced in the same way as other clients. | ||
*/ | ||
public class S3PresignerProcessor { | ||
|
||
S3PresignerBuildTimeConfig buildTimeConfig; | ||
|
||
protected DotName presignerClientName() { | ||
return DotName.createSimple(S3Presigner.class.getName()); | ||
} | ||
|
||
@BuildStep | ||
void setup(CombinedIndexBuildItem combinedIndexBuildItem, | ||
BuildProducer<RequireAmazonClientInjectionBuildItem> requireClientInjectionProducer) { | ||
|
||
if (buildTimeConfig.unremovableS3PresignerBean()) { | ||
requireClientInjectionProducer | ||
.produce(new RequireAmazonClientInjectionBuildItem(presignerClientName(), ClientUtil.DEFAULT_CLIENT_NAME)); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.quarkus.amazon.s3.deployment; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import jakarta.enterprise.inject.Instance; | ||
import jakarta.enterprise.inject.spi.CDI; | ||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
import software.amazon.awssdk.services.s3.presigner.S3Presigner; | ||
|
||
public class S3PresignerConfigTest { | ||
|
||
@Inject | ||
Instance<S3Client> client; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addAsResource("sync-urlconn-full-config.properties", "application.properties")); | ||
|
||
@Test | ||
public void test() { | ||
assertNotNull(client.get()); | ||
assertNotNull(CDI.current().select(S3Presigner.class).get()); | ||
// should finish with success | ||
client.get().close(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.quarkus.amazon.s3.deployment; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import jakarta.enterprise.inject.Instance; | ||
import jakarta.enterprise.inject.spi.CDI; | ||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
import software.amazon.awssdk.services.s3.presigner.S3Presigner; | ||
|
||
public class S3PresignerDisabledConfigTest { | ||
|
||
@Inject | ||
Instance<S3Client> client; | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addAsResource("s3presigner-disabled.properties", "application.properties")); | ||
|
||
@Test | ||
public void test() { | ||
assertNotNull(client.get()); | ||
assertFalse(CDI.current().select(S3Presigner.class).isResolvable()); | ||
// should finish with success | ||
client.get().close(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
quarkus.s3.accelerate-mode=false | ||
quarkus.s3.checksum-validation=true | ||
quarkus.s3.chunked-encoding=true | ||
quarkus.s3.dualstack=false | ||
quarkus.s3.path-style-access=false | ||
quarkus.s3.use-arn-region-enabled=true | ||
#quarkus.s3.profile-name=foo | ||
|
||
quarkus.s3.endpoint-override=http://localhost:9090 | ||
|
||
quarkus.s3.aws.region=us-east-2 | ||
quarkus.s3.aws.credentials.type=static | ||
quarkus.s3.aws.credentials.static-provider.access-key-id=test-key | ||
quarkus.s3.aws.credentials.static-provider.secret-access-key=test-secret | ||
|
||
quarkus.s3.sync-client.type = url | ||
quarkus.s3.sync-client.connection-timeout = 0.100S | ||
quarkus.s3.sync-client.socket-timeout = 0.100S | ||
|
||
|
||
quarkus.s3.unremovable-s3-presigner-bean=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.amazon.s3.runtime; | ||
|
||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
/** | ||
* Amazon S3 build time configuration | ||
*/ | ||
@ConfigMapping(prefix = "quarkus.s3") | ||
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) | ||
public interface S3PresignerBuildTimeConfig { | ||
|
||
/** | ||
* When `true`, a `S3Presigner` default bean is produced even if no injection points are discovered. | ||
* | ||
* Note: The default value ensures backward compatibility; you can disable it. It will be removed in the next major version. | ||
*/ | ||
@WithDefault(value = "true") | ||
boolean unremovableS3PresignerBean(); | ||
} |