Skip to content

Commit

Permalink
feat: remove coupling with optional client implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
scrocquesel committed Dec 9, 2024
1 parent 9310dcb commit 7985e90
Show file tree
Hide file tree
Showing 105 changed files with 1,770 additions and 4,736 deletions.
5 changes: 5 additions & 0 deletions .quarkus/cli/plugins/quarkus-cli-catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version" : "v1",
"lastUpdate" : "30/11/2024 15:41:58",
"plugins" : { }
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
package io.quarkiverse.amazon.acm.deployment;

import java.util.List;

import org.jboss.jandex.DotName;

import io.quarkiverse.amazon.acm.runtime.AcmBuildTimeConfig;
import io.quarkiverse.amazon.acm.runtime.AcmRecorder;
import io.quarkiverse.amazon.common.deployment.AbstractAmazonServiceProcessor;
import io.quarkiverse.amazon.common.deployment.AmazonClientAsyncResultBuildItem;
import io.quarkiverse.amazon.common.deployment.AmazonClientAsyncTransportBuildItem;
import io.quarkiverse.amazon.common.deployment.AmazonClientInterceptorsPathBuildItem;
import io.quarkiverse.amazon.common.deployment.AmazonClientSyncResultBuildItem;
import io.quarkiverse.amazon.common.deployment.AmazonClientSyncTransportBuildItem;
import io.quarkiverse.amazon.common.deployment.AmazonHttpClients;
import io.quarkiverse.amazon.common.deployment.RequireAmazonClientBuildItem;
import io.quarkiverse.amazon.common.deployment.RequireAmazonClientInjectionBuildItem;
import io.quarkiverse.amazon.common.deployment.RequireAmazonClientTransportBuilderBuildItem;
import io.quarkiverse.amazon.common.deployment.RequireAmazonTelemetryBuildItem;
import io.quarkiverse.amazon.common.deployment.spi.EventLoopGroupBuildItem;
import io.quarkiverse.amazon.common.runtime.AmazonClientApacheTransportRecorder;
import io.quarkiverse.amazon.common.runtime.AmazonClientAwsCrtTransportRecorder;
import io.quarkiverse.amazon.common.runtime.AmazonClientCommonRecorder;
import io.quarkiverse.amazon.common.runtime.AmazonClientNettyTransportRecorder;
import io.quarkiverse.amazon.common.runtime.AmazonClientOpenTelemetryRecorder;
import io.quarkiverse.amazon.common.runtime.AmazonClientUrlConnectionTransportRecorder;
import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkiverse.amazon.common.deployment.AmazonClientExtensionBuildItem;
import io.quarkiverse.amazon.common.runtime.HasSdkBuildTimeConfig;
import io.quarkiverse.amazon.common.runtime.HasTransportBuildTimeConfig;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import software.amazon.awssdk.services.acm.AcmAsyncClient;
import software.amazon.awssdk.services.acm.AcmAsyncClientBuilder;
import software.amazon.awssdk.services.acm.AcmClient;
Expand Down Expand Up @@ -61,150 +39,41 @@ protected DotName syncClientName() {
}

@Override
protected DotName asyncClientName() {
return DotName.createSimple(AcmAsyncClient.class.getName());
protected Class<?> syncClientBuilderClass() {
return AcmClientBuilder.class;
}

@Override
protected String builtinInterceptorsPath() {
return "software/amazon/awssdk/services/acm/execution.interceptors";
protected DotName asyncClientName() {
return DotName.createSimple(AcmAsyncClient.class.getName());
}

@BuildStep
void setup(
BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport,
BuildProducer<FeatureBuildItem> feature,
BuildProducer<AmazonClientInterceptorsPathBuildItem> interceptors) {

setupExtension(extensionSslNativeSupport, feature, interceptors);
@Override
protected Class<?> asyncClientBuilderClass() {
return AcmAsyncClientBuilder.class;
}

@BuildStep
void discoverClientInjectionPoints(BeanRegistrationPhaseBuildItem beanRegistrationPhase,
BuildProducer<RequireAmazonClientInjectionBuildItem> requireClientInjectionProducer) {

discoverClientInjectionPointsInternal(beanRegistrationPhase, requireClientInjectionProducer);
@Override
protected String builtinInterceptorsPath() {
return "software/amazon/awssdk/services/acm/execution.interceptors";
}

@BuildStep
void discover(
List<RequireAmazonClientInjectionBuildItem> amazonClientInjectionPoints,
BuildProducer<RequireAmazonClientBuildItem> requireClientProducer) {

discoverClient(amazonClientInjectionPoints, requireClientProducer);
@Override
protected HasTransportBuildTimeConfig transportBuildTimeConfig() {
return buildTimeConfig;
}

@BuildStep
void discoverTelemetry(BuildProducer<RequireAmazonTelemetryBuildItem> telemetryProducer) {

discoverTelemetry(telemetryProducer, buildTimeConfig.sdk());
@Override
protected HasSdkBuildTimeConfig sdkBuildTimeConfig() {
return buildTimeConfig;
}

@BuildStep
void setupClient(List<RequireAmazonClientBuildItem> clientRequirements,
BuildProducer<RequireAmazonClientTransportBuilderBuildItem> clientProducer) {

setupClient(clientRequirements, clientProducer, buildTimeConfig.sdk(), buildTimeConfig.syncClient(),
buildTimeConfig.asyncClient());
}

@BuildStep(onlyIf = AmazonHttpClients.IsAmazonApacheHttpServicePresent.class)
@Record(ExecutionTime.RUNTIME_INIT)
void setupApacheSyncTransport(List<RequireAmazonClientTransportBuilderBuildItem> amazonClients, AcmRecorder recorder,
AmazonClientApacheTransportRecorder transportRecorder,
BuildProducer<AmazonClientSyncTransportBuildItem> syncTransports) {

createApacheSyncTransportBuilder(amazonClients,
transportRecorder,
buildTimeConfig.syncClient(),
recorder.getSyncConfig(),
syncTransports);
}

@BuildStep(onlyIf = AmazonHttpClients.IsAmazonAwsCrtHttpServicePresent.class)
@Record(ExecutionTime.RUNTIME_INIT)
void setupAwsCrtSyncTransport(List<RequireAmazonClientTransportBuilderBuildItem> amazonClients, AcmRecorder recorder,
AmazonClientAwsCrtTransportRecorder transportRecorder,
BuildProducer<AmazonClientSyncTransportBuildItem> syncTransports) {

createAwsCrtSyncTransportBuilder(amazonClients,
transportRecorder,
buildTimeConfig.syncClient(),
recorder.getSyncConfig(),
syncTransports);
}

@BuildStep(onlyIf = AmazonHttpClients.IsAmazonUrlConnectionHttpServicePresent.class)
@Record(ExecutionTime.RUNTIME_INIT)
void setupUrlConnectionSyncTransport(List<RequireAmazonClientTransportBuilderBuildItem> amazonClients, AcmRecorder recorder,
AmazonClientUrlConnectionTransportRecorder transportRecorder,
BuildProducer<AmazonClientSyncTransportBuildItem> syncTransports) {

createUrlConnectionSyncTransportBuilder(amazonClients,
transportRecorder,
buildTimeConfig.syncClient(),
recorder.getSyncConfig(),
syncTransports);
}

@BuildStep(onlyIf = AmazonHttpClients.IsAmazonNettyHttpServicePresent.class)
@Record(ExecutionTime.RUNTIME_INIT)
void setupNettyAsyncTransport(List<RequireAmazonClientTransportBuilderBuildItem> amazonClients, AcmRecorder recorder,
AmazonClientNettyTransportRecorder transportRecorder,
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports,
EventLoopGroupBuildItem eventLoopSupplier) {

createNettyAsyncTransportBuilder(amazonClients,
transportRecorder,
buildTimeConfig.asyncClient(),
recorder.getAsyncConfig(),
asyncTransports, eventLoopSupplier.getMainEventLoopGroup());
}

@BuildStep(onlyIf = AmazonHttpClients.IsAmazonAwsCrtHttpServicePresent.class)
@Record(ExecutionTime.RUNTIME_INIT)
void setupAwsCrtAsyncTransport(List<RequireAmazonClientTransportBuilderBuildItem> amazonClients, AcmRecorder recorder,
AmazonClientAwsCrtTransportRecorder transportRecorder,
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports) {

createAwsCrtAsyncTransportBuilder(amazonClients,
transportRecorder,
buildTimeConfig.asyncClient(),
recorder.getAsyncConfig(),
asyncTransports);
}
void setup(
AcmRecorder recorder,
BuildProducer<AmazonClientExtensionBuildItem> amazonExtensions) {

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void createClientBuilders(AcmRecorder recorder,
AmazonClientCommonRecorder commonRecorder,
AmazonClientOpenTelemetryRecorder otelRecorder,
List<RequireAmazonClientInjectionBuildItem> amazonClientInjections,
List<RequireAmazonTelemetryBuildItem> amazonRequireTelemtryClients,
List<AmazonClientSyncTransportBuildItem> syncTransports,
List<AmazonClientAsyncTransportBuildItem> asyncTransports,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans,
BuildProducer<AmazonClientSyncResultBuildItem> clientSync,
BuildProducer<AmazonClientAsyncResultBuildItem> clientAsync,
LaunchModeBuildItem launchModeBuildItem,
ExecutorBuildItem executorBuildItem) {

createClientBuilders(
recorder,
commonRecorder,
otelRecorder,
buildTimeConfig,
amazonClientInjections,
amazonRequireTelemtryClients,
syncTransports,
asyncTransports,
AcmClientBuilder.class,
AcmAsyncClientBuilder.class,
null,
syntheticBeans,
clientSync,
clientAsync,
launchModeBuildItem,
executorBuildItem);
setupExtension(recorder, amazonExtensions);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package io.quarkiverse.amazon.acm.runtime;

import io.quarkiverse.amazon.common.runtime.AsyncHttpClientBuildTimeConfig;
import io.quarkiverse.amazon.common.runtime.DevServicesBuildTimeConfig;
import io.quarkiverse.amazon.common.runtime.HasSdkBuildTimeConfig;
import io.quarkiverse.amazon.common.runtime.SyncHttpClientBuildTimeConfig;
import io.quarkiverse.amazon.common.runtime.HasTransportBuildTimeConfig;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
Expand All @@ -13,17 +12,7 @@
*/
@ConfigMapping(prefix = "quarkus.acm")
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
public interface AcmBuildTimeConfig extends HasSdkBuildTimeConfig {

/**
* Sync HTTP transport configuration for Amazon ACM client
*/
SyncHttpClientBuildTimeConfig syncClient();

/**
* Async HTTP transport configuration for Amazon ACM client
*/
AsyncHttpClientBuildTimeConfig asyncClient();
public interface AcmBuildTimeConfig extends HasSdkBuildTimeConfig, HasTransportBuildTimeConfig {

/**
* Config for dev services
Expand Down
Loading

0 comments on commit 7985e90

Please sign in to comment.