Skip to content

Commit

Permalink
add modules for elastic load balancing clients (#1504)
Browse files Browse the repository at this point in the history
* add elasticloadbalancingv2 module

* add elasticloadbalancing module
  • Loading branch information
emattheis authored Nov 28, 2024
1 parent 9310dcb commit 4eca635
Show file tree
Hide file tree
Showing 29 changed files with 8,200 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,26 @@
<artifactId>quarkus-amazon-ecr-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-elasticloadbalancing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-elasticloadbalancing-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-elasticloadbalancingv2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-elasticloadbalancingv2-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-devservices-eventbridge</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* xref:amazon-cognitouserpools.adoc[Cognito User Pools]
* xref:amazon-dynamodb.adoc[DynamoDB]
* xref:amazon-ecr.adoc[ECR]
* xref:amazon-elasticloadbalancing.adoc[Elastic Load Balancing]
* xref:amazon-elasticloadbalancingv2.adoc[Elastic Load Balancing v2]
* xref:amazon-eventbridge.adoc[EventBridge]
* xref:amazon-iam.adoc[IAM]
* xref:amazon-inspector.adoc[Inspector]
Expand Down
17 changes: 17 additions & 0 deletions docs/modules/ROOT/pages/amazon-elasticloadbalancing.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
= Amazon Elastic Load Balancing Client

include::./includes/attributes.adoc[]

Amazon Elastic Load Balancing automatically distributes incoming application traffic across multiple targets and virtual appliances in one or more Availability Zones (AZs).

You can find more information about Elastic Load Balancing at https://docs.aws.amazon.com/elasticloadbalancing/[the Amazon Elastic Load Balancing website].

NOTE: The Elastic Load Balancing extension is based on https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/welcome.html[AWS Java SDK 2.x].
It's a major rewrite of the 1.x code base that offers two programming models (Blocking & Async).

The Quarkus extension supports two programming models:

* Blocking access using URL Connection HTTP client (by default) or the Apache HTTP Client
* https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/basics-async.html[Asynchronous programming] based on JDK's `CompletableFuture` objects and the Netty HTTP client (by default) or the AWS CRT-based HTTP client
include::./includes/quarkus-amazon-elasticloadbalancing.adoc[]
17 changes: 17 additions & 0 deletions docs/modules/ROOT/pages/amazon-elasticloadbalancingv2.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
= Amazon Elastic Load Balancing v2 Client

include::./includes/attributes.adoc[]

Amazon Elastic Load Balancing automatically distributes incoming application traffic across multiple targets and virtual appliances in one or more Availability Zones (AZs).

You can find more information about Elastic Load Balancing at https://docs.aws.amazon.com/elasticloadbalancing/[the Amazon Elastic Load Balancing website].

NOTE: The Elastic Load Balancing v2 extension is based on https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/welcome.html[AWS Java SDK 2.x].
It's a major rewrite of the 1.x code base that offers two programming models (Blocking & Async).

The Quarkus extension supports two programming models:

* Blocking access using URL Connection HTTP client (by default) or the Apache HTTP Client
* https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/basics-async.html[Asynchronous programming] based on JDK's `CompletableFuture` objects and the Netty HTTP client (by default) or the AWS CRT-based HTTP client
include::./includes/quarkus-amazon-elasticloadbalancingv2.adoc[]
1,748 changes: 1,748 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-amazon-elasticloadbalancing.adoc

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,748 changes: 1,748 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-amazon-elasticloadbalancingv2.adoc

Large diffs are not rendered by default.

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions elasticloadbalancing/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-elasticloadbalancing-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>

<artifactId>quarkus-amazon-elasticloadbalancing-deployment</artifactId>
<name>Quarkus - Amazon Services - Elastic Load Balancing - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-common-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-elasticloadbalancing</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
<scope>test</scope>
</dependency>
<!-- Imported manually because conditional dependencies
are not automatically added to test scope -->
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
<artifactId>quarkus-amazon-netty-client-internal-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-crt-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>url-connection-client</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package io.quarkiverse.amazon.elasticloadbalancing.deployment;

import java.util.List;

import org.jboss.jandex.DotName;

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.quarkiverse.amazon.elasticloadbalancing.runtime.ElasticLoadBalancingBuildTimeConfig;
import io.quarkiverse.amazon.elasticloadbalancing.runtime.ElasticLoadBalancingRecorder;
import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
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.elasticloadbalancing.ElasticLoadBalancingAsyncClient;
import software.amazon.awssdk.services.elasticloadbalancing.ElasticLoadBalancingAsyncClientBuilder;
import software.amazon.awssdk.services.elasticloadbalancing.ElasticLoadBalancingClient;
import software.amazon.awssdk.services.elasticloadbalancing.ElasticLoadBalancingClientBuilder;

public class ElasticLoadBalancingProcessor extends AbstractAmazonServiceProcessor {

private static final String AMAZON_CLIENT_NAME = "amazon-sdk-elasticloadbalancing";

ElasticLoadBalancingBuildTimeConfig buildTimeConfig;

@Override
protected String amazonServiceClientName() {
return AMAZON_CLIENT_NAME;
}

@Override
protected String configName() {
return "elasticloadbalancing";
}

@Override
protected DotName syncClientName() {
return DotName.createSimple(ElasticLoadBalancingClient.class.getName());
}

@Override
protected DotName asyncClientName() {
return DotName.createSimple(ElasticLoadBalancingAsyncClient.class.getName());
}

@Override
protected String builtinInterceptorsPath() {
return "software/amazon/awssdk/services/elasticloadbalancing/execution.interceptors";
}

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

setupExtension(extensionSslNativeSupport, feature, interceptors);
}

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

discoverClientInjectionPointsInternal(beanRegistrationPhase, requireClientInjectionProducer);
}

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

discoverClient(amazonClientInjectionPoints, requireClientProducer);
}

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

discoverTelemetry(telemetryProducer, buildTimeConfig.sdk());
}

@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,
ElasticLoadBalancingRecorder 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,
ElasticLoadBalancingRecorder 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,
ElasticLoadBalancingRecorder 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,
ElasticLoadBalancingRecorder 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,
ElasticLoadBalancingRecorder recorder,
AmazonClientAwsCrtTransportRecorder transportRecorder,
BuildProducer<AmazonClientAsyncTransportBuildItem> asyncTransports) {

createAwsCrtAsyncTransportBuilder(amazonClients,
transportRecorder,
buildTimeConfig.asyncClient(),
recorder.getAsyncConfig(),
asyncTransports);
}

@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void createClientBuilders(ElasticLoadBalancingRecorder 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,
ElasticLoadBalancingClientBuilder.class,
ElasticLoadBalancingAsyncClientBuilder.class,
null,
syntheticBeans,
clientSync,
clientAsync,
launchModeBuildItem,
executorBuildItem);
}
}
Loading

0 comments on commit 4eca635

Please sign in to comment.